Page 1 of 1

Game control gadget (proof of concept)

Posted: 12 Jul 2010, 20:35
by eyu100
I wrote a gadget that lets authenticated users (so far only me, I haven't made a password option yet) kill all units on the map, kill all units belonging to a specific team, kill themselves if they are a player and kill all of a particular type of unit and prevent more from being created for the rest of the game (this is currently the most useful control).

Anyone, not just the host (even spectators!) can use the gadget if they know the password or can come up with a password that hashes to the same value. (I got a pure Lua version of CRC32 from the Internet, so the hash function isn't very secure :|. Their version didn't work, so I modified it, but now the hash function isn't even a correct version of CRC32. It does, however, give different hashes for different passwords). As an example of what you can do with the gadget (if it is integrated into a map), suppose that the players are lagging because there are too many fighters on the screen. You could fix this using the following sequence of commands:

Code: Select all

/luarules ctrl_authenticate [password]
/luarules ctrl_genocide armap
/luarules ctrl_genocide armaap
/luarules ctrl_genocide corap
/luarules ctrl_genocide coraap
/luarules ctrl_genocide armfig
/luarules ctrl_genocide armhawk
/luarules ctrl_genocide corveng
/luarules ctrl_genocide corvamp
Lines 2 through 5 are not strictly necessary, but you don't want teams to build other air units when fighters are disabled.

I plan to add:
  • A way to authenticate other users without giving them the password
  • Forced unit transfer
  • And more
EDIT: fixed gadget (before, I left ctrl_authenticate as _authenticate)

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 04:14
by Forboding Angel
./facepalm

Lobby -> Disabled units tab

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 05:19
by eyu100
Updated the gadget.
  • New features:
  • Authentication by name (certain users won't need a password)
  • Forced give all to let you deal with afk players without kicking them

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 05:26
by eyu100
Forboding Angel wrote:./facepalm

Lobby -> Disabled units tab
This gadget can be extended to let authorized users do almost anything. Combined with a widget, an extended gadget could let spectators:
  • Teleport units (I don't know if the current version of Spring has MoveCtrl)
  • Give certain players resource bonuses
  • Gift resources to players
  • Kill individual units
  • Paralyze individual units
  • Declare one allyteam the winner by using the gadget to kill all their enemies
  • Make certain units invincible (air transports, for example)
Etc., etc., etc.

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 06:17
by eyu100
Command list:

Code: Select all

/luarules ctrl_password
The password hash is computed using an incorrect implementation of CRC32.

Code: Select all

/luarules ctrl_killall

Code: Select all

/luarules ctrl_kill [team]

Code: Select all

/luarules ctrl_suicide
Internally, this is interpreted as /luarules ctrl_kill [teamOfThePlayerSendingTheCommand]

Code: Select all

/luarules ctrl_genocide [unit]

Code: Select all

/luarules ctrl_give [team1] [team2]
Completely wipes out team1, giving all their units to team2.

Other important things:
The privilegedPlayers table gives the list of players that do not need the password to run commands. The unsynced part of the gadget calls the synced part every 10 seconds (per player, so if you have 10 players the synced part is called on average once every second). This is to make cheating more difficult.

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 08:07
by aegis
you can find crc32 collisions in a reasonable amount of time by *hand*

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 18:57
by zwzsg
Forboding Angel wrote:./facepalm

Lobby -> Disabled units tab
Lobby cannot kill units already built in a running game.

/facepalm

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 21:30
by eyu100
Ok, I updated the gadget again. This time, the password hash is computed with an incorrect version of SHA1, so it should be more secure (it is now probably infeasible to find collisions by hand). The hash is computed using pure Lua (credit goes to http://luaforge.net/projects/sha1-rsa/); I put the files in a separate folder which should go in LuaRules/Gadgets. Also, I made the synced part send a secret number to the unsynced part:

Code: Select all

local allUnits = Spring.GetAllUnits()
for i,unitID in ipairs(allUnits) do
   synced_secretNumber = synced_secretNumber + math.sin(i)*unitID
end
SendToUnsynced("ctrl_secretNumber", synced_secretNumber)
Does someone know if SendToUnsynced messages are private? Or can they be read by widgets?

Re: Game control gadget (proof of concept)

Posted: 13 Jul 2010, 23:14
by CarRepairer
Hey, I say this with all sincerity. If you had a really interesting reason for doing this I'd be totally motivated to help you. I don't mean to sound mean, I just want to know what you could use this for. Maybe if you told me your reasons (I don't believe it's just "lulz") I could help you come up with simpler ways to do it.

Do you intend for a modder to be able to join any battle of his game and have a prefix code like in Wrath of Khan so he can flaunt his mighty powers? Come on, gimme something interesting! You have like three threads in the lua forum and have piqued my curiosity. I must know.

Re: Game control gadget (proof of concept)

Posted: 14 Jul 2010, 03:33
by eyu100
Another update. Now you can use the ctrl_super command to make a team invincible and the ctrl_fragile command to make a team's units fragile (if they are damaged at all, they immediately die, leaving no wreck).

EDIT: forgot attachment

Re: Game control gadget (proof of concept)

Posted: 26 Jul 2010, 21:38
by Pako
This seems a very promising gadget and I would have several uses for it but I'm not a game developer.

Re: Game control gadget (proof of concept)

Posted: 27 Jul 2010, 08:38
by eyu100
Major update. I put the gadget (now actually two gadgets spread over 7 files) in DSD and called it "DeltaSiegeDry Hacked". Version 0.1.0 is on jobjol.