Replication Hell


So as this game is intended to be a multiplayer FPS, some basics things need to work. Like the ability to shoot each other, take damage, die, etc. So this past week we have been working on getting the necessary components to replicate between the server and clients. Our biggest issue has been spawning projectiles. Projectiles being fairly important to a shooter. 

The problem has been that when in a multiplayer session the player playing as the server  was able to spawn projectiles using the fire input and it would replicate locally and on the client with no issue. However, the client player would only spawn projectiles  on the local client and not back to the server. The functionality to spawn the projectile has been in the weapon blueprint. Keep in  mind that the weapon is a simple Actor blueprint. After a lot of trial and error and setting variables and objects to replicate to the server, we were finally able to fix the issue but moving the projectile spawn function in the Character Blueprint. After moving it, projectiles were spawned and replicated on both client and server. Great work, bug squashed!

Joy was short lived. As is often to happen, fix one thing,  break another. We plan to have multiple weapons in the game, each with different capabilities. So each weapon has its own set of variables. One of the important ones is the ammo variable and max ammo variable. The ammo variable holds the current amount of ammo, while the max ammo variable indicates the maximum amount of ammo the weapon can hold. So the weapon blueprint holds the ammo variable. After moving the fire function we basically have the same situation as before, we just moved the problem to the ammo variable. Ammo is decremented when the player fires, and when they player runs out, they can no longer shoot. So the server payer works fine, shoots, decrements ammo and stops firing when they run out. On the client side however, the player shoots and at least on the server the ammo variable seems to get decremented , but not on the client side the ammo is not decremented, so the client can just keep shooting. Right now  the prevailing thought is that the authoritative server is not updating the local client variable. This is main issue we are currently trying to resolve. There was also a thought to move the ammo variable to Character Blueprint as we did with the projectile spawn event. Remember though each weapon has a different amount of ammo. We are working through a few options to fix the issue.

Once this is fixed we can move on to implementing the key components of doing damage to players, decrementing health and killing other players. The health variable is already in the Character Blueprint so we should have no issues having is replicate to the server. At the moment the projectiles spawn but do not do anything else. For testing purposes the projectile velocity is set very low. Once we have the ammo bug worked out we will increase the velocity of the projectiles and have collisions with the player character cause damage. So far all testing has been done with only a single weapon. We will have to duplicate all of the same functionality with at least one more weapon for the beta; at least we want to. Looking ahead a little further we will also need to work out re-spawns, stat tracking, etc. The primary focus for the next week will fixing the ammo bug, dealing damage, and kills. Then core functionality of an FPS will be operational. Hopefully we can get this issue resolved soon, get core functionality working so we can start putting some polish on this game. 

Get Neospace: Combat Nexus by 982 Dyanmics

Leave a comment

Log in with itch.io to leave a comment.