Make certain GL state variables available to Sync

Make certain GL state variables available to Sync

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Make certain GL state variables available to Sync

Post by Argh »

Simply put, stuff like gl.GetSun (which calls Spring variables that have already been set via the map) should be available to synced, as read-only variables. I.E., store them somewhere where synced Lua can fetch them safely.

Why? Because otherwise operations that require these values fail, which can bring down the entire Lua state.

I've been getting around this problem by sending a message via LuaUI, but I've had to write some pretty big chunks of safety code to handle situations like reloading the LuaRules states because this information isn't available any other way.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Make certain GL state variables available to Sync

Post by Tobi »

It's prone to desync, in particular if something like this is implemented.

Why not send the value to synced part of gadget from the unsynced part of the same gadget?

Also why big chunks safety code if all the safety code you need is properly initialising your (global) variable that holds whatever gl.GetSun returns to some neutral value?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Make certain GL state variables available to Sync

Post by Argh »

Why not send the value to synced part of gadget from the unsynced part of the same gadget?
I am; actually, I use a Widget to send it to every Gadget that needs that data, simultaneously. However, if LuaRules gets reset, the data's not being sent again, and apparently isn't in memory, either. I wrote a kludge fix for it, but it's a chicken-and-egg problem- I need that data during Initialize(), not later.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Make certain GL state variables available to Sync

Post by Tobi »

Tobi wrote:Why not send the value to synced part of gadget from the unsynced part of the same gadget?
So not from LuaUI :-)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Make certain GL state variables available to Sync

Post by Argh »

Won't that run after the synced part initializes? If not, great, that provides a workaround :-)
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Make certain GL state variables available to Sync

Post by Tobi »

Yes, unsynced part of gadgets is initialized after synced part.

That is exactly what you want cause then you can be sure synced part is there already to receive the message unsynced part sent when it got initialised. Before that time use the safe/neutral default value in the synced part.
Post Reply

Return to “Feature Requests”