Low Level Programming Sessions Summary 17
22nd February
This week we discussed threading in more detail as well as a lot more things about networking and how to manage a large networked game, and how SFML can allow us to do this.
We talked about the concept of a heartbeat which clients listen to to see if they are responding to a ping message, we check to see if they're connected and if it disconnects we send a message and unplug the socket from our list, which seems fairly straight forward, we just need to check every tick or it and then trigger a subroutine, similar perhaps to a dirty flag design pattern.
If we can't do that then we can measure the client's connectivity with a ping. Essentially we send the client a packet of information and we measure the time it takes to receive it back. If the client takes too long, we then disconnect the client because it is too slow and we assume it has disconnected, however, this can affect players who just generally have low ping.
This is a good way of doing things as it can give us an accurate time that it will take for a client to send and receive a message.
Threading seemed really interesting now it's been explained fully to me. It's basically a way of separating out functionality and doing multiple processes at once, by separating out these individual calls and putting them to different threads which are separated on the CPU into the different cores. Multi threaded programming is the norm, thus, I will have to get used to it and I feel quite confident with the idea of separating all these loops out into different threads.
We also talked a lot about github and how to use that and I learnt I've been doing it wrong. We need to branch off before committing to master and merge the branch with the master file instead. We also talked about how it stores our code and how we can potentially use that to our advantage.
Overall, it was a good session and I learnt a lot. I now feel confident I can try and implement threading once I get the syntax down.
No comments:
Post a Comment