Live data from Hacker News

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

larstofus.com

111–120 of 186 posts

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

#113
The article refers several times to the benefits of the game designer and the coder being the same person. I've often felt that this is the only way to build anything impressive, and in fact I'm amazed that corporations with their hierarchical organisation model ever get anything built at all but I suppose you can brute force anything with enough employees.

It does make you wonder if the future of AI-assisted development will look more like the early days of coding, where one single mind can build and deliver a whole piece of software from beginning to end.

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

#114

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…

Both Comanche and Settlers 1 were so magic to me as a kid. You learned to work with DOS in text mode. Most shiny on the PC was Wordperfect. And suddely your text computer was capable of displaying graphics and ... games. Hooked me for life.

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

#115

> 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.

[flagged]

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

#116

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

I remember the older driving games. They'd progressively "build" the road as you progressed on it. Curves in the road were drawn as straight line segments. Which wasn't a problem, but it clearly showed how the programmers improvised to make it perform.

Limiting the drawing distance and rendering as little geometry as possible is absolutely still a thing, devs just can afford to hide it better these days. The golden rule of graphics programming has always been "cheat as much as you can get away with, and then a bit more".

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

#117
post #4

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).

Well, Sawyer started writing Transport Tycoon in 1992, when free or affordable C compilers were not as widely available. Turbo C was never known for optimizations. GCC 1.40 was good enough for Linus, but I guess Chris was already a good assembly programmer.

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

#118

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…

It's a shame that when a Redditor discovered the source code for the original StarCraft "gold master" on a CD, they sent it back to Blizzard in exchange for some fucking blizzard merch [1] EA a while back released the source code to (most) of the old Command & Conquer games [2] though interestingly left out Tiberian Sun and Red Alert 2, StarCraft's closest competitors at the time. Would've been nice for historical pr…

This entire reddit thread aged really poorly now that Blizzard is a shell of its former self. If anything, the attitude in that thread is what paved Blizzard's decline: complete disrespect for its origin.

The StarCraft source code is something that must be kept behind closed walls, under tight control by Blizzard, even though the original people working on the game at Blizzard have already left and there is nothing to protect here other than eternal shame.

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

#119

Earlier quoted context omitted.

The 4 bit stuff is a hangover from Mojang having to squeeze every bit of perf from their Java based engine that they could. Their original sound engine was so sketchy that C418's (music composer) minimalist sound is partly because it really couldn't handle much more than what got released. MS has been loosening up on the 4 bits limit and have created a CPP variant of Minecraft which performs better, but they've also…

Hey, this isn't entirely accurate! The 4-bit stuff is a hangover from Notch doing this (I'd maybe even say a similar-calibre programmer to Chris Sawyer...). The sound has nothing to do with technical limits, that's a post-facto rationalisation. The game never played midi samples, it was always playing "real" audio. The style was an artistic choice, many similar retro-looking games were using chiptune and the sorts. I…

Bedrock Edition has a smaller simulation distance, which is kind of the opposite you'd expect from the more "optimized" version.

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

#120

Earlier quoted context omitted.

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

Problem with f16 is that hardware support is still "new" and can't be relied on in consumer grade CPUs yet.
Post reply on HN