New answers tagged

0

A simpler method is to set a free ID on creation and send to other clients "create entity of type foo with ID 4 and parameters x,y,z,bar" There is a danger of collision when selecting IDs for which you need a mitigation strategy. Either by error message and some kind of recovery or pre-agreeing a pool of IDs for each entity creator which can grow as needed. ...


1

An UUID takes up 128 bits. Your own ID can be as small as ceil(log_2(n)) bits; where n is the number of entities you want to distinguish between. Getting the entity from the UUID requires a hashmap. A cleverly constructed ID system will let you simply index into an array instead, which is slightly faster. You can also embed some type information in the ...


4

Update These are the lessons learned from fixing this problem: We found the following issues when reviewing the network code: [Client/Server] UdpClient.Receive alters the IPEndPoint you pass to it by reference. So, do not use the same endpoint you use for sending. [Server] We needed to use ReceiveAsync on the server to be able to interrupt it. Which we do ...


3

Don't try to send GameObjects over the wire. Unity objects like GameObjects, Transforms, and other components are not set up for user serialization. There isn't a way to digest the whole thing into bytes to fit down the pipe then reconstitute it at the other end. Moreover, we wouldn't actually want to. It's both heavier-weight and less effective than what we ...


Top 50 recent answers are included