Hacker News new | ask | show | jobs
by viewer5 2199 days ago
What do you mean by "small binary commands"?
2 comments

Instead of cramming ecoded json into the data channels, like you'd with websockets, you can build binary buffers with all the data that has to be communicated between server and client. For example movement commands like up/down/left/right alongside some flags like isJumping can be packed into a singe uInt8
Yup, delta compression and potential visibility sets are also a huge win as well.

The best thing is to design your gameplay to be "predictive", that's how we had ~300 player games like Subspace over 28.8/56k way back in the day.

Use websocket in binary mode, pack operations into tiny messages.
actually binary websockets won't do in this case since the underlying protocol is still TCP with automatic retransmission mechanism which kills performance for very fast-paced games. You have to use WebRTC in that case
So there's no reason to use binary commands when using something like socket.io?
not much but shaving off some bytes is good in itself