Map Generating

edited March 2018 in Library Questions

Hi, I'm working on a game that needs a basic background "map". Roads and trees. (The game has an upper view). What do you think is the best approach for this? Is it using libraries? (Which ones?) Or is it implementing everything on our own?

Thank you in advance, Incognito

Tagged:

Answers

  • There are a number of ways to do this. You could just generate a random 2D array and fill it with values that represent different types of map tiles.

    The best thing you can do is break your problem down into smaller steps and then take those steps on one at a time. Can you generate a random 2D array of boolean values that represent open vs blocked tiles?

    Work your way forward from there. Can you generate a 2D array that contains 3 different int or String values, where each value represents a different type of tile?

    Then keep working forward in small steps. Maybe instead of completely random, you generate tiles with a pattern rivers flow in lines, forests are grouped together, that kind of thing.

    Then if you get stuck, you can post a MCVE along with a more specific question. Good luck!

  • there is a tile library in the libraries section if you search. it requires a .tmx file though, and that seems a bit obtuse (not least because there are two different tmx file formats, which are unrelated)

  • my usual technique is to define any maps using a tiny png file where every pixel is a different tile, the colour denoting the tile type.

  • here is another example with a text file you load and which contains the map data

    https://forum.processing.org/two/discussion/comment/117413/#Comment_117413

Sign In or Register to comment.