• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making missle system more efficient

Status
Not open for further replies.
Level 13
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 13
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:
Status
Not open for further replies.
Top