chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.52k stars 469 forks source link

Enabling Color Mode causes graphical glitches #568

Open riley-brandt opened 4 years ago

riley-brandt commented 4 years ago

Describe the bug When I create a large background (like 320x288px) and move the camera instantly, graphical glitches appear on the screen during the transition if Color Mode is enabled.

If COLOR MODE IS NOT ENABLED it works fine:

DMG_No-Issues

If COLOR MODE IS ENABLED, the graphical glitches appear:

GBC-glitch-01a GBC-glitch-02a GBC-glitch-03a

To Reproduce

Easy Method:

  1. Download my sample project here.
  2. Run the game to see that no graphic glitches appear
  3. Enable Color Mode and run again.
  4. They are quick flashes, but you should be able to see the garbled graphic during the camera move transitions.

Create Your Own Method:

  1. Create a background image that is larger than 256 x 256px. Mine is 320 x 288px.
  2. Add an animated actor or two.
  3. In Settings, set the Default Fade Style to: Fade to Black
  4. Add a Camera: Move To event that goes from one 160x144px section, to another.
  5. Set the speed to Instant.
  6. In Settings, check Enable Color Mode.

Expected behavior The camera will move to the specified X,Y coordinate without flashing garbled graphics/tiles while doing so.

Platform (please complete the following information): -OS: Fedora 32, 64-bit -App version: 2.0 beta3 (sept 26, 2020 itch.io build)

RichardULZ commented 4 years ago

Note you forgot to mention the use of fade to black which is key to this issue. Related to a recent change i didn't thoroughly check, the fade is only applied on next vblank to avoid tearing on gbc, however the screen rerender is happening before that activates. Will need to test an extra wait vblank in scroll c, but that may not cut it, alternative force palette refresh as part of update, possibly optimise screen instant black to fill registers with 0 instead of calculating black.

riley-brandt commented 4 years ago

Thanks @RichardULZ for the information. I'll update the bug report to include the Fade to Black option (which is a great new feature that I love!).

I hope you are able to find the solution. It will really open up possibilities in my game.

riley-brandt commented 3 years ago

Thanks @RichardULZ for working on this bug! It's an important feature for my visual novel.

I can't wait till we get a stable release so I can start developing with the new features.

RichardULZ commented 3 years ago

@terminaltux The v2beta branch has up to date builds with these fixes and more + performance as beta5.

Fade to black events changed to an Engine Field, which now has a settings page but can still be modified with an event.

There's some script runner changes coming soon that might change things, but for now it's pretty stable, I'd recommend picking one up from the v2beta readme file links.