Hey Kritz, how did you do the networking in CBD?

Talk about the website, and this forum.

Hey Kritz, how did you do the networking in CBD?

Postby BDX777 » 25 Jul 2014, 4:04 pm

Hi I'm a wannabe indie game dev using Unity and I was thinking about making a multiplayer game of my own. Do you use Photon for this or is it in-unity netcode? I've been reading up on unity network functions and stuff like that, like network.instantiate() and some other stuff...
Posts: 21
Joined: 04 Jul 2014, 7:21 am

Re: Hey Kritz, how did you do the networking in CBD?

Postby Kritz » 25 Jul 2014, 5:44 pm

All unity networking stuff. It's pretty easy to get simple stuff going, the hard part comes when you need to work out if a function should be run by the client, the server or both, and when you should be manually syncing server info to the clients.

Example being, player 1 is a host and player 2 is a client, if player 2 decides to spawn a cube, you could either have player 2 spawn the cube and send updates to player 1, or have player 2 send the request to spawn the cube to player 1, and player 1 spawns the cube and looks after it. Then depending on how you did that, player 3 might join who's also a client, someone needs to send player 3 the fact a cube was spawned, and if the cube has moved you need to send in addition an updated location. Player 3 then might delete the cube, so you need to tell all the existing players that the cube's been deleted, and delete the cube spawn from the network buffer.

Now, this isn't too complicated, but it takes a while to understand all the gotchas of game networking, and even then you're bound to mess up once every so often. Once you get 30-40 classes all interweaving together, trying to handle servers and connected clients and new client connections, and syncing a hundred different game objects all with different properties and methods... then it gets kinda hard.

It took me less than a weekend to make my first very simple multiplayer 'game' in Unity, with just some balls flying around a map bumping into each other.
User avatar
Site Admin
Posts: 170
Joined: 03 Jul 2014, 3:21 pm
Location: Hobart, Tasmania

Return to Kritz.net

Who is online

Users browsing this forum: No registered users and 1 guest