• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Koobazaur

Top-down 2d Tile game - how to generate wall tiles?

10 posts in this topic

I am working on a simple 2D top down tile based game where a tile is either "floor" or "wall." A good example of what I want is the oldschool Alien Assault:

 

[url=http://smg.photobucket.com/user/Koobazaur/media/AlienAssault2_zps88115aa9.jpg.html]AlienAssault2_zps88115aa9.jpg[/URL]

 

 

Now my question is - how do I create the wall tiles? If I was just to hand-draw these then it would mean 256 different wall tiles (since each tile is surrounded by 8 tiles that can be wall or floor, so 2^8 = 256). Even if I do some mirroring/rotating, it's still seems like an annoying amount of tiles (especially laying those out onto a tilesheet to fit some auto-matching algorithm).

 

Is there a better way of doing this, or is that pretty much how most 2D games do it?

 

One other idea I had was to (just for rendering) subdivide each tile into 4 and treat each corner separately. Since you always know the corner will have at least two surrounding walls you only need 4 variants per each corner, meaning 16 images total:

 

[url=http://smg.photobucket.com/user/Koobazaur/media/2dtilesv2_zps58e0b107.jpg.html]2dtilesv2_zps58e0b107.jpg[/URL]

 

 

Looking at RPG maker tilesets I am guessing this is how they do walls, as all you need is this:

 

rpgmaker_tiles_zps8aff56ef.jpg

 

To create something like this:

 

[url=http://smg.photobucket.com/user/Koobazaur/media/dungeon_test_1_by_nicnubill-d6pzrmn_zps45f93c46.png.html]dungeon_test_1_by_nicnubill-d6pzrmn_zps4[/URL]

 

The only CON here is that, since the walls would be using a lot more smaller pieces, they could get easily very repetitive, unless I introduce few variants for each of the pieces and randomize it?

 

Any input from the more experienced is appreciated. 

 

(also, I did try searching but oddly having a hard time finding tutorials for this topic. Ho hum!)\

 

EDIT: actually here is a the RPGMaker autotile explanation, which is basically what I jsut figured out above lol: http://blog.rpgmakerweb.com/tutorials/anatomy-of-an-autotile/

Edited by Koobazaur
0

Share this post


Link to post
Share on other sites

each tile is surrounded by 8 tiles that can be wall or floor

 

That's the number of directions, not the number of required tiles. I think there are only about 20-30 basic tiles, something based on your approach below that. The primary tile size is the size of a bare floor without walls. The walls are separate from the floor and are rendered adjacent to floor tiles. There's a bare floor tile, north/south/east/west walls, corner tiles for NE/SW/SE/NW outside corners, and NE/SW/SE/NW inside corners. Looks like the wall and corner tiles are half- or quarter-size, and you need quarter-size wall tiles for the other half of inside corner tiles. If you flip wall tiles horizontally and vertically (just tex coord changes) you can get away with a floor tile, an inside corner, an outside corner and a half-wall tile.

 

There are some wall tiles with semi-circles and maybe a door tile? There's also what appears to be some sort of pattern laid over the top of some sections (the floor area where the green guys are near the top), possibly an alpha texture.

Edited by Buckeye
1

Share this post


Link to post
Share on other sites
According to Servant's breakdown, the basic tiles are: 1 floor tile, 8 surrounding wall tiles and 4 inside corner tiles. Add more as needed for variation.

Also note that those tiles are using pseudo-perspective.
0

Share this post


Link to post
Share on other sites

Thanks for the responses. 

 

Yea the tiles used in my example seem a bit simplified with some restrictions (like not having very narrow walls). But if you wanted to have no restrictions and wanted to cover every possibility, then you need to account for potential wall-or-floor on any of the 8 adjacent tiles (otherwise it would not "link" correctly and you'd get artifacts). And since which means 2^8 possibilities. Or maybe my math-fu is failing me? H

 

The problem becomes more pronounced with more tight environments (i.e. rooms/corridors with lots of turns separated by just one or two walls max). Like here:

 

complex-tiles_zps18c769d8.jpg

 

Merely "corner in + corner out + wall" wouldn't cut it. I do realize a lot of those are rotated/flipped versions but I am talking about the actual # of tiles required without mirroring/rotating/layering.

 

Wouldn't mirroring/rotating/layering lead to potential glitches? You can't flip/rotate if unless your walls are symmetrical. And you can't layer some combinations, like side walls that would intersect as that would make them not connect properly. 

 

Hmm I think I will go with the Autotile solution from RPG gamer for now, as it seems to be the most dynamic. 

Edited by Koobazaur
0

Share this post


Link to post
Share on other sites

Can't you make the graphical tiles smaller? That's what I did in a tile-based 3D game I was working on, all tiles were actually constructed from 4 different pieces.

0

Share this post


Link to post
Share on other sites

Thanks for the responses. 
 
Yea the tiles used in my example seem a bit simplified with some restrictions (like not having very narrow walls). But if you wanted to have no restrictions and wanted to cover every possibility, then you need to account for potential wall-or-floor on any of the 8 adjacent tiles (otherwise it would not "link" correctly and you'd get artifacts). And since which means 2^8 possibilities. Or maybe my math-fu is failing me? H
 
The problem becomes more pronounced with more tight environments (i.e. rooms/corridors with lots of turns separated by just one or two walls max). Like here:
 
complex-tiles_zps18c769d8.jpg
 
Merely "corner in + corner out + wall" wouldn't cut it. I do realize a lot of those are rotated/flipped versions but I am talking about the actual # of tiles required without mirroring/rotating/layering.
 
Wouldn't mirroring/rotating/layering lead to potential glitches? You can't flip/rotate if unless your walls are symmetrical. And you can't layer some combinations, like side walls that would intersect as that would make them not connect properly. 
 
Hmm I think I will go with the Autotile solution from RPG gamer for now, as it seems to be the most dynamic.


One rather simple option is to just use multiple tiles per grid position, that way you only need 2 basic wall tiles(wall/corner) and can rotate and layer them on top of eachother for grid positions with multiple walls. Edited by SimonForsman
0

Share this post


Link to post
Share on other sites

Your basic pieces, which can be assembled on a transparent background to make the required 256 exterior tiles, are: 4 corners with no adjacent edges (the round ones in the mockup), 8 corners with one edge, 4 corners with two edges. (There's also the empty corner, with no graphics.)

Assembly can take place dynamically on a half-step grid (where tile corners are 1 corner, two side midpoints and one center of an original grid space).

Depending on your style, the 16 corner graphics can be collapsed to only 3 (not shaded) or at least used as a reference for each other. Adding variations doesn't seem out of the question.

0

Share this post


Link to post
Share on other sites

You should have told us what language or program you was using before asking this question. Congratz on figuring it out thought.

-1

Share this post


Link to post
Share on other sites

Seeing your screenshot, I sense that you should separate the model of your level from the rendering :

 

The model is a matrix of cells that are "floor" and "empty" and match the red grid on your screenshot. We don't need walls in this model : the player can go to a neighbour cell (8 direction) only if this neighbour cell is "floor".

 

On the other hand, the rendering of your maze use a smaller grid so that it can use a tileset like the one you found. Here I would say that one cell is drawn using 4 tiles. The tiles array is preprocessed to compute where to put a wall.

0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0