Devlog #1 - Multithreading shenanigans
Reworking the packets
Since the initial system for network packets was quite unintuitive and not very portable due to relying heavily on macros, I decided to try and simplify this system.
I started by moving packet decoding to the main thread. This means that the packet receiver thread now pushes the raw bytebuf to the packet (data) queue and the main thread decodes then packet right before the user handles it. This way, we can avoid enforcing thread safety for decode context data.
Improving thread handling
Next up, I rewrote the client thread system to be state-driven, just like the server. That way i can easily handle connecting to a server, disconnecting and stopping the client.
Also had to fix a bug where the thread handler wouldn’t pass the engine as an argument to the thread.
Next up
Tomorrow im gonna implement more of the actual packet encoding/decoding/handling, so i can actually make my example game playable
Oh btw, i made this little player dude for my example game lol. I should probably implement input, so that he can move around and isn’t just stuck in one place.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.