Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Organising large tilemaps  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

maoam

  • Newbie
  • *
  • Posts: 3
    • View Profile
Organising large tilemaps
« on: May 27, 2012, 01:08:06 am »
Hi, I've been having a problem on organising a tile based game

Lets say I load a tilesheet with around 10 tiles, then I use subrect to separate this tilesheet into separate tiles, which will be numbered from 1 to 10.

For small maps I create a two-dimensional array, where each element of the array can have a number from one to ten which represents a particular tile; it is then easy to draw a small map as the number of elements in this array is small and I can just fill in this array manually with a number from 1-10 that I choose.

For large maps (large multid-array), is there an easy/automatic way of getting the numbers that would be stored into this array using the same tilesheet as above? I was thinking of using a tilemap editor, but I dont really understand what it exports, does it export a list of numbers/labels that can correspond to the same tilesheet that I mentioned above?

sknnywhiteman

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Email
Re: Organising large tilemaps
« Reply #1 on: May 28, 2012, 02:11:24 am »
Well, You have a few different options. I'll give you what I'm doing, and then you can branch off of that how you feel is necessary.

I'm writing a tile map game, and I intend for the world to be very large. I currently divided the world into chunks of 8 tiles x 8 tiles. Each tile is 32x32. So, I have an 8x8 tile chunk. I have a simple Tile tilemap[100][100] variable. 100 chunks by 100 chunks, which makes 256, 000  different tiles in my game all together. This is a big number, but I think it's small for my taste. In my init() function, I loop through with for() loops, and for every single tile, I do some weird simple math that gives me a tile number from what my range is (1-5 right now, but I'll add more later). For me, this gives me a very simple tile map that I can walk around on and test things for development purposes. Later on, I plan on actually writing a world generator that will give me a large map, maybe even infinite if I plan on letting it go on for as long as it can. I'm not particularly worried about it right now, as my game is still relatively new, and I don't want to work on higher level things until I actually get other things done first that are more important.

Long story short, I guess I see that you have 2 options, unless someone else has another way..
-Write your own level editor for a tile map that lets you choose how the world will look and let you add things to it, this way you don't have to worry about other tile map editors and how they save/load things, and you can fit yours to how your game will use it and optimize it.
-Do some funky math stuff like me, ;) and then make level editor or world generator later on when it's more necessary in your game.

It all pretty much depends on how far you are in your development process, and what you want your game to look like as the end product. If you plan on making something like an MMORPG tile map game, you might want to have a world generator. If you want a strict world like Pokemon, then you want a tilemap world editor.

These are just my thoughts, (sorry for the word wall) but if anyone else disagrees with anything I've stated above, feel free to share your ideas! I'm willing to share my thoughts, and maybe you'll change how I'm going to write my game! :D