Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How to best send data over network considering the following communication model

$
0
0
Hi! For my current game project, I'm trying to find a good means of communication between server and clients. I decided that the client will literally only handle the rendering, and will send input over to the server, and the server updates all clients about all changes each tick. (This already looks slightly flawed to me since it will be very network heavy I guess) This also means that I need to be able to send a lot of different kinds of data over network, and that at the beginning of the game I need to send data about the whole world. I'm in the process of trying out two different things, both of which I think are rather ugly and network heavy: 1. Have each of my gameobjects have a serialize and deserialize method. Every tick, I loop through all gameobjects that have been changed in someway and send a packet that consists of the total length of the packet plus all the serialized things in it. Some of the cons of this method includes that I can't differentiate importance of updates; for example, if there's an event that happens rather rarely, I'd want to send it over tcp instead of udp. I can of course split it up and send one packet per entity in my world, but that still seems ugly... 2. I am writing a reflection based serializer that takes each field that has been marked with a specific annotation and recursively goes through each variable to boil an object representation down to a list of prjmitives. I then send that over network and build it back up. Seems less ugly, but more complicated and "heavier". I've never really thought about the details of game network protocols like that before, so I'm quite inexperienced. What would you guys recommend? Thanks!

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>