Return to Main
Player Starting Position
Filling the Map
No Touch Zones
The Root Path
Filling Solo Holes
Shops and Computers
Mines and Cupboards
Grates and Fire Hydrants
Fake Walls and Spinners
Outside a Base
Captive has been one of the most popular games of the 90s. Apart from the fact that it's a great 3-D action packed game, it's also popular because we can't say it really ends. Each base is generated by a new data generating and management system the programmer called "Architect" and works well enough to look as if it was man-made. Thanks to this, the game is still played today and still brings the same variety and complexity it always did.
But the question everyone wonders: how is it done?
In mid-september 2007, I decided to put my hands in the dirt and do my best to answer this question. I disassembled the map generation code and converted it to C++ (a language I'm more comfortable with). 6 weeks later, after many attempts to make it work correctly, I had a fully working map generator. Then came the task to understand it all and that took me about 2 weeks. During that time, I asked Antony Crowther if he allowed me to reveal the secret on the website and he granted me the permission. In fact, I've found his answer pretty funny; "It would be good to see how I did it, I must admit, I can't remember!"
Random without being randomThe map generation is said to be fully random, but still, a specific map will be the same on the Atari, Amiga and PC. The reason comes from a seed number calculated with this formula: ((Mission-1)*11)+Base. For example, map 17.3 would be ((17-1)*11)+3, giving a seed of 179. The map generator uses this number as an initial value for its random number generation subroutine. When asked to generate a random number, the subroutine will take the last number generated (initialized with the seed value), perform a serie of mathematical operations to change the value and finally store it back to be used for the next number generation. Since the mathematical operations are the same for all computer systems, the same values will always be generated thus giving the same maps.
The map as seen by CaptiveThe generation of the maps will be explained using screenshots of my SuperCC utility into which I integrated the map generator. If you have never used SuperCC or the PC's MapGen utility, you might not understand the screenshots and might require an explanation.
With the game allowing the player to move in 3 axes (east-west, north-south and up-down), it's easy to imagine a serie of individual floor maps layed one on top of the other. When changing floor level, the player is simply transported to the floor map located above or below him, depending on the direction. A Captive map is similar to this concept, except that the whole base is layed all flat as one single map with the floors separated by solid walls (see image below). When the player move up or down to change floor level, he is actually transported to a completely different region of that flatten map.
Technically speaking, the map is stored as an allocation of 2048 bytes in the computer's memory where each byte represent a single cell of the map (a flat map is 64 cells by 32 cells).
The map generationsThe maps are generated in 30 steps and I will attempt to explain each step as clear as I can. Having the code in front of me and having reverse-engineered about 90% of Captive's memory map, I'm aware that something clear to me might be confusing for those who don't have all this technical knowledge of the game. There are still some parts of the code that I don't understand, but I'd say about 98% is understood.
I've always been a fan of map 17.3 because it starts in a corridor out of encounter's way and it has pretty much everything a map can have. This is why I will use it to explain how a base is created.