Page 1 of 1

UnsyncedCtrl Lua Interface to have sight without units

Posted: 10 Apr 2014, 20:19
by zwzsg
Hello!

I feel a need for this feature:

A new gadget callout, Spring.GiveSightInRect(number x1, number z1, number x2, number z2, number teamID, number level, number duration )

- Where x1,z1 to x2,z2 define the reactangular area where sight will be given.
If it's easier to implement a Spring.GiveSightInCyl(x, z, r, ...), no problem (as long as I can give map-wide sight without crashing or choking Spring)
Or maybe even both rectangle and cylinder, idk.

- Where teamID is which team to update the sight of. Would be sweet to have some ways to say "all team", but then special cases can be such a burden, maybe it's for the better to have to use a for loop on all teams in gadgets that give sight to all teams.

- Where level is the kind of sight to provide. Something like:
1 : Heightmap and features only
2 : plus radar and sonar
3 : plus ghost units
4 : live units and live projectile
Or whichever distinction between levels of sight makes sense, I'm not really sure how many the engine handle.

- Where duration is how long to keep providing sight after the callout. If implementable. Otherwise I guess we can have gadget repeating the command every tick. It would be probably more intuitive to have duration in seconds, but I guess ticks would be okay too. The default value should be 0, or maybe 0 should still be one tick in case the engine needs a tick to take the sight into account. Then I recall sight is updated on slower ticks than the rest? Anyway, use which default value and time units that are sensible. Or axe it if too bloatfull to add engine side.

Most immediatly, I would use it to let all player see new heightmap and new geovents layout in my map altering gadgets.
Then I would add a game option of no fog of war, full sight always everhwere.
But the power to add localised reveal special abilities would be welcomed by many modders.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 10 Apr 2014, 22:37
by Beherith
I know this isnt a new idea, but have you thought of spawning an invisible unit high up?

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 10 Apr 2014, 23:12
by zwzsg
Not only thought, but even tried it. Have you?

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 08:23
by yuritch
We had to use invisible/unselectable units to emulate something much like this for binoculars function in S:44. It even works. Link to gadget (spotting unit is spawned on weapon hit, since the binoculars are a weapon).

Of course our binoculars only reveal a small area, nothing like the full map, so maybe that way won't do for heavy map terraforming.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 11:10
by PicassoCT
Yeah, its pretty costly for heavy map terraforming.
I use invisible units in the minimissions to highlight objectives.

But would be cool if the engine had such a unit build in to update the los-terrain, once in a while

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 11:35
by Anarchid
For things like hexfarm, possibly temporarily disabling UHM would be even more useful.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 13:23
by knorke
I think similiar came up before and it was always "not possible"...

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 14:37
by zwzsg
Anarchid wrote:For things like hexfarm, possibly temporarily disabling UHM would be even more useful.
What is UHM? Unsynced Height Map? An interface for gadget to enable and disable it would indeed help me, but I'm afraid then we could have gadgets infighting and not knowing which state to leave it after they're done.

Giving sight seemed to me a more generic, more useful, solution, with less risk of misuses from gadget writers.


knorke wrote:I think similiar came up before and it was always "not possible"...
Then I have a new Feature Request [Internal Engine Refactoring]: Abstract the LoS system so it's not tied to units.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 14:52
by knorke
UHM = Unsynced Height Map
Disabling that is what you really want yes? For randomly generated maps? Maybe direct feature request for that has better chance, not sure.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 15:00
by Beherith
Out of curiosity (and so that I dont fall into the same pit), what was the issue with the invisible unit type solution? What parts of it are considered as 'blocking' bugs?

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 15:18
by zwzsg
- The maximum sight of a unit is limited. To cover even a smallish 8x6 map, I needed to spawn about 8 units in a grid like fashion.
- So to cover a large map for all teams, I would need to spawn a large number of units: They would eat the unit count.
- I would be difficult, and bit dirty, to create special sight-only units that are compatible with any and every mod.
- I could not find a way to hide the radar dot on the minimap for the owner.
- Making sure other gadgets ignore the sight unit when they do Spring.Get*Units* could only be done partially.
- I don't even know how to make sure the GUI of the player that own them ignore the sight units, so that, for example, a right click doesn't do a "guard sight unit" but a "move" as if nothing was present.

I mean, yes, there is stealth, there is Spring.SetUnitNoSelect, there is AllowCommand, etc... but even when using all tricks I know, the sight unit is never completely transparent to the owner GUI, to other gadget and engine code.

Re: UnsyncedCtrl Lua Interface to have sight without units

Posted: 11 Apr 2014, 17:41
by FLOZi
Spring.SetUnitNoMinimap