Live data from Hacker News

The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

larstofus.com

101–110 of 186 posts

Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

#101
On huge games produced by large game studios, I wonder if the idea of using a real world technical challenge as a "feature" within the game is considered genius? Consider a coder and a game designer who are on different teams and don't attend the same meetings.

But if you look at creative writing, story arcs are all about obstacles. A boring story is made interesting by an obstacle. It is what our protagonist needs to overcome. A one-man-band game dev who simultaneously holds the story and the technical challenge their head, might spot the opportunity to use a glitch or limitation as, I dunno, a mini game that riffs on the glitch.

Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

#102

Earlier quoted context omitted.

This way of thinking has caused at least a few prominent recurring bugs I can think of. Texture resolution mismatches causing blurriness/aliasing, floating point errors and bad level design causing collision detection problems (getting stuck in the walls), frame rate and other update rates not being synced causing stutter and lag (and more collision detection problems), bad illumination parameters ruining the look th…

> getting stuck in the walls I remember the early Simpsons video game. Sometimes, due to some bug in it (probably a sign error), you could go through the walls and see the rendered scenery from the other side. It was like you went backstage in a play. It would have made a great Twilight Zone episode!

Those bugs I experienced in all sorts of games and via cheats, fly mode, I intentionally went backstage to explore.

Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

#103

Earlier 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…

> Integer tricks and optimizations are pointless. They’re not pointless; they’re just not the first thing to optimize. It’s like worrying about cache locality when you have an inherently O(n^2) algorithm and could have a O(n log n) or O(n) one. Fix the biggest problem first. Once your data layout is good and your cpu isn’t taking a 200 cycle lunch break to chase pointers, then you worry about cycle count and keeping…

> And if you’re doing SIMD, your integer SIMD instructions can be 2 or 4x higher throughput than float32 if you can use int16 / int8 data.

Your float instructions can also be 2x the throughput if you use f16. With no need to go for specific divisors.

For values that even can pack into 8 bits, you rarely have a way to process enough at once to actually get more throughput than with wider numbers.

I'm sure there's a program where it very much matters, but my bet is on it not even mildly mattering, and there basically always being a hundred more useful optimizations to work on.

Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

#104
post #15

Earlier quoted context omitted.

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

Not only is LEA more flexible I believe it's preferred to SHL even for simple operations because it doesn't modify the flags register which can make it easier to schedule.

It's more about the non-destructive destination part, which can avoid a move. Compilers tend to prefer SHL/SAL of LEA because its encoding is shorter: https://godbolt.org/z/9Tsq3hKnY

Re: The gold standard of optimization: A look under the hood of RollerCoaster Tycoon

#105

"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

#106

Earlier quoted context omitted.

Not only is LEA more flexible I believe it's preferred to SHL even for simple operations because it doesn't modify the flags register which can make it easier to schedule.

shlx doesn't alter the flag register.

SHLX does not support an immediate operand. Non-destructive shifts with immediate operands only arrive with APX, where they are among the most commonly used instructions (besides paired pushes/pops).
Post reply on HN