- Joined
- Feb 5, 2016
- Messages
- 540
- Reaction score
- 326
- First Language
- Portuguese(BR)
- Primarily Uses
- RMMV
One common use of multithreading in games is networking(usually because they've a system similar to javascript, where there's one mainloop that controls the drawings and the input read).
So, considering that websockets add a bit more overhead than a normal TCP connection, and that I always do encryption of messages being sent and decryption of messages being received(which usually takes less than a ms, at least the encrypt/decrypt part) should I move websockets and encryption/decryption of messages to a webworker? And in case its a no, why do people do move network handling to a sepparate thread for games made using non-web technologies?
(Btw doing this would probably add around 0.5ms extra time to deal with messages, but the execution would be in a separate thread, thus giving the main thread a few extra milisseconds to work on frames.)
So, considering that websockets add a bit more overhead than a normal TCP connection, and that I always do encryption of messages being sent and decryption of messages being received(which usually takes less than a ms, at least the encrypt/decrypt part) should I move websockets and encryption/decryption of messages to a webworker? And in case its a no, why do people do move network handling to a sepparate thread for games made using non-web technologies?
(Btw doing this would probably add around 0.5ms extra time to deal with messages, but the execution would be in a separate thread, thus giving the main thread a few extra milisseconds to work on frames.)