How I Added Multiplayer to My Game (Sort Of)

in gamedev •  2 months ago 

How I Added Multiplayer to My Game (Sort Of)

Remember that game I was making where cubes occasionally turned into spheres? Well, I've leveled up - now TWO people can watch cubes turn into spheres simultaneously! That's right, I've added multiplayer, and only broke the space-time continuum twice in the process.

The good news: I successfully got two players to connect! The bad news: Player 2 keeps spawning inside Player 1.

Spent five hours debugging why players couldn't see each other, only to realize I forgot to actually send their positions over the network. They were all there, just... having their own private parallel universe party. Kind of like my code's version of social distancing.

The real breakthrough came when I finally figured out network serialization. Though I'm pretty sure I accidentally invented quantum entanglement in the process. Sometimes Player 2's actions happen before Player 1 does them. I'm either really bad at networking or really close to inventing time travel.

My favorite bug so far: when a player disconnects, instead of removing their character, they start floating towards the sky. I'm keeping that one. It's not a rage quit; it's an ascension to a higher plane of existence.

untitled.gif

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!