Warcraft 1 (1994), Warcraft 2 (1995), and StarCraft (1998) all use power-of-2 aligned map sizes (64 blocks, 128 blocks, and 256 blocks) so the shift-factor could be pre-computed to avoid division/multiplication, which was dang slow on those old 386/486 computers. Each map block was 2x2 cells, and each cell, 8x8 pixels. Made rendering background cells and fog-of-war overlays very straightforward assembly language. All…
The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
91–100 of 186 posts
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#92Warcraft 1 (1994), Warcraft 2 (1995), and StarCraft (1998) all use power-of-2 aligned map sizes (64 blocks, 128 blocks, and 256 blocks) so the shift-factor could be pre-computed to avoid division/multiplication, which was dang slow on those old 386/486 computers. Each map block was 2x2 cells, and each cell, 8x8 pixels. Made rendering background cells and fog-of-war overlays very straightforward assembly language. All…
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#93> The same trick can also be used for the other direction to save a division: NewValue = OldValue >> 3; This is basically the same as NewValue = OldValue / 8; RCT does this trick all the time, and even in its OpenRCT2 version, this syntax hasn’t been changed, since compilers won’t do this optimization for you . (emphasis mine) Not at all true. Assuming the types are such that >> is equivalent to /, modern compilers w…
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#94Earlier quoted context omitted.
I was pretty disappointed with how Factorio reworked how fluids worked in the expansion. The old system had its quirks and the new system is obviously more performant, but it throws realism out the window which is a bummer.
I don't miss it. I also found Satisfactory's old fluid system (with concepts like sloshing) wildly unintuitive. I'll go so far as to say that accurate fluid dynamics is detrimental to any game that's not about beavers and water table management.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#95> Imagine a programmer asking a game designer if they could change their formula to use an 8 instead of a 9.5 because it is a number that the CPU prefers to calculate with. There is a very good argument to be made that a game designer should never have to worry about the runtime performance characteristics of binary arithmetic in their life, that’s a fate reserved for programmers Numeric characteristics are absolutel…
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#96Earlier 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.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#97Another great optimization is storing the year as two digits, because you only need the back half… … oh wait, nvm. Don’t preoptimize!
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#98What language is this article talking where compilers don't optimize multiplication and division by powers of two? Even for division of signed integers, current compilers emit inline code that handles positive and negative values separately, still avoiding the division instruction (unless when optimizing for size, of course).
That's what I would have thought as well, but looks like that on x86, both clang and gcc use variations of LEA. But if they're doing it this way, I'm pretty sure it must be faster, because even if you change the ×4 for a https://godbolt.org/z/EKj58dx9T
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#99Earlier quoted context omitted.
I don't miss it. I also found Satisfactory's old fluid system (with concepts like sloshing) wildly unintuitive. I'll go so far as to say that accurate fluid dynamics is detrimental to any game that's not about beavers and water table management.
That's the second time I heard the beaver game come up here... Guess I really ought to try it!
That game, Timberborn, shares some design elements with roller coaster tycoon.
A block based 3d world they can be modified by the player.
Units walking around on player defined paths, with their mood influenced by pretty bushes.
But there are no obvious performance considerations like in the article.
Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon
#100At first this sounds like a strange technical obscurity"
Do we not know binary in 2026? Why is this a surprise to the intended audience?