Local multiplayer example

Hi :defold:,
some time ago I wanted to understand how I could possibly program a local multiplayer for a game. I wanted to learn everything from binoculars, so I decided to use only the Lua socket library. To represent the functions, I decided to program a simple chat between two computers. I used the UDP protocol and programmed the broadcasting, so the peers will automatically establish a connection.
I think it can help a lot for anyone who would like to learn how everything works.

p2p.zip (6.9 MB)

p2p - Windows example.zip (9.4 MB)

And here video for visualization:

16 Likes

Hi @anon64925349 thanks for sharing, interesting to check :slight_smile:

just a little note: these days, if you want to share something in the public, it’s better to upload it to the github (for example) instead of attaching archives as zip.

7 Likes

is it possible to do this with player positions? (when new user joins local connection, new player sprite is put in the position that they are in on their screen and vice versa)