What I did
→ Discussion on /r/Citybound
Very happy about my work today :)
Pretty much completing my work from friday, I rewrote an essential part of the engine (message passing between actors).
The code became much simpler! (this was the goal)
- Some very mysterious parts of the engine are less mysterious, making it hopefully less and less scary-looking for any stray helpful programmers passing by
- Like I said on friday, multithreading will be easier thanks to this
- Simpler code makes it easier to find bugs hiding in every other part affected by it
The code became more correct!
- The new implementation makes some guarantees about the order in which actors receive messages
- To illustrate the importance, imagine someone sending you a letter that says "Destroy all houses" and then a second letter that says "Build a new house". You tragically receive and implement them in the wrong order though - and to make things worse, this someone then wants to visit you at the new house. Also, both of you are incredibly dumb.
- ...this prevents a whole class of bugs!
The code became faster!
- I hoped that the new implementation would be at least as fast as the old one, else this whole endeavor would be kind of useless, but it was hard to predict that so I had to try anyways
- But after some pretty obvious optimizations, the new implementation actually ended up being faster! (Planning & building roads ~1.3x faster, traffic simulation ~1.6x faster!)
- This makes me very happy :)