We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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
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
orString
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