lua sockets and dynamic content

lua sockets and dynamic content

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

lua sockets and dynamic content

Post by raaar »

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?
sprunk
Posts: 100
Joined: 29 Jun 2015, 07:36

Re: lua sockets and dynamic content

Post by sprunk »

raaar wrote: 29 Oct 2019, 17:441 - 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.
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).
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: lua sockets and dynamic content

Post by AF »

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 :(
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: lua sockets and dynamic content

Post by Anarchid »

If a Lua AI ran unsynced however, it could run faster, store data on the filesystem, make network requests, and generally be far better.
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 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.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: lua sockets and dynamic content

Post by PicassoCT »

Spring besieged? I can already see peniszilla..
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: lua sockets and dynamic content

Post by abma »

raaar wrote: 29 Oct 2019, 17:44 Are these possible? Any ideas on how to implement them? How would that work on replays?
IMHO yes: https://springrts.com/wiki/Lua_Unsynced ... LuaMessage

the messages are stored in replays, so replays would work "offline".
Post Reply

Return to “Game Development”