Tilengine - The 2D retro graphics engine forum

Full Version: [Issue?] Two tilesets, one palette?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hi,
I did this code : 
Code:
#include "includes/Tilengine.h"
#include <stdio.h>

int main()
{
    TLN_Tilemap tilemap = TLN_LoadTilemap("assets/floor/floor-tilemap.tmx", "floor");
    TLN_Init (400, 240, 1, 0, 0);
    TLN_SetLayerTilemap (0, tilemap);

    TLN_CreateWindow (NULL, 0);
    while (TLN_ProcessWindow()) {
        TLN_DrawFrame (0);
    }
    return 0;
}

Or the simplest Tilengine exemple you can do.

The tilemap uses 2 tilesets, each has its PNG file. But seems both tilesets use the same palette from the first tileset instead of each tileset having its own palette. Is it normal? Did I forgot to do something? Thanks for your answer!
Also please note my PNGs use indexed colors, and I also use Tilengine v2.11.3 64-bit and Tiled 1.9.2.
Hi!
You are loading the tilemap before initialising the tileset, that may cause problems. TLN_Init() should go first.
(10-29-2022, 01:46 AM)megamarc Wrote: [ -> ]Hi!
You are loading the tilemap before initialising the tileset, that may cause problems. TLN_Init() should go first.

So I need to initialise the Tilesets before the tilemap? I thought tilesets were automatically initialized while loading a tilemap
No, you need to initialise the engine with TLN_Init() before anything else. You're loading a tilemap before initialising the engine.
(10-29-2022, 08:38 AM)megamarc Wrote: [ -> ]No, you need to initialise the engine with TLN_Init() before anything else. You're loading a tilemap before initialising the engine.

I fixed that, but I still have the issue.
In that case, I need to test it with the same assets you're using. With my test assets, it woks as expected. Can you upload them here?
(10-29-2022, 07:21 PM)megamarc Wrote: [ -> ]In that case, I need to test it with the same assets you're using. With my test assets, it woks as expected. Can you upload them here?

Here are my assets with my source code.[attachment=234]
(10-29-2022, 08:12 PM)System64 Wrote: [ -> ]
(10-29-2022, 07:21 PM)megamarc Wrote: [ -> ]In that case, I need to test it with the same assets you're using. With my test assets, it woks as expected. Can you upload them here?

Here are my assets with my source code.

Okay so I made a more advanced exemple, with actual tilesets, but the colors are off (in fact, every tileset seems to use the palette of the first loaded tileset).
Hi,
I've run your test assets with Tilengine 2.11.3, and I get expected results.
This is Tiled wiew:
[attachment=236]
And this is Tilengine window result:
[attachment=237]
What do you see in your output? Are you using latest release of Tilengine. Multi-palette issue was fixed in las github commit
(10-30-2022, 04:44 PM)megamarc Wrote: [ -> ]Hi,
I've run your test assets with Tilengine 2.11.3, and I get expected results.
This is Tiled wiew:

And this is Tilengine window result:

What do you see in your output? Are you using latest release of Tilengine. Multi-palette issue was fixed in las github commit

Hi, this is the output I got. You can see I'm using Tilengine 2.11.3 in the console (I am on Windows)
Pages: 1 2 3 4