Flygon wrote:Well, the Genesis should be able to handle a LOT more than this. You must be doing something pretty complicated to have issues with only 40 helicopters. Can you elaborate?
I agree Geny can do more. Indeed I optimized a bit the code and now it is capable of doing that (using pointers instead "[]" while using an array).
BUT if we consider that:
- 1 instruction for 4 cycles.
- 60 fps
- 40 enemies
we have:
7650000 / ( 4 * 60 * 40 ) =(more or less) 800 instructions per enemy.
Moreover:
- About 30-40% of asm instructions are 4bytes in large (don't look at me, ask gcc).
- You need colision detection, scroll, update sprites,... and VBLANK special precessing things too (palettes,etc...).
So, in this context you are lucky if you have about 500 instructions per enemy. Not so much.
Flygon wrote: It probably isn't the best example given the genre (It isn't a platform game), but a majority of AI controlled opponents act entirely on their own accord in the Shining Force series (Most specifically, the second game, the first one had some ridiculously set AI routines).
As you might know in a turn based game you have up to several seconds to think, while in a action game you have 1/60 seconds at all.
Chilly Willy wrote:
[...] but you could do a partial A* pretty easily by only considering paths in the direction of the end point, and/or only considering partial paths (only go X number of units instead of all the way to the objective). In that way, you can make A* work with even 8-bit systems.
Check this:
even this:
You need to calculate at least one time the full path, or put the objects and enemies in strategic positions, that is what all games do, even today, I think.
Chilly Willy wrote: You could compensate for problems like that by having a table of impassable objects, then when considering the path, look at the table first to adjust which way you consider your partial paths.
My idea is to use an extra field in the tile map for collision detection.
You suggest when spawning new random enemies first calculate if they collide with an object, if not, create the new enemy. Is it? Good idea!
UPDATE:
eteream wrote:- About 30-40% of asm instructions are 4bytes in large (don't look at me, ask gcc) *.
This is mainly because I used 8bit access instructions, so in conclusion: avoid (if posible) to use 8bit variables.