lua sockets in spring - Page 2

lua sockets in spring

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

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

Re: lua sockets in spring

Post by abma »

i hope i understood correctly what you want to accomplish.

why do you want to intercept a command in the engine? if i understood it right you want to do something like this:

user gives a unit in spring a command -> allowcommand "checks" if the real life counterpart unit can do the command, and then returns true/false ? is that correct?
evan
Posts: 11
Joined: 25 Jun 2012, 19:18

Re: lua sockets in spring

Post by evan »

I think I might not have described our goal clearly enough. I know it's pretty bizarre.

We have several real-life units connected via an ad-hoc network. Each of those units is paired with a unit in the game. When the user gives a command to a unit in Spring, it needs to travel outside of the game via that ad-hoc network to reach the target unit. If the target unit can be reached, the command is executed in Spring (and in real life).

The way we considered doing this was to catch a command in AllowCommand, send it out to the network on a UDP packet, and return false. Then, a program running on the nodes sends this command back to the game (if the node receives it) where it would be inserted into the unit's command queue. So the command is never really given at the mouse click. It must travel through the network first. This way, we ensure that the unit that the user is giving a command to is within radio range.

I hope that's more helpful. If not, let me know, and I'll try again.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: lua sockets in spring

Post by abma »

aaah, ok.

then imo SendLuaRulesMsg / SendToUnsynced is the way to go... you've just to encode / decode the commands.
evan
Posts: 11
Joined: 25 Jun 2012, 19:18

Re: lua sockets in spring

Post by evan »

We'll start looking into those methods then. Thanks for your help.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: lua sockets in spring

Post by abma »

you're welcome. any progress/success/problems?
evan
Posts: 11
Joined: 25 Jun 2012, 19:18

Re: lua sockets in spring

Post by evan »

Going well so far. For anyone who has found this thread and is looking for information on widget/gadget communication, see my post on the Q&A
Post Reply

Return to “Engine”