Daily Dev Feb 17 – Multiplayer!

Alright so ‘Daily’ may not be the right word, I’ve been busy!

The past few days have been an adventure of experimenting with what’s possible using the basic multiplayer libraries provided in Unity. Long story short, making an authoritative (read my other posts for more info on what that is) server in basic Unity is… challenging. I spent a good few hours today trying to get that working and to put it gently, I made a bollocks of it. Oh well! It’s all valuable experience.

Eventually I decided that authoritative servers aren’t really needed for my game, at least not at this stage in development, and -any- multiplayer is better than none, so I put together what you see in the video below – the new system essentially lets the clients manage their own player data (movement, stats etc) which is simpler for me as a developer, but is more vulnerable to cheating. Not a big concern right now.

What you don’t see in the video is that there’s a new character controller class in the background which acts similarly to the one Dev Vlog #1 – it handles input and moves the character around, as well as telling the animation handler (largely unchanged from the original version) what to do. The big difference is that it now works with a new class, the Client Data Manager, which takes snapshots of your character data (your position as well as other stats for the animator such as are you walking and which direction you’re facing) and sends all that up to the server, which in turn sends it to all the other connected clients. This way, when you move, you tell the server “I’m moving!” and the server tells your friends that you’re moving, which makes your friends’ copy of your character do his running animation while traipsing around your screen.

S’pretty simple on paper!

1 comment

Leave a Reply to User Friendly Cancel reply

Your email address will not be published. Required fields are marked *