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: 818
Joined: 20 Feb 2010, 12:17

lua sockets and dynamic content

Post by raaar » 29 Oct 2019, 17:44

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?
0 x

sprunk
Posts: 84
Joined: 29 Jun 2015, 07:36

Re: lua sockets and dynamic content

Post by sprunk » 29 Oct 2019, 18:11

raaar wrote:
29 Oct 2019, 17:44
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.
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).
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: lua sockets and dynamic content

Post by AF » 29 Oct 2019, 21:47

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 :(
0 x

User avatar
Anarchid
Posts: 1380
Joined: 30 Nov 2008, 04:31

Re: lua sockets and dynamic content

Post by Anarchid » 30 Oct 2019, 10:09

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.
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10239
Joined: 24 Jan 2006, 21:12

Re: lua sockets and dynamic content

Post by PicassoCT » 30 Oct 2019, 12:15

Spring besieged? I can already see peniszilla..
0 x

abma
Spring Developer
Posts: 3560
Joined: 01 Jun 2009, 00:08

Re: lua sockets and dynamic content

Post by abma » 06 Nov 2019, 17:22

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".
0 x

Post Reply

Return to “Game Development”

cron