Pseudo-3D road demo
Moderator: Mask of Destiny
Pseudo-3D road demo
This is a tech demo for Sega Genesis that shows a pseudo-3D road featuring curves. This effect has been seen in games like OutRun, Super Hang-On, and Super Monaco GP.
Most of the information required to create this demo was obtained from Lou's Pseudo-3D Page. So, I would like to thank Louis Gorenfeld, the author of the page.
I have plans to turn this demo into a complete game. Thus, any help on improving and optimizing this demo will be appreciated.
Version 1.1 adds hills, which are not yet perfect.
Controls
D-pad left/right: move left/right*
A: brake
B: accelerate
*The left/right movement is absent in version 1.1 due to issues that appeared after adding hills.
Download
v1.1: Link
v1.0: Link
Last edited by M-374 LX on Tue Apr 01, 2014 9:26 pm, edited 2 times in total.
Thanks, guys.
Maybe hills can be created by changing the vertical scroll value during the horizontal interrupt, as done with the palette at present.
According to the page, this effect can be done by multiplying a value during drawing to a value in the Z map, but this causes a significant performance loss in the Genesis.
Maybe hills can be created by changing the vertical scroll value during the horizontal interrupt, as done with the palette at present.
According to the page, this effect can be done by multiplying a value during drawing to a value in the Z map, but this causes a significant performance loss in the Genesis.
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
look up tables!M-374 LX wrote:Thanks, guys.
Maybe hills can be created by changing the vertical scroll value during the horizontal interrupt, as done with the palette at present.
According to the page, this effect can be done by multiplying a value during drawing to a value in the Z map, but this causes a significant performance loss in the Genesis.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Naiss !
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
I am currently trying to add hills, but something seems to be wrong.
This is the C structure I am trying to use to store vertical scrolling and palette information for each scanline:
And here, how I try to read it during the HBlank:
The problem is that the vertical scrolling gets corrupted if I write color information to the struct, but not if I do not. I believe this problem is related to the struct alignment. Is this correct? If so, how can I fix it?
This is the C structure I am trying to use to store vertical scrolling and palette information for each scanline:
Code: Select all
struct
{
ushort vscroll;
ushort color;
} scanline_buffer[224];
Code: Select all
move.b (0xC00008), %d0
lsl.w #2, %d0
lea scanline_buffer, %a0
move.w 0(%a0,%d0.w),%d1
move.w 2(%a0,%d0.w),%d0
-
- Very interested
- Posts: 141
- Joined: Thu Aug 22, 2013 3:47 am
- Location: Venezuela - Caracas
- Contact:
You can try this:
You could also use two "add.w %d0,%d0" instead of "lsl.w #2,%d0" because it is faster.
Good luck with this project.
Code: Select all
moveq #0, %d0 ;clear d0
move.b (0xC00008), %d0
lsl.w #2, %d0
lea scanline_buffer, %a0
move.w 0(%a0,%d0.w),%d1
move.w 2(%a0,%d0.w),%d0
Good luck with this project.
I have actually cleared D0 and D1 immediately before:
Code: Select all
clr.l %d0
clr.l %d1
move.b (0xC00008), %d0
lsl.w #2, %d0
lea scanline_buffer, %a0
move.w 0(%a0,%d0.w),%d1
move.w 2(%a0,%d0.w),%d0
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Normally the line H scroll is made for that. I think the problem is that you actually had some VDP access conflict: maybe the hscroll DMA method is interrupted by the HInt method and so your VDP accesses get corrupted.
Something you can do is to protect your HScroll method against HInt or just be sure they won't happen at same time.
Something you can do is to protect your HScroll method against HInt or just be sure they won't happen at same time.
I was wondering why the road effect was not displayed on real hardware and Genesis Plus GX.
It turns out you accidentally set bit 2 in VDP register #0 which results in freezing the HV counter. This feature is not supported by most emulators but you might want to fix it since your code relies on HV counter
Also, it seems like the demo hangs on real hardware (controls do not respond): I suspect this is because DMA is left enabled in VDP register #1 even when not being used but I am not sure
It turns out you accidentally set bit 2 in VDP register #0 which results in freezing the HV counter. This feature is not supported by most emulators but you might want to fix it since your code relies on HV counter
Also, it seems like the demo hangs on real hardware (controls do not respond): I suspect this is because DMA is left enabled in VDP register #1 even when not being used but I am not sure