Multiplayer Coding

Just wanted to have a bit of discussion to get some insight on multiplayer coding.

How are things like HUD and per-player-LOD etc handled?

would overlay scenes automatically cater to multiplayer functions or would almost everything have to be specifically made for the multiplayer scene? if so does anyone have anywhere to start on multiplayer coding :smiley:

Like Mountain LOD would be high for players who are near, but not for others. HUD would show to you and not others, etc.

Typically, the game renders the local player’s perspective, and treats other players more simply. All player-specific features like HUD, first-person-perspective are only rendered for the local client. Other clients can be thought of as AI characters which happen to be controlled by other players.

Less abstractly, in many games (FPS), the other players are represented locally using approximate characters which mimic the animations and commands issued by their controlling players.

Your question is a little generic to provide much more input at this point. I have a code library https://github.com/agoose77/PyAuthServer which also has a WIP BGE UI https://github.com/agoose77/bge_network_addon for multiplayer games, might be worth looking at.

Thanks for the reply ! Yeah definitely a broad question but I’d like to understand more of the theory behind how networking works and what’s actually going on before diving into it. Installed your add on and have taken a look at the settings but haven’t done much past that. Is there a tutorial somewhere showing where to start with that addon? As far as I can tell it needs to be set up through logic/messages but I haven’t gotten that far yet

This depends what kind of multi-player game you have in mind.

If you are talking about multi-game instance architecture (each player runs an own instance of the game), there is nothing you need to worry about. Everything gets rendered from the perspective of the local player.

But the game model needs to be synchronized between the instances. E.g. if a tree falls in the game, the players looking at the tree see it falling. When the other players go there they should see that the tree is down, even without seeing the fall -> the game model changed for all instances.

Shared screen multiplayer games have no problem either as there is just one camera.

A split screen game is different. You need to ensure that each viewport gets it’s own render processing even for LOD and object/action culling. The HUD can be shared over both viewports.