by JamesTRexx · 5mo ago · 0 comments
Took a break from it for a while and picked it up again, this time by not doing anything much feature-wise but pulling the code apart and de-C++-ing it. Bit by bit building a categorised code tree with single functions per file, deconstructing classes to plain functions and data structs, with the goal to convert from C++ to clear C. And then one day consolidate code to have for instance the same diagonal road options as current train tracks.
Might be pointless and take a long time to finish, but it's comforting to turn something overly complex into simple, small pieces and also create a unique code formatting style to visualise elements of a line of code for easier reading. Another fun part is reading about data design and coming up with a custom data container to replace the std::vector uses.
I suppose a 15 meter bus going 50km/h travels roughly its own length (13.40 meters to be exact) every second, so it takes 3 seconds to pass a grid square - checking out a YouTube video, it seems that's already the speed right now!
It was also quite easy to limit production (or passengers) in the code from 06:00 to 20:00 a day for a little extra realism with either emptying a station during the night or have no traffic servicing buildings. Even weekends are possible. Warehouses would be a nice addition.