autohosts running lua widgets

autohosts running lua widgets

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

autohosts running lua widgets

Post by knorke »

would that be possible?
In lobby I was told its not possible because the autohosts do not run the actual simulation but just manages the traffic etc.
Is that correct?
Would it be possible to have dedicated server (like for example Halflife does it) that runs the whole game but does not display any gfx.
Or would that use too much cpu/too complicated to fumble in?

Idea is I would like to try adding this amazing piece of awesome :roll: to an autohost so that after a game is over it says "game has ended. click here to see some stats" and then players can click it for drama.

If it is not possible its not too but, I think I have an workaround then, but it might be usefull for other reasons as well (ai makers for example or anybody else who wants to run the game at high speed without gfx)

edit
hm after some thinking i think i found a better solution so its not urgent ;)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: autohosts running lua widgets

Post by hoijui »

what you are talking about, is a headless client. we have this, but it is not officially supported, and is not in production use anywhere, as much as i know.
It is not really an option to use that instead of dedicated server on autohosts though, as it is will use like 100-1000 times the CPU load and memory of spring-dedicated, plus has greater risk to crash.

the solution (which is probably what you found out yourself), would be to connect with a spring or spring-headless client as spectator.
BrainDamage wrote a special version of spring that does something similar, the ladder bot which has to be spec in ladder games uses it. it does not run the simulation, but maybe it would be easy to modify it to collect only the data you would need. this only makes sense if you need to reduce memory and CPU load drastically, though. if you want to spec only one or two games at a time, there should not be a problem to run the full simulation.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: autohosts running lua widgets

Post by jK »

First, spring headless doesn't use ANY less CPU than a minimized spring. If at all it would save some RAM (not much btw).

And now what does your feature request has to do with running >widgets< on the autohost? Displaying any windows/text at the end of the battles happens on the CLIENT PCs and not on the autohost (spring isn't a shared VNC-session).
Your requested feature is already doable and only needs additions to the autohost itself (to receive the unit informations to create the image and to send the some text with the urls to the clients) and receiving widgets on the client-side (to display the text+url). Springie already has code for such stuff (-> CA PlanetWars), but perhaps it could be more unified.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: autohosts running lua widgets

Post by knorke »

thanks for explaning that. to be honest i i dont really know much how all these things work :shock: , iam only just learning.

yea, widgets on autohosts isnt needed, didnt think that out throughly.
the solution (which is probably what you found out yourself), would be to connect with a spring or spring-headless client as spectator.
yes, that was the idea. but the headless stuff sounds too scary now. So, would this be a way to make it work:
-a lobbybot is in battleroom
-i join battleroom as normal (but as spec) and run the lua stuff that creates the logfile
-the lobbybot notices when the game has finished, creates the image, uploads and gives link in chat

red=is this possible/i need help (a start point even)
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: autohosts running lua widgets

Post by SirMaverick »

-a lobbybot is in battleroom
-i join battleroom as normal (but as spec) and run the lua stuff that creates the logfile
-the lobbybot notices when the game has finished, creates the image, uploads and gives link in chat
You don't need a lobby bot when you are spectating. Just call your programs yourself (e.g. don't call spring directly, use a script that will call spring and the other stuff afterwards).
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: autohosts running lua widgets

Post by hoijui »

yeah, that. the only tricky thing then, is to auto post the link to the files in the lobby. would require logging in with a second account through an IRC relay.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: autohosts running lua widgets

Post by knorke »

Just call your programs yourself (e.g. don't call spring directly, use a script that will call spring and the other stuff afterwards).
oh interessting. so i could just replace spring.exe with mylauncher.exe that calls spring.exe -script.txt and then my other program?
would require logging in with a second account through an IRC relay.
yes seems like no way around that. but since the lobby protocol doesnt seem so obscure & its text based i might manage that..
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: autohosts running lua widgets

Post by hoijui »

look eg at this:
http://springrts.com/wiki/FAQ:technical ... _server.3F
with this, you could use an existing IRC library, instead of using the lobby protocol.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: autohosts running lua widgets

Post by knorke »

i made some socket stuff
[17:44] snackuser wheres the party?
[17:44] knorkebot party in uranus!
[17:44] snackuser omgomgomgomg
[17:45] snackuser i said
[17:45] snackuser WHERES THE PARTY?
[17:45] knorkebot PARTY IN URANUS!
[17:45] snackuser wheres the party?
[17:45] knorkebot party in uranus!
[17:45] snackuser everybody now
[17:45] snackuser WHERES THE PARTY?
[17:45] knorkebot PARTY IN URANUS!
[17:45] snackuser right on
thanks for the help :)
Post Reply

Return to “Feature Requests”