Skip to content

2021, [piegames]: A newer core

piegames edited this page Aug 12, 2021 · 1 revision

This time I've completely rewritten core

All state machines are gone. The client-server and the client-client part are properly separated. Everything is async-native, the event loop is not running on its own task anymore. The changes resulted in a net gain (loss?) of about 1000 lines of code, which is considerable. A lot of complexity has been eliminated. Compared to the initial code when I forked the project, almost nothing is left, except for the event serialization and some lines of crypto.

This strive for simplicity too has a price: there are a lot of features (or potential) features that have to be cut or will be a bit harder to implement that way. For example, at the moment there is no possibility to send and receive messages in parallel. Also the error handling is "bail out and close the connection" at the moment, the close "mood" to signal errors to the server does not exist anymore. A lot of assumptions about the current server implementation details that are not specced out yet can be found in the client-server implementation code.

I do not find this bothersome at the moment, but it is important to know and aknowledge. For example, this means that no guarantees about update stability and backwards compatibility can be made at the moment. If the server updates, there is a high probability that the Rust client will need to update too.

I won't lose many words on the details this time, because the code should be a lot easier to read and understand than previously. Many parts have preliminary documentation, which helps a lot. (The documentation mostly lacks usage examples to get developers up to speed faster.)

Yet, a year ago I wouldn't have been able to write a protocol implementation from scratch (I actually tried, and more than once). At each point in time, there was a running implementation and tests to check if something had gone wrong. This was invaluable, and without I wouldn't have gotten the API into its current form. Many many thanks go out to all those who worked on the initial state machines and built a working foundation.