Multiplayer Shooting Mechanics


Working on improvements to some of the mechanics - specifically the shooting mechanic. 

This is important because the physics raycasts need to be accurate in order to send the correct feedback to players, rather than "shooting at ghosts" where there is desync and the target you are shooting is actually in a different world position.

Because every mechanic is impacted simply by the nature of it being multiplayer, there is a lot of extra work that would not usually be required. (here's a few examples)

Potential Issue 1
All objects in the world have a network visibility component attached to them. This is used to check if a player is close enough to warrant sending data about that object, over the network, to the player's client. The component is made up of two aspects, the distance at which data is sent/not sent, and how long until the game object's visibility component checks again for observers (players).

Should the game object not be rendered, there is potential for a physics raycast to hit something it normally shouldn't be allowed to hit (as there would normally be a gameobject with a collider).

Potential Issue 2
Hit detection may be more difficult/less accurate on clients with a poor connection (dropping frames or general low frame rate). This is because some events are frame-based. ie - certain amounts of checks are made every frame. Less frames equals less checks.

The rate at which collisions are checked for is also an issue. Constant checks would be heavy on network traffic (and costly), however, too little checks, or not frequent enough, and you risk bullets passing through players due to their speed.

Potential Issue 3
Bandwidth usage is a serious concern when it comes to mechanics like shooting etc. This is because a client must send a command to the server, to which the server can then execute functions on other connected clients. Trying to reduce total bandwidth by optimisation and efficient code will impact how long it takes to get a version that can go to production for a public release.

Get Space Wars

Buy Now$5.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.