LAN Multiplayer Party


Hey everyone! In this update, I wanted to add a multiplayer feature that allows friends to play but not on the same device, so I created a LAN (Local Area Network) connection. Here’s how things went.


 

How it works

To get started, I needed to set up a local client-server model. The plan was to have one device act as the “host” (server) and others as clients joining the game, the server also has a client on the same device so that he/she can play, so I had to:

•      Set up a server to broadcast a local IP.

•      Allow client devices to detect and connect to this IP.

•      Sync game data (like ball positions and actions) to ensure all players see the same thing.

 


 

Challenge: Syncing Real-Time Data

This has been a tricky part but not so much! But I had to synchronise ALL STATS from the players so that every connected player sees the same thing on their screen, and so I had to setup, and by all stats I mean: “Position, Vector, Curving shots, Abilities, HP, Strokes, and many more small details”, the server has no authority on the clients’ balls, so each ball is only sent from the client to the server.



Notice how after the white ball collides, it got hit but due to lag, the red ball didn’t receive the hit, maybe I can signal to the other ball that it got hit from the white ball’s perspective but it would be difficult because what if there was no lag and the 2 balls collided from both perspectives but then the signal came and now both balls get hit twice? I’ll leave it as it is right now and come back to it later.

Challenge: Boss Fight

The first boss has many attacks, and I need to keep the boss behaving the same for all clients and I have to take latency into consideration, what do I do?

1.     Make the boss move and attack just like normal, BUT once the attack is done, wait for the server until it signals new attacks.

2.     Reposition the boss from the server to the clients.

 

 

What’s Next?

The next big goal is to expand this functionality to Steam’s multiplayer platform! This will allow players to connect and play with friends and randoms from anywhere, making Binary Golf even more accessible.

I’ll be using the same server-client model just like the LAN, but maybe I can find something better hopefully, I won’t change much of the functionalities of the game.

My ONLY problem comes from the fact that (ANYONE can cheat), that means the server and the client can cheat, I don’t mind much if it’s in a LAN server, but with random people, this would be griefing other players, making players not wanting to go online multiplayer, for co-op mode, it’s going to suck but not that big of a deal, for PVP? No-one would like that you can teleport to all targets and then teleport to the hole in like 10 frames as soon as the match starts.

I’ll have to look into anti-cheating measures but that’s a topic for another devlog.

 Or I could just move on to the next episode.

 Anyway, thanks for following along! And stay tuned for more on the Steam multiplayer journey!

Files

binary golf.zip 103 MB
44 days ago

Get Binary Golf

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.