Dark Empire Design Notes
I created a map generator algorithm in 1986. It was used in Dark Empire, and the Postal Games :Casus Belli, Warlord and Quest. I'd seen the original mainframe version of Empire in 1982 and always wanted a version for a home computer, so having left Choice Software in mid 86 (partners fell out) and offered a job in Manchester at Lothlorien (which I couldn't start for various reasons until 1987) I persuaded Lothlorien to send me a development computer and a Spectrum and started work on it. It took 8 months as I'd bummed around a bit, was running Casus Belli and only after I moved from N. Ireland to Manchester did the pressure come. "Oh and we want a cbm 64 version as well, by April".
By march the Speccy version was done. It had a map generator for 80 x 50 maps, hidden units, transports, battleships etc. Playtesting the ai was fun.
But it was a lot of code and I had a month to create the CBM 64 version. I pulled all the tricks I knew- mapping page 0 locations to Z80 registers, creating code to convert code like ld hl,[ix+4] into "mov y,ix" "add y,4" "mov l,y" "add y,1" "mov h,y" etc. I worked 7 all night stints, 3 consecutively at the end and finally drove across Manchester to Picadilly from Prestwich (having had no sleep) to put the master tape on a train at 6.30 am. Then I crashed for 24 hours. Fun days!
The biggest trick was squeezing all the data into the avbailable ram. Up to 255 units on each side, with x,y, type, strength, move, orders takes up a fair bit of ram. I was using one bit here, another there. Add to this a map with 4,000 locations, terrain+ visibility shroud, plus cities and it took up I think nearly 30Kb out of the available 40KB ram. That didn't leave a lot for graphics, char set, code. The Ai was certainly more challenging that Bulge or Johnny Reb II. It didn't cheat either. It could only see what it was supposed to see, ie things revealed as the map was explored and the shroud removed. I remember doing the Ai for loading transports- that was challenging!