Page 1 of 1
Lua Lobby / Socket
Posted: 21 Apr 2012, 07:28
by Azhukar
I would like to start playing around with implementing basic lobby functionality through Lua.
To my understanding, LuaLobby is going to be (or already is) deprecated and I should use LuaSocket instead.
Where can I find documentation about current (uberserver?) server-client protocol?
Re: Lua Lobby / Socket
Posted: 21 Apr 2012, 07:48
by koshi
Re: Lua Lobby / Socket
Posted: 21 Apr 2012, 09:01
by Azhukar
Thanks, can you please edit the link so it doesn't break forum layout?
How can I run a minimalistic spring instance, with the intent of only running my Lua code?
(not asking for an external Lua interpreter)
I would like to have the lobby run entirely from spring.
For future reference, this is the lobby protocol:
http://springrts.com/dl/LobbyProtocol/
Re: Lua Lobby / Socket
Posted: 23 Apr 2012, 15:52
by knorke
not sure if that is helpful:
http://pastebin.com/3xPn03Xd
you can type
/luaui join and it will join a hardcoded lobby channel.
if you just type
/luaui blablabla it will say "blablabla" in that channel.
it is a bit choatic because I was just testing around..still afaik only example of something a bit like lua lobby?
Somewhere I have a bit better version where you can also join battles and recieve the script.txt
Or maybe it got lost when clearing out all the springtest installs
How can I run a minimalistic spring instance, with the intent of only running my Lua code?
I think a mod and map always have to be loaded. (unless headless spring but then you have no graphics at all: can not draw chat, buttons etc)
So maybe just use a very small map and mod for now...
Re: Lua Lobby / Socket
Posted: 24 Apr 2012, 09:17
by Azhukar
knorke wrote:not sure if that is helpful:
http://pastebin.com/3xPn03Xd
you can type
/luaui join and it will join a hardcoded lobby channel.
if you just type
/luaui blablabla it will say "blablabla" in that channel.
it is a bit choatic because I was just testing around..still afaik only example of something a bit like lua lobby?
Somewhere I have a bit better version where you can also join battles and recieve the script.txt
Or maybe it got lost when clearing out all the springtest installs

Thanks, that is useful.
knorke wrote:I think a mod and map always have to be loaded. (unless headless spring but then you have no graphics at all: can not draw chat, buttons etc)
So maybe just use a very small map and mod for now...
I guess I will use a dummy mod/map then.
Is there a way to keep the socket and/or run lua code (to send ping/pong) after I call Spring.Restart?
Re: Lua Lobby / Socket
Posted: 24 Apr 2012, 11:22
by knorke
Is there a way to keep the socket and/or run lua code (to send ping/pong) after I call Spring.Restart?
atm no..basically you lose everything at Spring.Restart
That was also my question in this thread:
http://springrts.com/phpbb/viewtopic.php?f=23&t=27683
Since lua socket is not 100% done yet (?) maybe that will eventually change?
For now the only way to keep data between restarting is writing/reading files or via script.txt and reinitiliaze everything.
Re: Lua Lobby / Socket
Posted: 24 Apr 2012, 12:25
by Azhukar
knorke wrote:Is there a way to keep the socket and/or run lua code (to send ping/pong) after I call Spring.Restart?
atm no..basically you lose everything at Spring.Restart
That was also my question in this thread:
http://springrts.com/phpbb/viewtopic.php?f=23&t=27683
Since lua socket is not 100% done yet (?) maybe that will eventually change?
For now the only way to keep data between restarting is writing/reading files or via script.txt and reinitiliaze everything.
There's also the choice of making a separate application through which connection itself / socket is handled that communicates with spring's Lua via localhost.
I guess I'll make it a standalone Lua lobby, i.e. not relying on spring at all, using only some Lua interpreter and libraries.
Re: Lua Lobby / Socket
Posted: 25 Apr 2012, 13:34
by Pako
My Lua lobby reinitilizes and connects nearly instantly so there is no much need for saving anything but the battle you were. Though it is heavily helped with C++ partially handling the commands. I handle some commands with Lua too.