I've got more random level goodness for you guys today, along with a screeny of a random room from the generator!
I have the whole development cycle for FoT pretty well planned out right now(we'll see how long I stick to schedule[wink]), and unfortunately, the order I plan on implementing stuff in makes a playable demo out of the question for a little while. The plan at this moment goes like this:
1. Random Room Generator complete
2. Level Layout Generator complete
3. Map system complete (ie. Rooms linked together)
4. Doors, Keys, and Switches complete
5. Player implemented
6. Powerups and Weapons implemented
7. Simple Enemies (stuff with little A.I., like zombies)
8. Smart Enemies (stuff with smart A.I, like.... you'll see[wink])
9. Front End and UI Complete
10. Super Secret Feature Implemented (seriously, its gonna be awesome)
Hopefully by following this "Don't move on until its done" schedule, all the features in the game will be complete and will mesh together nicely when the game is completed.
Today I realized that the catalog system I implemented yesterday needed to be revamped to include a few features that I overlooked. First of all, there was no way for the generator to distinguish wall tiles from decorative tiles, which poses a problem, as you don't want desks and lamps to be making up the walls of your fortress. In order to remedy the situation, I implemented different categories of tiles in the catalogs, so now the tiles are placed in either the "Floortile", "WallTile", or "MiscTile" categories, so the generator can look in the "WallTile" section when building the boundaries of the room, then look at the other categories when filling it out. So far, the system works great, so chalk one up for thinking ahead[grin]
Tile Batches are essentially a way for the generator to know that certain tiles fit together, such as a 3 tile wide desk. Every single Tile object in the game has a batch ID attached to it. Most tiles don't use batches however, and their batch ID is set to -1. When the generator chooses a tile to place on the map, it first looks to see if it has a valid batch ID. If it does, it then looks up the layout of the batch, and places the other tiles that belong with the chosen one in the right places. Unfortunately, the game doesn't automatically know what tiles go with batches, so every single batch has to be declared by hand, which kinda sucks.
As Dragon88 pointed out in my last entry, it would really suck if the generator made levels where the exit door was blocked by a pillar, a river of spilled acid or something like that. Luckily, there are a few safeguards I've built into the generator that should prevent this from ever happening.
A* Pathfinding - This just runs a simple A* routine from the entrance to the room, to all the exit doors, to make sure that a suitable path actually exists to the exit. If the pathfinder fails, then the room is discarded, and another one is randomly created and tested again. More on the A* later.
Tile Radii - Every tile has a certain radius that must be clear of other impassable tiles in order for the new tile to be placed there. Since all the exit doors are placed adjacent to walls, all the really big tile batches won't be able to be placed their because it wont have enough space to fulfill its radius requirements.
"One Tile Barrier" - This one is pretty simple. All it does is make sure that no impassable tiles can be placed right next to the walls bordering the level.
A Lack of... Stuff
Well, Mark is out of town until next Sunday, which kinda sucks because the only good artwork I have from him was done over a 2 day period before he left, so it is obviously limited. He did manage to crank out a few floor tiles, some walls, and a pretty cool desk thing before he left though. As you can see in the screeny below, the art looks pretty good, there just isn't much of it yet.
As you can see, its still lacking quite a few key elements, such as doors, more objects, and proper corner tiles.
More on A*
Today marks a landmark achievement for me, I got my first successful A* implementation working. I've tried before, and failed pretty consistently, because of a lack of persistence, but in order for the whole random aspect of FoT to come to fruition, some form of pathfinding was required to pre-test all the random rooms. So today I went to the Articles section of GDNet, read up of A* theory, and then got to coding. A few hours later, I had a completely functional A* algorithm!! This is good news, because it means that the smarter enemies of the game should be able to at least find their ways around the room to try and kill you in the most efficient manner. You can see a screeny below of the algorithm finding a path through a random room:
Map Layout Refinements
After a few refinements to the prototype map generator, it started cranking out huge levels that look pretty cool, heres an example:
This brings up an interesting topic that Mark and I have been debating, whether or not the game should take place on one gigantic map, or split up between a couple smaller ones? What do you guys think?
Well, thats all for now. Let us know if you guys have any questions or suggestions, comments are always welcome[grin] Peace Out!