Jump to content
  • Advertisement
  • entries
  • comments
  • views

Experience,Enemies and AI, Oh my!

Sign in to follow this  


So, last night I implemented the new experience milestones generator, and it seems to work good. I tried to break the system by adding crazy amounts of experience gains, but it held it's ground and gave me the proper amount of points and wouldnt let me 'over-level' past 100.

I modified my battlefield test map to have 16 'corrals' in each corral i put 25 units of each enemy type, so 400 enemies in a fairly enclosed space.

At first the results were not great, a few instances brought the game to it's knees, and i figured AI proccessing was to blame.

So after a few attempts in the past to make the AI effecant I think I have striped it down as far as it can go, and less and the enemies will be _really_ dumb.

So instead of modifying the actual AI i decided to change the AI-proccessing, at the moment, core battle ai was being proccessed every two seconds, which was acceptable. But the subclasses of the core battle AI were being proccessed each frame, I knew somthing had to be done about that.

So, instead of adding a timer conditional to each of the 16 battle delegates i decided instead to take a different approach, at the game-level root class MWCharacter, i defined a new event, EventProcessAI, and i had this event be triggered every 2 seconds as a result of the EventPulse event, then i changed the delegates to use this event instead of the EventBeforePaint event.

So this made things better, but now it could be clearly seen that everyone was waiting 2 seconds before attacking me, this wasnt very desireable, so i had a thought.

back where i raise the EventProcessAI event, i decided to have the delay vary, instead of being a constant 2 seconds.

So using a random statement i had the players randomly wait between 0 miliseconds and 10000 miliseconds (10 seconds) before updating thier AI, this made for a more distributed action of the AI.

While this made things better, there was still a problem, enemies that were fast, 'wolves' would potentialy stop and wait for up to 10 seconds before attacking you, and enemies that were slow, Kholstean Giants, would somtimes hammer away at you feverishly.

So i knew i had to influence the delay from thier stats somehow, and after some thinking i decided to make use of a character's Agility property, this way characters with high agility attack notciably faster, and those with low agility, attack at longer intervals, and sorta lumber around after you.

So now, even with this huge example (it is unlikely we will ever have a 400 enemy battle in one spot, except maybe the final battle, but 400 is a bit excessive) the frame rate never drops below 22 fps, given that we lock to 35 it's not a huge degridation (note my computer is a 950 mhz), but i am sure there is still speed to gain from somewhere.

I will try and run a profile over it this weekend to see what is eating all the time, I suspect the use of Distance checking functions as well as LineOfSight functions, once i pinpoint the bottlenecks I can work to optimize them.

In other news, I just created a 'threat map' which is a basic guideline we will be using when placing Enemy Spawners in the various maps.

comments on anything said above?
Sign in to follow this  

1 Comment

Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!