Find actors inside certain radius

Moderator: GZDoom Developers

Post Reply
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Find actors inside certain radius

Post by Apeirogon »

Itll be nice to have function that return pointers, or array of pointers, to all actors inside certain radius, defined by modder, but doing this WITHOUT using thinker/block thing/actor iterator, so it can be called many times per one tick without freezing game to 0.000...001 frames per second.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Find actors inside certain radius

Post by _mental_ »

If BlockThingsIterator with explicitly set checkradius argument is too slow, you should provide a real use case for benchmarking.
No matter how fast actor iteration is, someone can always slow the game down to a crawl with mindless use of it.
It's not a big deal to create a mod that do 1000 traversals on 10000 actors per tic and to start crying out loud that the engine is not optimized.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Find actors inside certain radius

Post by Apeirogon »

You mean "what did you do, so that block thing iterator make gzdoom freeze"? I think its a case "do 1000 traversals on 10000 actors per tic".
I try to make monsters, which sane react to flying projectile near him aka supressive fire. If there are too much projectile, monster set self variable "supressed" to true and decrease self speed, accuracy, chance of jump to fire state, etc.

I cant provide code which slow gzdoom, because I delete it and stick to questionable, but working without lag, way of warping with/to projectile "big enough" actor, which check is there anyone/anything within some radius using override can collide with virtual.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Find actors inside certain radius

Post by _mental_ »

Well, if you are suggesting something, it's your responsibility to provide a runnable sample that showcases the problem you want to be solved.
And developers cannot read modder's mind in order to recreate such sample.
I conclude that existing iterators are fast enough. There is no point to investigate some theoretical use cases.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”