Timeline for How would a server handle sending entity updates to clients?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 29, 2017 at 23:38 | vote | accept | Dennis Björk | ||
| Oct 29, 2017 at 23:38 | comment | added | Dennis Björk | That's even better..damn you make me feel stupid but thanks! :') | |
| Oct 29, 2017 at 23:23 | comment | added | Bálint | @DennisBjörk You could just have 2 or 3 separate main classes and make them use different functions if they need to | |
| Oct 29, 2017 at 23:20 | comment | added | Dennis Björk | I guess I'll read up on more UDP then! So let's add a variable and call it "netmode". Netmode can be 0,1, or 2. 0 = Single player/No server or any message sent. 1 = Client and 2 = Server/host. Then in my update and render methods etc I could put if statements like if(netmode == 2) {//do server stuff} could that be a way to go about it? | |
| Oct 29, 2017 at 23:00 | comment | added | Bálint | @DennisBjörk It's hard to wrap your head around it first, but you'll understand it eventually. The reason TCP is so slow compared to UDP is that it makes sure everything arrives without holes and in order. As to your second point, yes, but you could just use the exact same classes without rendering them. Your main classes should handle that. | |
| Oct 29, 2017 at 22:54 | comment | added | Dennis Björk | I was trying to learn UDP for this reason but it was really difficult and I had a hard time grasping how the server would send data to multiple clients and such without sockets etc. I also heard that TCP was pretty much as good as UDP if i disable some algorithm so I went with TCP since it feels simpler. But if you have any advice on UDP feel free to share! Now to the structure, so I could basically copy the classes needed and just delete the graphical stuff and then in the update just keep sending entity information and add into the clients entity lists and map list? Thanks! | |
| Oct 29, 2017 at 20:58 | history | answered | Bálint | CC BY-SA 3.0 |