Making multiplayer games is pretty straightforward in dot big bang but can be confusing if you’ve never tried before. This article should give you an overview that unlocks some understanding and lets you get started without needing all the gory details.
You may have heard of client-server games or peer-to-peer games before, dot big bang is a bit of a hybrid of the two.
When you join a dot big bang game in progress you are actually connecting to each of the people playing through our servers. One of those players has been nominated as the ‘server’ and all that means is that they are in charge of all the entities that had to be loaded and created when the game started. All the players can also be in charge of entities that they have created. Being in charge of an entity means that the player Owns it. Ownership is an important concept to get familiar with. For example the first person to join a game is usually the ‘server’ but if they leave we transfer ownership of the entities they owned to another player in the game (currently only for the entities saved in the game). Everyone else in the game knows who owns which Entity.
All the players in the game can send messages to each other. These are sent to a specific Entity, have a name and contain some information. By default any message sent is sent to everyone else in the game. The receiving players can then filter the messages depending on things like who sent it or who owns the receiving Entity.
All our multiplayer games are made up of Entities sending messages to the other players and using Ownership to decide who does what.
Not all entities have to be a part of a multiplayer game though. For example you probably don’t want the ground to be shared between players when it’s just sitting around doing nothing. Creators need to opt-in to being part of the multiplayer world by adding the net or networked tags to an Entity.
The net and networked tags both specify that the Entity will be a part of multiplayer. These Entities will have an owner, they will have the same id on every peer and they can send and receive messages. The net tag additionally specifies that the Entity will automatically network its currently playing animation, position, rotation, scale and parenting changes.
All multiplayer games synchronise a timer with the server, we call this Server Time. This is the number of seconds since the game started. This can be useful for synchronizing all sorts of things. Like displays of round time remaining and Entities that move along a fixed path you can calculate just from the current time.
If you’re ready to go deeper you can learn more about multiplayer in our Advanced Multiplayer Guide (coming soon!).