megamarc/Tilengine

Map making guide

Opened this issue · 6 comments

There could be a guide or spec document on how to make maps and tilesets that will work, noting things like:

  • Map file and its tileset files all must be in the root of the load path (files can't be loaded from a subdirectory of the load path).
  • Tileset image is 8-bit index color
  • Tile size is power-of-2
  • Any hardcoded memory limitations - I got "out of memory" and crashes loading a map with either too many layers or too many tilesets, not sure which, but there was still plenty of system memory left. (I haven't had time to investigate this in depth.)

Yes, this is related to the "Guide" documentation section, that is mostly incomplete and needs writing. Some of the limitations are stated on the respective "Reference" section for the API calls (tileset section, bitmap section...)

Since release 2.6.0 pixel image files are not restricted to 8bpp pixel format, but instead to up to unique 255 colors (they're converted to indexed color at load time).

I'm curios about the datasets you're using to make the loader crash, no one complaied about this until now. With them I could fix the loader.

Here is the map that crashes with "Not enough memory".
crashexample.zip
Extract into the samples folder.

The problem was an unchecked limit of 16 layers per tmx file that was causing overflow. Your map has 37 layers, never seen that. Now the limit is 64 and is tested against overflow. The example shows the background plane scrolling upwards

Hi!
The map you sent me is very interesting. I've seen some unexpected things that gave me a lot of ideas to make advance Tilengine in ways I hadn't think about before. I'm already working on them

I had difficulty with using more than 2 layers lately as well. The second one loaded from the map would often not load at all, even with a lot of fiddling. The idea was to have it be above the character, therefore occluding them, and combined with collision detection, giving the sense of being behind stuff well. However as well as not having support for collision objects from the tileset prevents more fine collision types. At best I'd need to import directly the file using a TMX C library, search for the collision objects such as rectangles, then implement myself all that.

@GithubPrankster
May I ask you to post your question in the support forum? It's an interesting one, but it's really about how to implement a gameplay related feature, not a bug or feature request. I think what you want should be doable in Tilengine, providing your assets and source.

Example "crashexample.zip" provided by @IoriBranford now loads and displays properly in release 2.8.0