https://springrts.com/wiki/Lua_Socket
I'm wondering if lua sockets could be used to have dynamic content in games through gadgets, namely:
1 - allowing players to build custom units through an external website, then, when the game starts, luasocket communication being used to get info about each player's custom unit set and generating the corresponding unit defs and updating the build menus.
2 - allowing lua AIs to tweak their behavior, to learn, by uploading info to an external server when the game ends and getting info from it when the game starts.
Are these possible? Any ideas on how to implement them? How would that work on replays?
lua sockets and dynamic content
Moderator: Moderators
Re: lua sockets and dynamic content
Sockets are unsynced so at best you could download presets describing what a widget should say to a gadget.
This might as well be done offline (Chobby has some unit-building UI, saves to file, ingame widget reads that file). If you still want the persistence offered by the external website there's also the option to have the host server read the data and embed it in startscript (that's how it's done in ZK).
Re: lua sockets and dynamic content
Lua AIs could always do this kind of thing, but most Lua AIs run in synced land, which stops this from happening.
If a Lua AI ran unsynced however, it could run faster, store data on the filesystem, make network requests, and generally be far better.
For example, I wrote an async building placement algorithm for DAI with timing controls so it always had predictable load, but because it had to run synced, I had to fix all the timing values rather than letting it adapt to the current workload budgets
If a Lua AI ran unsynced however, it could run faster, store data on the filesystem, make network requests, and generally be far better.
For example, I wrote an async building placement algorithm for DAI with timing controls so it always had predictable load, but because it had to run synced, I had to fix all the timing values rather than letting it adapt to the current workload budgets
Re: lua sockets and dynamic content
It can't do that atm though as LuaUI is limited to information accessible to the current player. It would need LuaAI as a separate unsynced LuaState.If a Lua AI ran unsynced however, it could run faster, store data on the filesystem, make network requests, and generally be far better.
If you really want to improve your AI performance though or do more complex things it probably just makes sense to use the SkirmishAI interface though.
Re: lua sockets and dynamic content
Spring besieged? I can already see peniszilla..
Re: lua sockets and dynamic content
IMHO yes: https://springrts.com/wiki/Lua_Unsynced ... LuaMessage
the messages are stored in replays, so replays would work "offline".