This is pretty generic/architectural question, about how to handle equping items in game.
I have inventory which stores all items and equipment (which manages which items are equipped). All Items are stored as Json in some backend database. For obvious reason client have no authority over either of them.
On backend side there are serverless functions which handle equipping/upgradeing/manipulation of items. When client is not connected to any server it’s not an issue. Client makes http request to backend, gets response and update it’s current state.
When client is connected to dedicated server it get’s more complex. Here i can’t simply bypass server, because server must also know which items player have.
Here Is few solutions I have thought about:
- Create separate components for when player is not connected to dedicated server and for when player is connected (would have to maintain two separate code paths).
- Let client make requests and then send it’s state to dedicated server (possibly very unsecure).
- Let client make requests and when there is response from backend, tell server to also pull data from backend (safe, but potentially very slow.
- Always route requets trough dedicated server instance (so client would also need to be connected to dedicated server instance, when they are in menu, in that case UE4 instance would only act as gateway and clients connected to it, wouldn’t need to know about other clients).
Do you guys have any other thoughts, about how to do it ?