I'm working on an MMORPG,now I'm design about inventory system,and I m using untiy as my client engine,.net core as my server,so that I can easily share code from server to client.
Let talk about Drop logic,I have two implements,and I want to know which one is better.
1.once client send a DropMsg(int dropEntityID,vector3 pos) to server,then the server do logic like follow.
- human packer change,remove the dropped item
- entity state change to Dropped,and set the drop position for it
- response a DropSuccMsg() back to client,this msg is very small even only take 4 bytes.
- broadcast a HumanDropSuccMsg(int humanEntityID,data humanDropEntityData) to all client that in the area (aoi system)
when client get DropSuccMsg(),then the client do the same things like server did.If there is no bug in game,the client should get same result like server.this way save lots of bandwidth,but it is hard to code.
2.once client send a DropMsg(int dropEntityID,vector3 pos) to server,then the server do logic like follow.
- human packer change,remove the dropped item
- entity state change to Dropped,and set the drop position for it
- response a DropSuccMsg(packerData humanPackerData,data humanDropEntityData) back to client,this msg is very large,it contains two datas,one is the player's inventory data,it is an array save the items entity id,another one is the drop entity data after it be dropped,in protobuf it will take more than 100 bytes some times.
- broadcast a HumanDropSuccMsg(int humanEntityID,data humanDropEntityData) to all client that in the area (aoi system)
when the client get response,it will sync player's packer data,and then sync the drop entity data.without do any logic,only sync.this way is easy to code,but it will occupy lots of bandwidth of server.
We don't need to talk about safe,because both of the implement will verify data in server,so it is not important that if client be hacked.
so please tell me which one is better,or which one is widely used in online games.
Sorry for my English.