I won't be finishing the random generator today but I thought I'd post you a little update anyway:
First of all, the xml object builder has a nice new feature. For any integer field, you can now define a range of numbers and you will get a random number. For example, the BasicZombie.xml file currently has the attribute <MaxHP>30</MaxHP>. After the next release, you can put it like this <MaxHP>30-40</MaxHP> and the zombie will have a random hp max of 30-40. This'll work with any integer on any object. Sadly the same exact effect applies to every object from that template so all of those zombies would have the same hp on that map. So actually this effect is mostly useful for objects you only need one copy from.
The random maps will be defined in xml files. Currenty the templates look like this:
<RandomMap>
<Class>RandomCityMap</Class>
<Height>128-255</Height>
<Width>128-255</Width>
<StreetTile>$World.CityStreetTile</StreetTile>
<WallTile>$World.CityWallTile</WallTile>
<FloorTile>$World.CityFloorTile</FloorTile>
<BlockSize>20-28</BlockSize>
<RandomFactorX>0</RandomFactorX>
<RandomFactorY>0</RandomFactorY>
</RandomMap>
The city map consists of blocks. A city map has its height and width defined in the file and the size of one block, also. The BlockSize field only determines the size of the building (or fence if the building has a yard) and if (when) the division has a remainder, random rows or columns of blocks will be made wider. There is a one-tile wide sidewalk around every building block and a two-tile wide road between blocks.
Cities will have a limited tileset that is defined completely in the xml file. It'll be fairly easy to refactor to something different later, if need be. So for now, we'll be working with a limited variety of tiles (though you can define which three you want).
The RandomFactor fields are used to add some variance to the amount and size of the blocks. For example, if you want a big city map, let's say 255 by 255 and a blocksize of 22-28, you will still be stuck with a fairly predictable map because the remainder can't be higher than 21-27. Thus, only 21-27 random blocks will receive +1 to their heights and/or widths (a block can receive the +1 more than once if it's "lucky) and the map will look quite homogenous.
The RandomFactor is a decimal number between 0 and 1 and will decrease the
amount of blocks on the map by a random percentage between 0 and its value. For example, if you put a RandomFactorX of 0.75, the amount of blocks (from left to right) will be reduced by 0-75% depending on random chance.
I'm estimating I'm about 33-50% done with the generator. The current state is that it will create the template object based on the xml file and constructs a table representing the size of every block. The next steps would be to 1) place the tiles on the grid that is used in the game map and 2) plug this whole generator in the current game.
What do you guys think?
Edit:
soundlust, you are also more than welcome to join and contribute if you want. There's a LOT still to be decided, we're just getting started