TILE MAP installation

Development

MicroGames

6 years ago

Hello,

I just wan't to know is how to setup and use tilemap editor and it's commands.

(If maps in SUPER CRATE BUINO  and MARIUINO weren't made using tile map editor than... How they where made? :D) 

Aurélien Rodot

NEW 6 years ago

I used no tools, quick & dirty.

I made the maps in Super Crate Buino by directly writing the arrays. The tiles are either ON or OFF, so 1 bit per tile:

//maps are encoded like bitmaps
const byte map0[] PROGMEM = {
16, 10,
B11111110, B01111111,
B10000000, B00000001,
B10000000, B00000001,
B10001111, B11110001,
B10000000, B00000001,
B10000000, B00000001,
B11111100, B00111111,
B10000000, B00000001,
B10000000, B00000001,
B10011111, B11111001,
};

I did the same for UFO race, but you can have 16 different tiles. you can directly "read" the map in the array.

// array containing the different sprites
#define NUM_SPRITES 16
const byte* sprites[NUM_SPRITES] = {
road,              //0
power_right,       //1
power_down,        //2
power_left,        //3
power_up,          //4
sand,              //5
ice,               //6
start,             //7
block_bouncer,     //8
block_single,      //9
block_right,       //A
block_down,        //B
block_left,        //C
block_up,          //D
block_horizontal,  //E
block_vertical     //F
};


#define WORLD_W 32
#define WORLD_H 32
const byte world[WORLD_W*WORLD_H/2] PROGMEM = {
0xDC,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xAD,
0xF0,0x01,0x71,0x00,0x00,0x00,0x00,0xD0,0x00,0x00,0x0D,0xD0,0x00,0x00,0x05,0x5F,
0xF0,0x0C,0xEE,0xEE,0xEE,0xEA,0x00,0xF0,0x0D,0x00,0x0F,0xF0,0x00,0x00,0x00,0x5F,
0xF0,0x00,0xD5,0x55,0x00,0x5D,0x00,0xF0,0x0F,0xD0,0x0F,0xF0,0x0D,0x50,0x00,0x0F,
0xF0,0x80,0xF5,0x00,0x00,0x0F,0x00,0xF0,0x0F,0xF0,0x0F,0xF0,0x0F,0xCA,0x80,0x0F,
0xF0,0x00,0xF0,0x00,0xD0,0x0B,0x00,0xF0,0x4F,0xF0,0x0F,0xF0,0x0F,0x55,0x00,0x0F,
0xF0,0x80,0xF0,0xD0,0xF5,0x00,0x05,0xF4,0x4F,0xF0,0x0B,0xB0,0x0F,0x50,0x00,0x5F,
0xF0,0x00,0xF0,0xB0,0xF5,0x55,0x55,0xF4,0x6F,0xF0,0x00,0x00,0x0F,0x00,0x00,0x5F,
0xF0,0x80,0xF0,0x00,0xBC,0xEE,0xEA,0xB6,0x6F,0xF0,0x00,0x00,0x0F,0x00,0x8C,0xAF,
0xF0,0x00,0xF5,0x00,0x00,0x00,0x66,0x66,0x6F,0xBC,0xEE,0xEE,0xAF,0x50,0x00,0x5F,
0xF0,0x40,0xB5,0x55,0x00,0x06,0x66,0x66,0x6F,0x00,0x00,0x00,0x0B,0x55,0x00,0x0F,
0xF5,0x00,0x0C,0xEE,0xEE,0xEE,0xEE,0xEE,0xAB,0x00,0x00,0x00,0xCE,0xEA,0x00,0x0F,
0xF5,0x50,0x00,0xCE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEA,0x00,0x5F,
0xF5,0x55,0x00,0x00,0x00,0x00,0x55,0xCE,0xEA,0x55,0x08,0x88,0x88,0x00,0x00,0x5F,
0xF5,0x55,0x50,0x00,0x00,0x00,0x00,0x03,0x30,0x00,0x00,0x00,0x00,0x00,0x05,0x5F,
0xBC,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xA8,0x88,0x88,0xCE,0xEE,0xAB,
};

MicroGames

NEW 6 years ago

Wow. I am really impressed by the work you did.

Sorunome

NEW 6 years ago

If you have some trouble visualizing how the final tilemap would look like, you could use something like the Tiled Map Editor to help you visualize that. I am not sure if/where/to which extend converters of the tiled format to a C++ bytearray exist, though.

wuuff

6 years ago

I have a few projects that I haven't finished that use Tiled. I export the map to json, then parse the json with a python script I wrote. The output of the script is a C/C++ array.


If anybody wants the script, I can post it somewhere if they would find it useful.

wuuff

NEW 6 years ago

Sorunome Sorunome

I have a few projects that I haven't finished that use Tiled. I export the map to json, then parse the json with a python script I wrote. The output of the script is a C/C++ array.


If anybody wants the script, I can post it somewhere if they would find it useful.

Aurélien Rodot

6 years ago

That would be a pretty cool Tutorial you could make!

MicroGames

NEW 6 years ago

Yea,
Thanks. And the tilemap editor I was talking about came from the old gamebuino forum. There was a topic called „tilemap” and it showed a editor allowing You to create Maps for gamebuino games. They showed how to install it but it never worked.


Aurélien Rodot

NEW 6 years ago

wuuff wuuff

That would be a pretty cool Tutorial you could make!

MicroGames

NEW 6 years ago

If I find a way to let this work.... The old tutorial had something saying to copy what to where but it didn't work. But maybe... :D

wuuff

NEW 6 years ago

Although these other tilemap solutions already exist, I might post something about my approach later, since it's fairly general and can be adapted for various uses, such as converting the tilemap to a binary format for data on the SD card.


I think a tilemapping framework could be useful for general cases, but it can't be as customizable as implementing just what's needed for each use case. I have a project I'm working on for the legacy Gamebuino right now that uses a map I convert from Tiled, but I compress it first. That's why I think it might be more educational to discuss tilemap techniques in a tutorial rather than just provide a library.


I might do a more general tutorial on tilemaps after I finish this project depending on whether it seems as if anybody would want that.