agbrs / agb

Library for writing Game Boy Advance games in Rust
https://agbrs.dev/
Mozilla Public License 2.0
319 stars 27 forks source link

Affine tilemaps show gaps #733

Closed kouta-kun closed 4 months ago

kouta-kun commented 4 months ago

At least in mGBA, affine tilemaps leave a gap between each tile as they are being set with a "tile setting" of 0 which goes unused in affine backgrounds. This can be reproduced with the "affine_background.rs" example.

In mGBA debugger: image Notice how there is a gap between tiles in the map view.

This can be fixed by applying the following patch to display/tiled/map.rs, however it is sort of a kludge and a restructuring of the TiledMap might be a better solution. https://github.com/kouta-kun/agb/commit/cf2b8be6e0535b269b1fa5fa0bac8389c68afd52

After applying the fix, it now looks like this: image

gwilymk commented 4 months ago

I always wonderered why there were gaps and assumed it was just some weirdness with the tiles themselves... I haven't needed affine backgrounds myself yet so didn't run into this problem yet.

I'm happy with a kludge fix for now.

I'm planning on refactoring backgrounds entirely to look a bit more like ObjectUnmanaged and remove the current link between background tiles in vram and the background itself. That should allow for easier effects and management of vram. I've got a branch for it here which I'll probably finish after game jam season.

So if it fixes the current API I'll be happy to take it. Would you like to create a PR for it? The solution you have there seems perfectly reasonable to me and I'll make sure to integrate it in my refactor when I get round to completing it :)

kouta-kun commented 4 months ago

@gwilymk I've created a PR for it now :)

gwilymk commented 4 months ago

Fixed in #735