scanline road engine test

I’ve been trying to create a ‘scanline road engine’; an engine to create the old-school kind of road similar to old arcade racing games like Out Run.
I always had a fondness for these kind of games, and how these fake 3D engines could create a sensation of speed.
My first attempt so far supports bends, hills and a textured road. It’s not perfect yet and it’s not very optimized yet but on my laptop it quite easily runs full speed.

Anyway, here is a screenshot and a JNLP link:

http://www.gagaplay.com/scanrace.png

http://www.gagaplay.com/scanrace.jnlp

It will try to go to full screen mode using AWT, so I hope that works… (it works here on ubuntu, so I figure it probably works on windows then too)

Tried on Windows - pretty sweet so far. When it draws the road going up hills in the distance things don’t look quite right - the road looks completely vertical, like there’s no pseud-perspective.

Works nice and smooth on OSX here. The only snag seems to be the one BoBear points out. Also perhaps add some kind of distance-fogging or colour tinting to give a better sense of depth?

I’d love to see this developed into a full racer, what are you plans for it? Just adding some other objects (rocks, tunnels, clouds) would spice it up a lot.

The thing is, in the distance a lot of precision is lost which can make it look blocky in some cases (high hills in a bend in particular). With hills, scanlines are basically just repeated, which is exactly what those old engines did. One way to get around it is to interpolate in those areas, or simply just avoid it by for example not combining huge steep hills and bends.

I would like to create a full racer from this. First I’ll need to add a scaling sprite engine for the scenery and cars. I like the idea of distance fogging.

Doesn’t work well on my machine!
The screen blinks rapidly with white color, I see the road and then I see whitescreen, thats happening like every 30 ms.
Windows 7 Home Premium 64 bit. Java 1.6 u21. ATI Radeon HD 5770.

No dice here - full-screen whiteout & error (latest JRE, crummy onboard card, XP)

java.lang.IllegalStateException: Buffers have not been created
    at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.flip(Unknown Source)
    at java.awt.Component$FlipBufferStrategy.show(Unknown Source)
    at com.gagaplay.scanrace.GF.<init>(GF.java:87)
    at com.gagaplay.scanrace.MainLayer.main(MainLayer.java:27)

I love these games too! Why not try an applet for testing & then use JNLP for full screen? ambles off to scrub out the java cache

screenshot looks good, however running the app locks up the computer as it freezes in full screen.

This is cool :smiley: Worked well on my machine running Ubuntu Desktop… on a laptop. Crazy right?

That is a good start! Runs very smooth here, the driving experience is nice. I definitely think you should make a racing game out of this.

It works well on my old laptop. Now, I want to see some cars! :slight_smile:

The world requires a new Road Rash.

Make it so.

I’m guessing the machines where it doesn’t work all run Windows. I read that FSEM is a bit unstable with D3D. Next version I’ll see if I can disable D3D for Windows.

Hi!

Fullscreen mode is broken on some Linux distros especially when using KDE 4. It is my case :frowning:

It works fine on Cent OS 5.3. I will test on Mandriva Linux 2010 later.

Yes in my case it was windows with some rather crappy intel gfx card (latest jre though).

Hm, so I guess FSEM using pure java generally still sucks then after all these years…

I think the trick is to use a taller image.

Well, have a look at: http://www.gorenfeld.net/lou/pseudo/

I’m not actually using an image, but a z-map per scanline which I use to scale.

The problem is, this z-map is now fixed for a flat road, which is fine as long as there are no hills. When there are hills, it simply repeats scanlines.
Just making the zmap (or image) taller won’t really solve the problem. For best results, the z-map needs to be the the size of the complete height of the screen and take the elevation of the road into account for each line, so that it won’t repeat lines.
That’s a bit trickier to implement though and I suck a bit at math :persecutioncomplex:

I’ve added some interpolation to improve rendering at higher distances. This doesn’t really solve it completely, but it hides the problems a bit.
There’s also a really annoying engine sound now :slight_smile:

Hopefully some of the full-screen related problems are solved too (I disabled D3D and moved some initialisation stuff to the EDT).

http://www.gagaplay.com/scanrace.jnlp

Works just fine here on Mac OS X. I agree that occasionally the hills look a bit weird. What’s especially odd is that they occasionally seem to “bounce” as they are adjusting to my approach.

Yes it does look a bit odd sometimes (to the point that the rough non-interpolated might look less fake), but it’s an intermediate step to a full solution.
The next step will be to use all z values (‘fixed’ + ‘interpolated’) to (re-)calculate the hills & bends. I think the result will be perfect then.