Shitty 2.5D - PoC

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
M2m
Posts: 3
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: 1077
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: 3
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: 1077
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.

Post Reply