• 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

Data Struct for 2D map with barracades

2 posts in this topic

So gennerally for 2d tile maps a tile is either passable or impassible...  so an actor can move to any passable adjacent tile.


I am looking for a good way to decouple the passablity of a cell from the traversal to/from the cell.


Which do you suppose is the best way?


1) Each tile contains a value indicating if the passage to the right and bottom tiles are valid. 

    Pro: Requires very little modification to a standard 2d array implementation

    Con: Checking for passage works on different cells depending on direction of travel... i.e to travel right or down you check your current tile, but travel up or left requires checking the destination tile.


2) Each tile contains a value indicating the passage to adjacent tiles

    Pro: Can still be implemented using a standard 2d array implementation

    Con: Disabling travel between two tiles requires setting a value on both the tiles (semi-redundant data... semi b/c you could  implement 1 way passages, etc).


 3) Use a separate array for tile data and traversal data... in the tile array the data describes the tile, in the separate array the data represents the "wall" between two cells.

    Pro: No data redundancy, consistent mapping

    Con: Requires entirely new map structure with more complex mapping, look up functions...


4) Awesome method that I haven't thought of... pro: It may be awesome, con: I didn't think of it yet... 


Share this post

Link to post
Share on other sites

This smells like some premature optimization:  http://c2.com/cgi/wiki?PrematureOptimization


Any one of these will work.  Pick the one that requires the least amount of effort on your part and the one that seems like it will be the easiest to understand in six months if you really do need to optimize this.  Don't worry about the "right" way, because you may not know what that is.


Is the right way:


1.  The algorithm that runs the fastest for all the AI you're doing because the iPad version is now too slow?

2.  The algorithm that is the easiest because this code isn't called that often but seems the source of all kinds of bugs?

3.  The algorithm that uses the least amount of data so that the levels (which have gotten too big) can be brought down in size?


I would go with solution 5)  Do the most simple, inefficient thing you can and move on until there is a need to fix the code.  You'll be glad you kept it simple. 

Edited by Glass_Knife

Share this post

Link to post
Share on other sites

Another point to add to what Glass_Knife is saying, is that you may discover the need for things you haven't thought of yet, and if that does not fit with the structure you decided today, you may have to change things further down the road anyway.


If you still want another idea, I just thought of something else just now.  If you instead of putting the data itself in a map array, you could put pointers to some class or struct or whatever you prefer, and you will have something that is easy to extend in the future.  (That is not light-weight though.)


There is no given answer, however...

Edited by aregee

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