frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

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

https://larstofus.com/2026/03/22/the-gold-standard-of-optimization-a-look-under-the-hood-of-rollercoaster-tycoon/
67•mariuz•2h ago

Comments

sroerick•1h ago
I 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

mikkupikku•55m ago
Macros. Lots of macros.
timschmidt•9m ago
And presumably generous use of code comments
HelloUsername•1h ago
Fun read, thx! I'd also recommend more about RCT:

"Interview with RollerCoaster Tycoon's Creator, Chris Sawyer (2024)" https://news.ycombinator.com/item?id=46130335

"Rollercoaster Tycoon (Or, MicroProse's Last Hurrah)" https://news.ycombinator.com/item?id=44758842

"RollerCoaster Tycoon at 25: 'It's mind-blowing how it inspired me'" https://news.ycombinator.com/item?id=39792034

"RollerCoaster Tycoon was the last of its kind [video]" https://news.ycombinator.com/item?id=42346463

"The Story of RollerCoaster Tycoon" https://www.youtube.com/watch?v=ts4BD8AqD9g

fweimer•1h ago
What 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).
cjbgkagh•38m ago
It was written in assembly so goes through an assembler instead of a compiler.
shakow•13m ago
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 <<2, it will still generate a LEA.

https://godbolt.org/z/EKj58dx9T

londons_explore•54m ago
> it turns an optimization done out of technical necessity into a gameplay feature

And this folks is why an optimizing compiler can never beat sufficient quantities of human optimization.

The human can decide when the abstraction layers should be deliberately broken for performance reasons. A compiler cannot do that.

timschmidt•4m ago
Agreed. It really requires an understanding of not just the software and computer it's running on, but the goal the combined system was meant to accomplish. Maybe some of us are starting to feed that sort of information into LLMs as part of spec-driven development, and maybe an LLM of tomorrow will be capable of noticing and exploiting such optimizations.
applfanboysbgon•52m ago
> 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 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. There are, of course, also countless bad developers/designers who ignore these things these days, but not because it is free to do so; rather, because they don't know better, and in many cases it is one of many silent contributing factors to a noticeable decrease in the quality of their game.

edflsafoiewq•41m ago
Examples?
andai•30m ago
https://en.wikipedia.org/wiki/Nuclear_Gandhi

From what I heard, there was a Civilization game which suffered from an unsigned integer underflow error where Gandhi, whose aggression was set to 0, would become "less aggressive" due to some event in the game, but due to integer underflow, this would cause his aggression to go to 255, causing him to nuke the entire map.

The article says this was just an urban legend though. Well, real or not, it's a perfect example of the principle!

luaKmua•24m ago
Indeed an urban legend. Sid Meier himself debunked in his memoir, which is a pretty great read.
Waterluvian•22m ago
Not really an example that proves any point, but one that comes to mind from a 20-year-old game:

World of Warcraft (at least originally) encoded every item as an ID. To keep the database simple and small (given millions of players with many characters with lots of items): if you wanted to permanently enchant your item with an upgrade, that was represented essentially as a whole new item. The item was replaced with a different item (your item + enchant). Represented by a different ID. The ID was essentially a bitmask type thing.

This meant that it was baked into the underlying data structures and deep into the core game engine that you could never have more than one enchant at a time. It wasn't like there was a relational table linking what enchants an item in your character's inventory had.

The first expansion introduced "gems" which you could socket into items. This was basically 0-4 more enchants per item. The way they handled this was to just lengthen item Ids by a whole bunch to make all that bitmask room.

I might have gotten some of this wrong. It's been forever since I read all about these details. For a while I was obsessed with how they implemented WoW given the sheer scale of the game's player base 20 years ago.

hcs•11m ago
Not the same thing but I was reminded of a joke about the puzzle game Stephen's Sausage Roll:

> I have calculated the value of Pi on Sausage Island and found it to be 2.

https://web.archive.org/web/20240405034314/https://twitter.c...

timschmidt•37m ago
Absolutely. I have written a small but growing CAD kernel which is seeing use in some games and realtime visualization tools ( https://github.com/timschmidt/csgrs ) and can say that computing with numbers isn't really even a solved problem yet.

All possible numerical representations come with inherent trade-offs around speed, accuracy, storage size, complexity, and even the kinds of questions one can ask (it's often not meaningful to ask if two floats equal each other without an epsilon to account for floating point error, for instance).

"Toward an API for the Real Numbers" ( https://dl.acm.org/doi/epdf/10.1145/3385412.3386037 ) is one of the better papers I've found detailing a sort of staged complexity technique for dealing with this, in which most calculations are fast and always return (arbitrary precision calculations can sometimes go on forever or until memory runs out), but one can still ask for more precise answers which require more compute if required. But there are also other options entirely like interval arithmetic, symbolic algebra engines, etc.

One must understand the trade-offs else be bitten by them.

lefty2•49m ago
> 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

PC Gamer recommends RSS readers in a 37mb article that just keeps downloading

https://stuartbreckenridge.net/2026-03-19-pc-gamer-recommends-rss-readers-in-a-37mb-article/
162•JumpCrisscross•3h ago•60 comments

The future of version control

https://bramcohen.com/p/manyana
313•c17r•6h ago•170 comments

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

https://larstofus.com/2026/03/22/the-gold-standard-of-optimization-a-look-under-the-hood-of-rolle...
68•mariuz•2h ago•17 comments

Reports of code's death are greatly exaggerated

https://stevekrouse.com/precision
158•stevekrouse•10h ago•159 comments

Five Years of Running a Systems Reading Group at Microsoft

https://armaansood.com/posts/systems-reading-group/
85•Foe•4h ago•22 comments

Project Nomad – Knowledge That Never Goes Offline

https://www.projectnomad.us
312•jensgk•9h ago•70 comments

Flash-MoE: Running a 397B Parameter Model on a Laptop

https://github.com/danveloper/flash-moe
273•mft_•10h ago•96 comments

LLMs Predict My Coffee

https://dynomight.net/coffee/
21•surprisetalk•4d ago•5 comments

Teaching Claude to QA a mobile app

https://christophermeiklejohn.com/ai/zabriskie/development/android/ios/2026/03/22/teaching-claude...
36•azhenley•2h ago•1 comments

MAUI Is Coming to Linux

https://avaloniaui.net/blog/maui-avalonia-preview-1
122•DeathArrow•6h ago•52 comments

Windows native app development is a mess

https://domenic.me/windows-native-dev/
274•domenicd•12h ago•294 comments

Building an FPGA 3dfx Voodoo with Modern RTL Tools

https://noquiche.fyi/voodoo
135•fayalalebrun•8h ago•25 comments

What Young Workers Are Doing to AI-Proof Themselves

https://www.wsj.com/economy/jobs/ai-jobs-young-people-careers-14282284
34•wallflower•3h ago•22 comments

Palantir extends reach into British state as gets access to sensitive FCA data

https://www.theguardian.com/technology/2026/mar/22/palantir-extends-reach-into-british-state-as-i...
120•chrisjj•4h ago•34 comments

How to Attract AI Bots to Your Open Source Project

https://nesbitt.io/2026/03/21/how-to-attract-ai-bots-to-your-open-source-project.html
30•zdw•1d ago•4 comments

OpenClaw is a security nightmare dressed up as a daydream

https://composio.dev/content/openclaw-security-and-vulnerabilities
228•fs_software•4h ago•158 comments

Show HN: Codala, a social network built on scanning barcodes

https://play.google.com/store/apps/details?id=com.hsynkrkye.codala&hl=en
9•hsynkrkye•4d ago•5 comments

More common mistakes to avoid when creating system architecture diagrams

https://www.ilograph.com/blog/posts/more-common-diagram-mistakes/
121•billyp-rva•10h ago•48 comments

Vectorization of Verilog Designs and its Effects on Verification and Synthesis

https://arxiv.org/abs/2603.17099
13•matt_d•3d ago•1 comments

Cloudflare flags archive.today as "C&C/Botnet"; no longer resolves via 1.1.1.2

https://radar.cloudflare.com/domains/domain/archive.today
340•winkelmann•18h ago•249 comments

Why I love NixOS

https://www.birkey.co/2026-03-22-why-i-love-nixos.html
138•birkey•4h ago•107 comments

A review of dice that came with the white castle

https://boardgamegeek.com/thread/3533812/a-review-of-dice-that-came-with-the-white-castle
117•doener•3d ago•36 comments

25 Years of Eggs

https://www.john-rush.com/posts/eggs-25-years-20260219.html
226•avyfain•4d ago•66 comments

Personal Computing (2022)

https://josh8.com/blog/personal_computing.html
11•xk3•2h ago•2 comments

The IBM scientist who rewrote the rules of information just won a Turing Award

https://www.ibm.com/think/news/ibm-scientist-charles-bennett-turing-award
78•rbanffy•10h ago•6 comments

GrapheneOS refuses to comply with new age verification laws for operating system

https://www.tomshardware.com/software/operating-systems/grapheneos-refuses-to-comply-with-age-ver...
153•CrypticShift•5h ago•68 comments

Brute-forcing my algorithmic ignorance

http://blog.dominikrudnik.pl/my-google-recruitment-journey-part-1
86•qikcik•9h ago•52 comments

Zero ZGC4: A Better Graphing Calculator for School and Beyond

https://www.zerocalculators.com/features
24•uticus•5d ago•22 comments

Show HN: Revise – An AI Editor for Documents

https://revise.io
52•artursapek•8h ago•44 comments

A case against currying

https://emi-h.com/articles/a-case-against-currying.html
86•emih•8h ago•107 comments