The Daily Click ::. Forums ::. Klik Coding Help ::. Lets talk theory
 

Post Reply  Post Oekaki 
 

Posted By Message

siegeon



Registered
  28/03/2008
Points
  18
28th March, 2008 at 18:36:46 -

Since I have this custom movement engine, I want to add custom movement to my baddies as well. I know how to do this; it will be something like once you’re within 40 pix then it will move to you at a cretin speed. If your outside of that rang it will "bounce" around until it "sees" you.

My concern is that with that with a screen full of baddies it will bog down the system. Even if I only add one detector for "sight". Is there a better way of having good AI on baddies without having the problem of slowing systems down? Or more like what is a good number of objects to track without bogging everything down.


 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14456

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
28th March, 2008 at 19:00:04 -

Well i don't think it's usually a problem until you go into the hundreds of baddies. But also depends on how complex the ai is.

if they're basic baddies like goombas from super mario bros you wont have much problem with slowdown.

also you can spawn enemies or deactivate them until they are on screen to save a bit of processing speed.

 
.

siegeon



Registered
  28/03/2008
Points
  18
28th March, 2008 at 19:06:12 -

The AI is very thick, lots of checks, but I understand what your saying. Now what if we want them to be track outside of the screen. So you cant just run it out of the screen, but have to deal with it.

 
n/a

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
6th April, 2008 at 07:07:03 -

I'm not quite sure what you're asking, but I use this condition a lot:

"NEGATE: Bad Guy is getting closer than -32px from windows edge"

This will select all bad guys onscreen, with a 32px allowance in case they're only half onscreen.

I usually do two events, one tests if they're onscreen (-32px) and one tests if they're miles away (-120px).

Then I decide which processes run or not. So offscreen for me means definitely no line of sight tests. But I may allow an enemy to continue moving and colision testing, so long as he's not miles away. This allows some offscreen enemies to wander onscreen.

But if you're gonna control the enemies all the time, regardless of how far away they are, your best bet is to simply not have that many of them. If an enemy can migrate that much, you should be able to get away with fewer of them.

 
191 / 9999 * 7 + 191 * 7

siegeon



Registered
  28/03/2008
Points
  18
7th April, 2008 at 23:32:07 -

Oh thats a good idea, dual checks. I think I will do an "on screen" check where the real AI takes over, and a off screen check that will keep the mobbies moving on a "bare bones" level. Thanks for the help.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click