Making missle system more efficient

Level 12
Joined
Jun 1, 2008
Messages
360
Hi there,
first time I need some backup on my trigger ;-)
I made a missle system for my map City of Terror II which is doing quite well.

But when there are many missles (like 50+) the game begins to stutter.
I work with GUI, used a 0.03s timer and there are no leaks.
(-> It stops stuttering when the missles are gone)

Basically I am looking for a way to make the collision-check as efficient as possible (and I don't want to use other systems that don't fit to my map).
And to do this, I tried checking the collision with destructibles only when the missle spawns for all destructibles within it's maximum flying range, instead of picking nearby destructibles in the 0.03s timer.

It works, but it produces even more stuttering (actually a short freeze of the game) if more than 5 missles spawn within 0.1 seconds.

So I'm asking myself is there a better way?
For example saving all the destructible positions in an array and looping through the whole array?
Or something else?
Maybe someone has experience with this. Thanks in advance for your help.
 
Last edited:
Level 12
Joined
Jun 1, 2008
Messages
360
I didn't know this function yet, thanks.
This might indeed be alot faster, *trying*

€: This is really good, thx again.
If somebody else wants to use this, note that the function returns the wrong boolean value.
So this
  • (Terrain pathing at Point of type Walkability is off)
actually returns false if the terrain is not walkable!
 
Last edited:
Top