LOS Gadget, v. 0.1 - Page 2

LOS Gadget, v. 0.1

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: LOS Gadget, v. 0.1

Post by Tobi »

Argh wrote: When we get done making a LOS map... we need to iterate through the Units in those sectors, and, if Visible, set their LOS state and mask. That is a "search", to me.
In Spring, the unit updates itself in SlowUpdate. So there isn't really a search for units. The los bits in a unit are just an optimization to not have to read the los map at unit->pos everytime a unit / weapon / command AI needs to know whether that unit is visible.
Lastly... Tobi said there's 100% overlap. Did that take into account re-attempts to set the LOS state / mask that update? If not... well, depending on the mip level, you're probably talking about up to 900% overlap for that part. Sure, each pass is fast, you're just checking a bit state and mask. But... get 1000 Units on a map, it gets cumbersome, fast. World Builder is a situation where you're going to see that... a lot.
The 100% overlap is in the rays casted for one single unit.

Indeed if you put 10 units next to each other you probably get close to 900% overlap. The bit state and mask things really haven't any negative performance impact at all. The expensive thing is 'just' maintaining the los maps for every team. Reading the los map at unit->pos and storing the result in the los bits is just an optimization (see above).
Post Reply

Return to “Lua Scripts”