Jump to content

Dos hangar edge placement bug


NKF

Recommended Posts

Probably not a new bug to some, but thought I'd just point this out to those curious.

 

In the dos version of UFO, you can literally place a hangar at the right edge of the map. Half of the hangar will get built, and the other half will appear on the other side of map but one row down. Obviously the slots on the other side of the base need to be clear for the hangar to be built.

 

But I asked myself the question: what about the lower-right corner? That is, what would happen to the 3 other segments? The answer is they go off the map and overwrite the next lot of memory right after the base map. Namely the base's storage of avalanche launchers. Setting the hangar in the corner automatically sets the Avalanches to 6400 units +/- the low bit. Removing the hangar, selling the avalanches, then adding another hangar resets the Avalanche launchers to 6400-ish. More launchers than you ever really need.

 

I haven't tried it yet, but perhaps what would be more interesting is how this would affect an actual base battle. Would the hangar map get split up into quarters? Something to try on a rainy day I guess. :(

 

- NKF

Link to comment
Share on other sites

"Rainy day" nuthin', no way I can read this without jumping all over it... :(

 

If I've ever heard of this bug before, it went in one ear and out the other.

 

I tested it under CE, and it works as described there too (not just a DOS bug). The launchers would sell for about $80mill, all together...

 

Having written a program for the task just the other day I was able to promptly test how the layout fairs (... fares?) in battle.

 

First off, a note on large module placement. A map is made up of X amount of modules, lined up in a grid. "Large" modules (2x2 being the most common) are placed by sticking the number of the module in the top-left-most grid entry it should cover, then filling the other relevant grid entries with "junk data" (values in the 200+ range). When the game goes to generate the map, it loads the bigass module when it hits the first grid entry that references it, then when it hits the other parts of the grid that module covers, it doesn't load anything - it doesn't need to, as the bigass module already overlapped those areas.

 

Hangars are the one exception to this system.

 

Instead of being treated as a single 2x2 module, they're stored in four separate 1x1 modules. Each of these four modules gets stuffed into the grid in their correct locations, and when generating the map, they get loaded one at a time individually, instead of all at once.

 

Long story short, because of this, the game loads the battlescape map "correctly", and the hangars appear where ever they're supposed to according the base display view in the geoscape. But if they were any other 2x2 module, I'm not really sure what'd happen...

 

There's no funny overflows, either. The "grid" gets defined in "geodata.dat", and the next bit of information stored in that file dictates whether or not the route nodes should be loaded for each module. This data doesn't get corrupted like the launcher stores do.

 

SplitHangar1.png SplitHangar2.png

Link to comment
Share on other sites

Interesting. My CE test (years ago) must've had modules on the other side blocking my attempt. If it's in these two versions then it's most probably in the PSX version too. TFTD has corrected this bug.

 

You can also do it along the lower edge too. I can only imagine what other values will get altered when this is done.

 

edit:

 

Building the hangar in last row at columns 1 and 2 will net you 25 engineers and 25 scientists. Columns 3 and 4 affect Stingray launchers. Column 5 and 6 get you 6425 Avalanche launchers. Building right in the corner nets you 25 cannons, 6400 avalanche launchers and 25 engineers. Using columns 2, 3 and 4, 5 just give slight variations.

 

So you just need a free base slot and you can get all the free scientists, engineers and basic launchers that you want. Infinite money too. Oh dear.

 

- NKF

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...