Sign in to follow this  
  • entries
  • comments
  • views

Random Levels Pt.2

Sign in to follow this  
Sir Sapo


Hey everyone!

I've got more random level goodness for you guys today, along with a screeny of a random room from the generator!

The Plan
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.

Catalogs Pt.II
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
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!
Sign in to follow this  


Recommended Comments

Very cool project, Sapo. My current game is also heavily reliant on random level generation, so it will be interesting to see how things continue to develop. [smile]

Share this comment

Link to comment
That's really impressive. Props to mark for the awesome art.

That pathfinding screenshot looks kinda funny. It appears to be tracing from one random spot to another.

Got a list of weapons you plan on having? How about stuff that isn't really a "gun" like grenades or even grenade launchers? Also, is ammo going to be handled in a clip format where you have, say, 30 rounds for a clip? Or will it be more like Quake 3 where you have all your ammo available with no reloads?

One thing I'd like to see is a switchable-ammunition system like in Crysis and a couple other games where you've got multiple types of ammo for each gun. I don't think it would take a whole lot of extra coding effort to make this work, if you plan for it from the start.

Again, props to you and mark for everything, it looks impressive already.

Share this comment

Link to comment
@Hopedagger - Well, if you ever need someone to bounce ideas off of, feel free to PM me or something!

@Dragon88 - In the pathfinding screen the algorithm was finding a path from where that line starts in the top left corner, to where it stops at the bottom right.

We do have a tentative list of weapons we want to include, but we're trying to keep the number of weapons down to around 5. We're going to have the traditional set (pistol, assault rifle, shotgun, etc), but we're trying to add our own twists on the tried and true weapons.

I haven't really thought about how ammunition is going to work, but I would wager on us having a "clip" based system, where you have to reload, but thats subject to change.

About the different ammo types, while we aren't planning on having different ammo types for each gun, each weapon is going to have an "alt fire", and we're going to try and make those as unique and cool as possible.

Thanks for the comments guys!

Share this comment

Link to comment
Oh, to answer the question you actually asked, I think that multiple maps with bosses at the end of each would be the way to go. Give it that kinda oldschool feel.

Share this comment

Link to comment

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