Nearest entity...

Blitz3D Forums/Blitz3D Programming/Nearest entity...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

It's not 10-15, though.

Each turret can target other buildings...

Oh, wait, there's one solution right there. Immobile turrets shouldn't bother checking immobile buildings. If they can't hit each other at the start, they'll never be able to. Thought I'd got rid of stupid oversights like that.

Anyway...

Each turret performs and EntityDistance on every other shootable item in the scene. So if I have 80 buildings and 10 ships in my scene, a turret attached to a ship has to do 90 checks to find the closest. Multiply by three, for three turrets on a single ship, and we have 270. Multiply by four ships and we have over 1080 Entitydistance checks.