Is it possible...

Is it possible...

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
eyu100
Posts: 182
Joined: 05 Jul 2008, 04:10

Is it possible...

Post by eyu100 »

to selectively disable gadgets by modifying the engine source code?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Is it possible...

Post by rattle »

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

Re: Is it possible...

Post by Tobi »

Not easy though, since the engine does not know about gadgets at all. (This is managed by the gadget handler, which is written entirely in Lua and is usually included with the mod/game.)

Also note that if this are gadgets which actually modify the game behaviour (which is what most gadgets do), then having one disabled means you won't be able to play online with that configuration. (You'd desync.)

If you actually want to do it (there are no good reasons to do so IMO), the easiest way would be to modify CFileHandler::Init to always look at the raw VFS first, and put an empty .lua file with same name as gadget you want to disable in the LuaRules/Gadgets/ folder in one of your Spring data folders.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Is it possible...

Post by YokoZar »

Tobi wrote:Also note that if this are gadgets which actually modify the game behaviour (which is what most gadgets do), then having one disabled means you won't be able to play online with that configuration. (You'd desync.)
Don't some gadgets only limit the players ability to send otherwise valid commands? Would disabling these still cause a desync?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Is it possible...

Post by Kloot »

yes (gadgets cannot prevent sending, they can only allow or disallow execution after receiving)
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Is it possible...

Post by Regret »

eyu100 wrote:Is it possible to modify engine behavior by modifying engine source code?
Fixed.
eyu100
Posts: 182
Joined: 05 Jul 2008, 04:10

Re: Is it possible...

Post by eyu100 »

Regret wrote:
eyu100 wrote:Is it possible to modify engine behavior by modifying engine source code?
Fixed.
Oops. Should have said "is it easily possible"
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Is it possible...

Post by lurker »

Can you explain this more? I can't imagine any scenario where you would want to disable parts of a game from the engine.
eyu100
Posts: 182
Joined: 05 Jul 2008, 04:10

Re: Is it possible...

Post by eyu100 »

lurker wrote:Can you explain this more? I can't imagine any scenario where you would want to disable parts of a game from the engine.
If you could it would be problematic because people could cheat by disabling gadgets (like the unit_prevent_load_hax one in BA).
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Is it possible...

Post by thesleepless »

you're talking about Widgets not Gadgets

Widgets are user interface things that the player can disable and add their own
Gadgets are part of the mod
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Is it possible...

Post by lurker »

'load_hax'? I guess I'll just have to test myself if the rapid load orders actually screw the transport movement or just compensate for a longstanding bug, since no one answered my question. But that gadget doesn't stop you from giving orders, as Kloot said, and you could give orders from outside of normal channels anyway. That's why the gadget works when orders are received. Have any other examples?



thesleepless, I read the topic again to see... I think you need to read the topic again.
eyu100
Posts: 182
Joined: 05 Jul 2008, 04:10

Re: Is it possible...

Post by eyu100 »

lurker wrote:'load_hax'? I guess I'll just have to test myself if the rapid load orders actually screw the transport movement or just compensate for a longstanding bug, since no one answered my question. But that gadget doesn't stop you from giving orders, as Kloot said, and you could give orders from outside of normal channels anyway. That's why the gadget works when orders are received. Have any other examples?



thesleepless, I read the topic again to see... I think you need to read the topic again.
You could give load orders, but the gadget would stop them from napping moving coms (?). Without the gadget, you can give orders normally and nap moving coms with a widget. Another example: the surrender gadget in S44 gives certain units to Gaia. A player might be able to gain an advantage if those units were not given.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Is it possible...

Post by yuritch »

If one player's game 'thinks' the units are given to GAIA and another player's game don't, how do we call that? A desync! That's why disableng gadgets on one player side is not feasible, they are the same for all players in a given game.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Is it possible...

Post by YokoZar »

While what Kloot said is true, I'm beginning to worry about gadgets that send commands on behalf of the player.
yuritch wrote:If one player's game 'thinks' the units are given to GAIA and another player's game don't, how do we call that? A desync! That's why disableng gadgets on one player side is not feasible, they are the same for all players in a given game.
The problem is when the gadget is trusting the player to do the right thing in some cases. If the mod author assumes everyone has the gadget (generally a good assumption), then the mod author might assume that the gadget can be trusted to issue the right commands (eg "give away my units"). If the player has the gadget but doesn't activate it due to engine hacking, then he'll never send those commands, and there won't be a desync since the other players won't receive them either.


In other words any gadget that requires sending commands would be vulnerable -- the only solution I can see is to have each player independently generate the commands the gadget would have sent.

Then again that may be the way it is already I don't know.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Is it possible...

Post by Auswaschbar »

Seriously, if people start hacking the engine source to get an ingame advantage the least thing I would care of is if they disable certain gadgets.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Is it possible...

Post by imbaczek »

you could disable a purely unsynced gadget without anybody noticing... i guess. it's about as easy as anything else.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Is it possible...

Post by Licho »

All gadgets that "block" something do it in synced code. You would desync if you disable such thing. Blocked action would only perform on your client but not on others.

Unsynced parts of gadgets mainly perform visualisation or talk to luaui.

This is not a way to hax.
Post Reply

Return to “Engine”