Lua Lobby / Socket

Lua Lobby / Socket

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
Azhukar
Posts: 74
Joined: 16 Apr 2012, 10:48

Lua Lobby / Socket

Post 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?
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Lua Lobby / Socket

Post by koshi »

http://springrts.com/phpbb/search.php?k ... mit=Search

Would've been the first hit before your post.
Azhukar
Posts: 74
Joined: 16 Apr 2012, 10:48

Re: Lua Lobby / Socket

Post 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/
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Lua Lobby / Socket

Post 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 :roll:
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...
Azhukar
Posts: 74
Joined: 16 Apr 2012, 10:48

Re: Lua Lobby / Socket

Post 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 :roll:
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?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Lua Lobby / Socket

Post 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.
Azhukar
Posts: 74
Joined: 16 Apr 2012, 10:48

Re: Lua Lobby / Socket

Post 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.
Pako
Posts: 174
Joined: 12 Jul 2009, 18:57

Re: Lua Lobby / Socket

Post 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.
Attachments
luaLobbyProto.lua
(4.27 KiB) Downloaded 155 times
Post Reply

Return to “Lua Scripts”