megamarc / Tilengine

Free 2D graphics engine with raster effects for retro/classic style game development
https://www.tilengine.org
Mozilla Public License 2.0
847 stars 95 forks source link

Map making guide #67

Open IoriBranford opened 4 years ago

IoriBranford commented 4 years ago

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

megamarc commented 4 years ago

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.

IoriBranford commented 4 years ago

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

megamarc commented 4 years ago

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

megamarc commented 4 years ago

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

GithubPrankster commented 4 years ago

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.

megamarc commented 4 years ago

@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