James,
 Unfortunately, it all depends. :-)

It depends on the complexity of your game and your AI - on how big
your play area is and on how much optimisation you want to do.

I've seen the following approaches or combinations of these approaches:
i) AI (and pixel-perfect x/y positioning) is maintained for every
object all of the time (slowest and most memory intensive)
ii) AI (pathfinding etc.) is maintained while offscreen, and 'grid
location' for each object, but not pixel location. That's only turned
on when an object gets 'close' to the screen.
iii) AI (pathfinding etc.) is only maintained for objects close to the
screen - anything too far away from the screen essentially 'freezes'.
This sort of approach is often dealt with using sectors or regions,
for speed - each region has a list of objects/enemies that are
currently inside it, and only the regions in the vicinity of the
player are turned on; the rest just aren't processed during a
game-update loop.
iv) AI _is_ maintained while objects are offscreen, but their AI
update is run on a slower update rate than the AI for objects near
to/on the screen.

But in reality, there are as many approaches as there are programmers!
Of the above, I favour number iii) for a grid-based
running-around-sort-of-a-game - but as I said, it depends on the game
and circumstances.

Hope that's of some help.

Ian

On 4/27/07, James Marsden <[EMAIL PROTECTED]> wrote:
Hello all,

When building a game where collision detection for enemies is important
(such as a scrolling tile game), how do you create persistent AI for an
enemy when it's off-screen?

For example, walking away from the enemy causes it to be removed from
the game area, but the enemy needs to keep wandering around the world in
virtual terms, so the player can't easily tell where the enemy is going
to be when returning to the same area. How do you maintain that
interaction for the enemy, or is it not done like that because it's too
processor intensive?

Any tips or pointers to resources would be much appreciated.

Thanks!

James
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to