Tiles in wrong locations in some parts of the map

SGDK only sub forum

Moderator: Stef

Post Reply
zEmnx
Newbie
Posts: 2
Joined: Sat Sep 25, 2021 7:58 pm

Tiles in wrong locations in some parts of the map

Post by zEmnx » Sat Oct 30, 2021 9:31 pm

this
Image

shoud look almost like this

Image

I not using any type of compression on the tileset and map, just optimisation on the tileset to save some VRAM.

i even made a build aside that just loads the map and scroll using the controller input, the results were the same.

here is the code

Code: Select all

#include <genesis.h>
#include "res/maps.h"

const u16 paletaInterna2[16] = { 0x0EEE, 0x0222, 0x0000, 0x0666, 0x0444, 0x0002, 0x0006, 0x0009, 0x0004, 0x0024, 0x026A, 0x0048, 0x0046, 0x0022, 0x0041, 0x0261 };
const u16 paletaExterna2[16] = { 0x0000, 0x0223, 0x0445, 0x0667, 0x0840, 0x0A60, 0x0CA2, 0x0EE0, 0x0021, 0x0040, 0x0260, 0x0281, 0x0003, 0x0025, 0x0047, 0x0268 };

int main()
{
    VDP_setPalette(PAL0, paletaInterna2);
    VDP_setPalette(PAL1, paletaExterna2);
    VDP_loadTileSet(&debug_tileset_B, TILE_USERINDEX, DMA);
    SYS_doVBlankProcess();
    DMA_setBufferSize(9600);
    Map* map = MAP_create(&debug_map_B_P1, BG_B, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, TILE_USERINDEX));
    u16 posX = 0, posY = 0;
    SYS_doVBlankProcess();
    while (1) {
        u16 value = JOY_readJoypad(JOY_1);
        if (value & BUTTON_UP) {
            posY-=3;
        }
        if (value & BUTTON_DOWN) {
            posY+=3;
        }
        if (value & BUTTON_RIGHT) {
            posX +=3;
        }
        if (value & BUTTON_LEFT) {
            posX -= 3;
        }
        MAP_scrollTo(map, posX, posY);
        SYS_doVBlankProcess();
    }
   
And here is how my res file is set

Code: Select all

TILESET debug_tileset_B "Maps/Debug Map/debugMap_B1.png" 0 ALL
MAP debug_map_B_P1 "Maps/Debug Map/debugMap_B1.png" debug_tileset_B 0

cloudstrifer
Very interested
Posts: 118
Joined: Mon Feb 19, 2018 7:31 pm

Re: Tiles in wrong locations in some parts of the map

Post by cloudstrifer » Mon Nov 01, 2021 1:57 pm

Try to change OPT ALL to NONE or 0.
TILESET debug_tileset_B "Maps/Debug Map/debugMap_B1.png" 0 0

I sugest you to create a copy of Sonic sample and modify it as you wish, maybe it helps.
SGDK folder > sample > sonic

zEmnx
Newbie
Posts: 2
Joined: Sat Sep 25, 2021 7:58 pm

Re: Tiles in wrong locations in some parts of the map

Post by zEmnx » Wed Nov 03, 2021 7:02 pm

Thanks for the reply, changing to 0 didn't helped, i end up creating a new map system from scratch to solve this.

Post Reply