PDA

View Full Version : Designing an engine from genre analysis



Zanthos
30-05-2003, 04:23 PM
This is probably going to be more of a mini-article than a topic, I've got time on my hands and never really given something to the Delphi programming community so I'll share a *little* bit of knowledge in the hope that it will be of help to someone :)

Now, on with the 'show'...

Most people when designing an engine come across many problems such as what owns what, what can use that, etcetc, and with a logical OO approach it is 'easily' solved, what is not as easily solved, however, is what the engine should actually manage, and what bits should be left over to the DLL or scripting interface where the actual game logic is.

Through writing the tech doc for my engine this was what kept tripping me up, what should the engine do, what should the game logic do.

A possible solution is to look at existing games of the same genre out there, (for this, its RTS), and see what similarities they have. Lets look at an example..

* Unit health and attacking.

Considering TA, AOE2, RA2 they all have one thing in common, a health value, which starts @ a maximum on unit creation or repair, and when it reaches zero, the unit dies. This may sound logical, but it could also be put in the game logic.. With it in the actual engine itself, it allows the engine to remove units when they're dead, and notify the game logic that a unit has been removed, explosions and debris can then be generated on the map.

* Weaponry.

This is something which the engine will not be able to deal with, as AOE2 has normal and pierce attacks, TA has many different weapon types(as far as I'm aware), and RA2 takes into account what unit is being attacked and what with.. so this is a no-no for the engine. This is where some people might fall over.. they might add weapons to the engine, with attack values, but its then highly restricted to weapons being only able to deal a certain level of damage.

The trick to this is then, to compare what currently existing games share in common, then add them to the engine to handle, those that are, even in the single occurence, specific to one game only, let the game logic handle it, that way you get the highest degree of flexibility with the least amount of headaches and brain power.

It is, of course, only a guideline, you may intend to make your engine more flexible by removing things such as health values for units, modify unit groupings to make attacking more "squad based". Or, on the other hand you may intend to make your engine more rigid, for example a medieval RTS system, which would then have Normal and Pierce attack values(if you so wish).

If any inspiring thoughts came from this.. its a miracle! :)

Happy Coding.

Zanthos.