I guess I'm showing my age but having read stuff like Michel Abrash's books years ago this article was a bit underwhelming. Like no one who wrote any code back in the 80s or 90s even for a homebrew game was skipping this stuff, it was in almost every book and tutorial. Stuff like bit shifting was extremely common and a lot of games would have had design choices that were informed by coding challenges. Lots and lots o…
The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
161–170 of 186 posts
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#162> The same trick can also be used for the other direction to save a division: > NewValue = OldValue >> 3; You need to be careful, because this doesn't work if the value is negative. A
Most CPU's has signed and unsigned right shift instructions (left shift is the same), so yes it works (You can test this in C by casting a signed to unsigned before shifting). The biggest caveat is that right shifting -1 still produces -1 instead of 0, but that's usually fine for much older game fixed-point maths since -1 is close enough to 0.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#163While it has been a while since playing RCT, one thing that was really nice about the game is that it runs flawlessly under Wine. I really wish I could see the source code.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#164Earlier quoted context omitted.
> Numeric characteristics are absolutely still a consideration for game designers even in 2026, one that influences what numbers they use in their game designs. The good ones, anyways. I used to think like this, not anymore. What convinced me that these sort of micro-optimizations just don't matter is reading up on the cycle count of modern processors. One a Zen 5, Integer addition is a single cycle, multiplication 3…
Also, it's unusual for a game to be CPU bottlenecked nowadays, and if it is, it's probably more constrained on memory bandwidth than raw FLOPS.
That, and Factorio. The factory eats 3D V-Cache and single core speed for breakfast.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#165Earlier quoted context omitted.
Back in the early, early days, the game designer was the graphic designer, who also was the programmer. So, naturally, the game's rules and logic aligned closely with the processor's native types, memory layout, addressing, arithmetic capabilities, even cache size. Now we have different people doing different roles, and only one of them (the programmer) might have an appreciation for the computer's limits and happy-p…
I wrote the Intellivision Mattel Roulette cartridge game back in the 1970s. It was all in assembler on a 10 bit (!) CPU. In order to get the game to fit in the ROM, you had to do every feelthy dirty trick imaginable.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#166"Since the number is stored in a binary system, every shift to the left means the number is doubled. At first this sounds like a strange technical obscurity" Do we not know binary in 2026? Why is this a surprise to the intended audience?
https://xkcd.com/2501/
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#167Earlier quoted context omitted.
Also, it's unusual for a game to be CPU bottlenecked nowadays, and if it is, it's probably more constrained on memory bandwidth than raw FLOPS.
4X games tend to be CPU bottlenecked as far as I understand it. That, and Factorio. The factory eats 3D V-Cache and single core speed for breakfast.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#168Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#169I had always heard about how RCT was built in Assembly, and thought it was very impressive. The more I actually started digging into assembly, the more this task seems monumental and impossible. I didn't know there was a fork and I'm excited to look into it
Back then a lot of people started with assembly because that was the only way to make games quick enough. Throughout the years they accumulated tons of experience and routines and tools. Not saying that it was not a huge feat, but it’s definitely a lot harder to start from scratch nowadays, even for the same platform.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#170I had always heard about how RCT was built in Assembly, and thought it was very impressive. The more I actually started digging into assembly, the more this task seems monumental and impossible. I didn't know there was a fork and I'm excited to look into it
Programming in assembly isn't really "hard" it mostly takes lots of discipline. Consistency and patterns are key. The language also provides very little implicit documentation, so always document which arguments are passed how and where, what registers are caller and callee saved. Of course it is also very tedious. Now writing very optimized assembly is very hard. Because you need to break your consistency and conven…
I think it'd be cool to do assembler on a Pi Pico or something, that seems like it would be a fun exercise.