Skip to main content

Tileset methods.

If you're making a game in 3d there are a number of ways to handle tilesets and tiles.
The easiest but least flexible is to handle each single tile as a tile and just place them with no regard for the adjacent tiles. Walls in this case are made of 1x1 pillars of wall material.

This is great, but it doesn't allow for very varied tile sets. It also leads to very repetitive, bland looking dungeons. You could make things a little more random by using multiple kinds of wall and floor tiles, randomly placed, or use an algorithm when placing them.

Here's a look at Eye of the beholder on the gameboy advance which uses that method, though it's actually 2d isometric, not 3d:

Very blocky tiles.

Another method is to use tiles which are bigger than 1x1. In the case of my first attempts, I used a 10x10 tileset. This allows some very interesting shaped rooms such as circles and some kinds of irregular tiles such as caves. We could call these prefabs or kits.

My first tileset for the game.

This requires a quite complex placement method. You have to check the tile type and then check the tile types of the four tiles to the north, east, south and west.

[[0,1],[1,0],[0,-1],[-1,0]]
You can use a search array like this.

Then you place parts of the tile which will mix or transition with those types. Combinations can be either transition (the two tiles are compatible floor tiles) doorway (maybe not actually a real doorway, but a special bridging transition) or wall (solid rock).


For example if the current tile you are placing is a floor tile, and the northern tile is a wall tile, you have to place the northern part of the tile with the following code:

north-floor-wall

We can name the objects like this:

NFW

This works really well and gives really nice transitions, but the way of splitting the tile, from the four corners in to an "X" shape means we need to have pillars of rock at each corner, unless the floor tiles fill the whole of the 10x10 space (not a good idea). It also makes any kind of naturalistic tile set very ugly. Here's an abandoned "cave" type tile set:



Notice the large open areas are broken up by the repeating "pillars" at the corner of each tile. This is the problem with this technique, it produces nice corridors but horrible open spaces.


Another method, which I'll be using from now on uses single tiles instead of a set of 4 split into north south east and west.

You can see that they look like the corners of the room, just 1/4 of a room like we used above, but actually they are full 4x4 sized rooms, but offset by 50% to the north east (it looks like the corner of a room because I've made the walls cover only 25% of the room instead of 50%). Instead of the 4 NESW tiles above, we need 16 for each type of feature, but we can cut this down a lot by using rules which disallow certain types of tile placement. For example note that doors can only be placed in the NESW part of the tile, not in the corner. It's not actually all that difficult to make all the variations, since most are just modifications of each other, either rotated or mirrored.

How does it work? Well, for each tile we take the current tile, and its neighbors in order:

Self, North, Northeast, East. 
[[0,0],[0,1],[1,1],[1,0]] 

This returns a string such as WWDF (Wall, Wall, Door, Floor). We can use this string to place a named tile.

The important thing though is that now we can have large rooms with no pillars. We can also have better textures, since they don't have to be tiled diagonally and don't have to match up on those unpleasant "X" edges.

We can still have nice transitions, and doors but now we can have large rooms, and more natural looking caves.

The final modeled and textured tileset will look far superior to the current one. I'm also revisiting my dungeon generation script to make it quicker to build compact, well filled maps, and to be more versatile when placing entrances, exits, locked doors, themed monsters, themed tilesets and other stuff. I'll be using BSP trees to delineate some "rooms" like a 12X12 square or a 5X10 rectangle, and then I'll place a pregenerated "room array" in that space.

The pregenerated arrays will be drawn by hand using the helper utility you can see in the last picture above (with the blue wall tiles and yellow floor tiles). Then they will be saved in to a dictionary. The arrays can be flipped or rotated by 90 degree increments. There will be a lot of them so you're unlikely to run in to the same one too many times. They can include groups of rooms, prison cell layouts, underground churches or temples, mazes and labyrinths and all sorts of different kinds of areas. I'll also be able to mark tiles as stairs up/ down, or other features such as dining rooms or libraries. Later I'll add code for placing specific monsters, NPCs, treasure or furniture on different squares. Maybe even cut scene cues, special event triggers or at least message log generators. This will also allow me to make some special areas such as boss fights, treasure rooms, trapped mazes and even puzzles eventually.

This means the end result will be a mix of random, procedurally generated content and designed areas. Some parts will be simple rooms with themed monster or furniture spawns:

You enter a room, there are two doors on the far wall. A line of pillars run down the center of the room. A pit is in the corner. There are several cocoons hanging from the ceiling,  a pile of spider eggs pulsates on top of a large rock. Three giant spiders peer at you from the darkness.

Other areas may be more complex:

There is an altar in the central room. Other rooms split off from this one to the North, South and East. As soon as you enter, the door slams shut behind you. There is an evil priest at the altar and several cultists around him. There are a couple of levers near the altar jutting from the floor. A woman is chained to the altar, she look like the daughter of the innkeeper who you are searching for. A big pentagram is inked on the floor, within the pentagram a dark shape writhes, half summoned.

Anyway, that's all for the future. For now it'll just be plain room arrays that will have "feature" tiles which can spawn mobs of monster or arrays of furniture.

Comments

Popular posts from this blog

Make your game models POP with fake rim lighting.

I was watching one of my son's cartoons today and I noticed they models were using serious amounts of simulated rim lighting. Even though it wasn't a dark scene where you'd usually see such an effect, the result was actually quite effective.



The white edge highlighting and ambient occluded creases give a kind of high contrast that is similar to, but different from traditional comic book ink work.


I'll be honest, I don't know if there's a specific term for this effect in 3d design, since my major at university was in traditional art. I learned it as part of photography.


You can find plenty of tutorials on "what is rim lighting" for photography. It basically means putting your main sources of light behind your subject so that they are lit around the edges. It can produce very arresting photographs, either with an obvious effect when used on a dark subject...


..,or as part of a fully lit scene to add some subtle highlights. See how alive the subject look…

How to... build a strong art concept.

So you want to make some art assets for your game. The first on the list is a Steampunk Revolver for your main character to shoot up Cthulhu with. Quickly opening your internet browser you start with a Google image search. Ah, there is is!

It might be a good idea to find a few influences so you don't accidentally end up copying a famous design.


Just mash them up and you're ready to go! Off to your favorite modeling program.
But wait! isn't there more to building a strong design concept than that?

Of course there is.
One of the diseases of modern design is that of recursion. Everything is a copy of a copy of a copy. This is especially a problem with "historical" concepts. Over the course of that recursive process the concept becomes infected with modern design elements, and ends up looking very similar to everything else that anyone else has ever made.
If you want to come up with a really fresh idea, you have to get beyond secondary references and go look at real …

Rockets

I finished working on the code for adding foliage and having some extra time I decided to experiment with the code for rockets.

The original idea I had was that rockets would be large vehicle components that can be fired very quickly, regardless of how much manpower is used for reloading.






They would use up a lot of ammo, so they would run dry after a short but devastating barrage.
The problem here is that it's easy to take advantage of this by adding a lot of ammo, which is much smaller than in bulk than the rockets.

There's also the problem of firing large caliber rockets. In real life rockets of up to 30cm were used, but I think that will be too powerful for the scale of combat in this game.



lol. Somehow that one trooper survived the mother of all explosions...

A 30cm rocket could contain nearly 30KG of explosive. That would be a very large explosion.

I've tried to balance the game by using a simple equation to make bigger guns more powerful, but hopefully not too powerf…