wait a fucking second...

it has been ZERO DAYS since I found an off-by-one error in a game from 1990

So here's the zoomed out (F1) view in Railroad Tycoon.
It's supposed to show the whole map. It doesn't.

Here's some lakes north of Winnipeg. We can see that they go right up to the edge of the map, right?

So let's hit F4 and zoom in and NOPE.
The eastern part of the lake that goes off the map actually stops before touching it!

The zoomed-out view is missing a single line of tiles from the top of the map!

It does it on all 4 cardinal directions.

I notice there's a white rectangle around the viewport... did they accidentally make the 1-pixel-wide border cover up the edges of the map, instead of bordering it?

I noticed another error: the code that determines which shorelines to draw breaks at the edge of the map, making it look like there's a big vertical island out in the pacific

This only happens on the West and South borders. The North and East borders are phantom-island free.

Sounds like AN OFF BY ONE ERROR TO ME

apparently the save file grows by 4 bytes for every single piece of track you put down

I think I just found an off-by-two error?

if you are in F4 mode and right click on the (1,1) tile, it ends up focusing on the top-right instead of top-left

interesting: The game's internal coordinate system is a 16-bit unsigned integer, which starts in the top-left at 0,0, then it continues vertically down and then to the right.

although the coordinates are... weird. Some of them aren't on the map, I think.

yeah.
So the point I'd call (1,0) is point 200.
So 199 should be at (0,199) right? the bottom left coordinate?

NOPE! that point is 191.

Where's 191-199? NOT ON THE MAP

this would make some amount of sense if they were just stuffing the coordinates into a bitfield but that's 200 decimal, not hex, so... no.

also why combine the X+Y coordinates into this idea of point numbers? the map is 256x192.
You can store coordinates in two bytes and it'll make more sense and be simpler to deal with.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.