Shitty 2.5D - PoC

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Shitty 2.5D - PoC

Post by M2m » Wed Feb 17, 2021 10:15 pm

I just started in GB dev like 2 weeks ago.

Made a 2.5D proof of concept in GBDK 2020 - with 5 walls. "Map" is at the top.

https://github.com/sttng/gb-stuff/tree/main/shitty-25D

Image

Main challenge is to get a screen redraw, which I couldn't get a decent solution so far - only one which induces heavy flickering. Not tested on real HW only BGB.
Also I didn't implement viewport clipping as of now.

Any tips for screen update appreciated. Also feel free to get the code and use it for whatever you think its helpful.

https://github.com/sttng/gb-stuff/tree/main/shitty-25D

Warning: Heavy Flicker if you test it in BGB !! Be careful if you are known to have records of photosensitive epilepsy

Oziphantom
Posts: 1097
Joined: Tue Feb 07, 2017 2:03 am

Re: Shitty 2.5D - PoC

Post by Oziphantom » Wed Feb 17, 2021 11:31 pm

You are most probably taking longer than a frame to draw the frame and hence you get flicker. You will need to double buffer, and you can them use memset to clear it rather than draw over the lines again. But doing all of this in C with actually multiplies don't expect anything over low single digits FPS.I'm not familiar enough with the GB to know if you are able to double buffer it though.

M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Re: Shitty 2.5D - PoC

Post by M2m » Wed Feb 17, 2021 11:38 pm

Thanks for the reply. I'm actually quite surprised how far I got and without redraw (and the wireframe just 'smearing' over the screen) in this simple scene the framerates are much better then I expected. Given that I actually never developed any serious C (C++) or Assembler and also not a 3D engine guru I am pleasantly happy with the current state. Also there has not been any code optimization done. I guess some mults / devides can be replace with bit-shifts for example.

My 'current' solution is effectively draw the scene 2x. One time the original and the 2nd time overwriting in white color, to clear the the scene. So basically I waste half of the framerate.

Not sure if the GB can do double buffering - in fact I don't think it can as the 'GPU' is tile based rather. But lets see. Anyhow appreciate your feed back :D
Last edited by M2m on Wed Feb 17, 2021 11:46 pm, edited 1 time in total.

Oziphantom
Posts: 1097
Joined: Tue Feb 07, 2017 2:03 am

Re: Shitty 2.5D - PoC

Post by Oziphantom » Wed Feb 17, 2021 11:45 pm

You can double buffer anything. So in this case you double buffer the tile set. Looking it up you need 340 chars for a "bitmap screen" and there is not room for 2 sets. So you would have to have a working set in RAM and then copy over multiple frames to VRAM. Which will give you tearing but should stop flickering.

M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Re: Shitty 2.5D - PoC

Post by M2m » Sat Mar 20, 2021 11:39 pm

Made some slight adjustments.

Can see some video here:
https://www.vrddit.com/?v=r/Gameboy/com ... f_concept/

M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Re: Shitty 2.5D - PoC

Post by M2m » Tue Mar 23, 2021 11:33 pm

Another small update. With some pseudo-clipping

https://www.vrddit.com/?v=r/Gameboy/com ... itty_with/

User avatar
Nikku4211
Posts: 400
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: Shitty 2.5D - PoC

Post by Nikku4211 » Mon Mar 29, 2021 9:06 am

M2m wrote:
Wed Feb 17, 2021 10:15 pm
Main challenge is to get a screen redraw, which I couldn't get a decent solution so far - only one which induces heavy flickering. Not tested on real HW only BGB.
I've tried it on my Japanese SGB1, running on a real US NTSC SNES, with my Everdrive GB X5, and both ROMs work just the same as they do in your videos, and when I test the ROM in Sameboy.

Heavy flickering would be fine on the Game Boy DMG, as its screen is a pretty slow passive matrix display with heavy motion blur anyway.

It would not be fine for the GBC or GBA, but those systems already have a faster processor in GBC mode anyway.

It would not be fine for SGB either, which does not have a faster processor unless you're pulling a Space Invaders and loading a SNES ROM into the SNES' WRAM.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.

M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Re: Shitty 2.5D - PoC

Post by M2m » Wed Mar 31, 2021 10:41 pm

Cool ! Thanks for letting me know that it works on real hardware. Yeah I know the flickering is super-annoying. I definitely will try to figure out a way to get rid of it. With reduced framerate most likely.

I'm using BGB (and also occasionally mGBA) on Windows and Sameboy on macOS 8-)

User avatar
Nikku4211
Posts: 400
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: Shitty 2.5D - PoC

Post by Nikku4211 » Tue Apr 06, 2021 7:08 am

M2m wrote:
Wed Mar 31, 2021 10:41 pm
Cool ! Thanks for letting me know that it works on real hardware. Yeah I know the flickering is super-annoying. I definitely will try to figure out a way to get rid of it. With reduced framerate most likely.
Yeah, that can work.
M2m wrote:
Wed Mar 31, 2021 10:41 pm
I'm using BGB (and also occasionally mGBA) on Windows and Sameboy on macOS 8-)
I've heard that SameBoy is already more accurate than BGB on Windows. Is this true?
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.

M2m
Posts: 15
Joined: Mon Feb 15, 2021 8:31 pm

Re: Shitty 2.5D - PoC

Post by M2m » Tue Apr 06, 2021 9:09 am

Nikku4211 wrote:
Tue Apr 06, 2021 7:08 am
I've heard that SameBoy is already more accurate than BGB on Windows. Is this true?
I honestly can’t tell you. I’m just too new to GB dev to have a meaningful, informed answer.

tepples
Posts: 22322
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Shitty 2.5D - PoC

Post by tepples » Tue Apr 06, 2021 11:22 am

SameBoy indeed passes more behavior tests and has finer-scale emulation of the APU than bgb. However, the debugging tools in SameBoy for Windows and Linux are not quite as detailed as those of bgb.

Post Reply