The biggest cause of slowdown with TAHC1 was that enemies were created every 00:02 of a second, then destroyed. Unfortunately I see no way of getting rid of this for the second one (Though I have improved how efficient it is by a long way!) Let me know if you have a better way of doing it.
Method 1 - Just use one object for the characters, created at the beginning of the level
Well, this is out of the question because they would simply bounce off scenery behind them if the top of their head touches it.
Method 2 - Just use one object for the characters, created every 00:02 when visible on-screen
What, and not have customised clothes/face? Never!
(This is the method that TAHC1 used)
Method 3 - Use 3 objects, created every 00:02 seconds
This is perfect, in terms of the quality of the models produced. However, it slows it down quite a bit.
Method 3 is the way I'm using to create the models in TAHC2, but I gave the individual body pieces a movement speed. This means that instead of creating them every 00:02 of a second, I only REALLY need to update them when the NPC changes direction or speed, or animation.
However, it's hell to try and program a non-buggy method of doing that when there are 50 people all walking into each other on-screen at once, so I settled for the next best thing. In the options menu you can choose how often the characters' positions are updated. The timings are all staggered between NPCs so there won't just be a dip in fps every 5th of a second. This method works very well, lowers the number of objects on-screen and reduces the lag of having to create the body parts.
50 characters 50 times a second = 368 objects @ 188 fps
50 characters 25 times a second = 296 objects @ 212 fps
50 characters 10 times a second = 240 objects @ 235 fps
50 characters 01 times a second = 220 objects @ 250 fps
No characters = 370 fps
I'm using a slow core 2 duo processor.
IT IS ALSO POSSIBLE TO CHANGE THE SIZE OF THE WINDOW- THE LARGER THE WINDOW, THE MORE THAT WILL BE RENDERED AT ONCE. This should help people to scale the game to their computer's capabilities
One more problem down.
|