Search Unity

How client - backend/server conversation should work?

Discussion in 'Multiplayer' started by Pontik, Aug 18, 2015.

  1. Pontik

    Pontik

    Joined:
    Feb 26, 2014
    Posts:
    17
    Hello,

    i am working on a multiplayer rpg game and i have some problems with understanding client-server conversation principies.

    For example in a rpg game a player has inventory (List of Items), some are equiped, some are in the bag. On scene load i load the inventory from my database and set equiped items to player equip slots. Next i want to equip a item from the bag. I do a request do database, there some process will happen (Has player item that should be equiped? If yes, check a item is alredy equiped in this slot. If yes - set item in the slot as unequiped and set item that should be equiped to the slot (for Example: obj property headEquipSlot: ItemId). Next execute a callback to client item was equiped or error)

    So far so good. Clien become callback and set the item prefab in the equipslot if no errors hapened. But in this case we have to wait for backend/server response to the client. This means waiting for maybe ~1second to get the response or meybe more for comlicated requests that handle huge data.

    Do anybody know how this process should work better for an ?autocrative? server - client conversation? May be for my example the process of setting a item to equip slot should happen imediate and after server response i should check this operation was valide?

    Thank you for your answers!