[ShooterGame] Add/Remove Weapons on Client

I am playing around with the ShooterGame example from the UE4 marketplace and I want to use an external server to configure the weapon load out for a player based on the name they are connected with.

I have it working for the host but not for any of the clients that connect. I am currently just doing an HTTP request and getting the data for the given character, using that to populate the DefaultInventoryClasses and then calling SpawnDefaultInventory.

It is my guess that the server is rejecting the changes. I can tell the AddWeapon function to not check the Role authority but I believe the server is still validating something else and preventing the client from getting the weapons.

Any help is appreciated.

Best approach would be to have the server handle all of the work with populating the inventory, then replicating the inventory down to the clients via replicated variables/RPCs.

If you allow the clients to fetch the weapons from an external source themselves, you are making it substantially easier for players to cheat or somehow alter that process. This is the reason for the Role_Authority check in AddWeapon - the server should be the only trustworthy entity.

I am trying to think of a way where API calls don’t have to be made all on the server to offset some of the load. I am fairly unfamiliar with how replication works. Thanks for the help!

I suggest looking at the Blueprint Replication videos on the UnrealEngine youtube channel. Even if you aren’t using Blueprint its a good introduction to the concepts of replication.

There’s nothing stopping you from doing some calculations clientside, but you always need to ‘ask’ the server to do the actual changes to gameplay-affecting variables. This is so the server as the only trustworthy entity can decide whether to perform the task at hand or not. In some cases, like this, it’s simpler to just just tell the server that you want your inventory filled, and allow it to do so.