Adventure Game Studio | Forums

Creative Production => Critics' Lounge => Topic started by: abstauber on Fri 04/12/2015 16:09:22

Title: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Fri 04/12/2015 16:09:22
Hey,
I'm currently working on a Christmas game (or Holiday Season game including snow, gifts and an altruistic old man... whatever you prefer ;) )
And since working on it in secrecy is boring, I've decided to start this thread.

So what is this about, you might ask?
Remember Red Hot Overdrive, Outrun, Super Hang-On or even TechnoCop? That is pseudo-3D racing. Ever dreamed of Roger driving to his next adventure? Maybe soon he might be able to do that. There's an excellent site on the net explaining how everything works: http://codeincomplete.com/posts/2012/6/22/javascript_racer/

My personal goal is to create a small Christmas themed racing game in CGA, but let's face it... time is short and I have no idea if I can make it. So in the meantime I just post my progress here and maybe some of you might  look at the code and find it useful (or even improve it and post it back.. *cough* that would be wonderful to be honest)



So here's the first preview - made with AGS 3.4.0.6 (hooray for managed structs!)
Current features are:
* curves
* hills
*slowdowns

(http://shatten.sonores.de/wp-content/uploads/2015/12/road_engine2.png)

Download the source here:
http://shatten.sonores.de/wp-content/uploads/2015/12/xmasracer_01.zip
Get the game/sources here:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=53023

PS
Many thanks to Khris and AprilSkies for all their advice and input so far! You guys rock.
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: selmiak on Fri 04/12/2015 16:40:12
looking good (except I don't like the cga color palette :P), but what esoteric AGS version are you using? I can't open the source and have a play :P
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Fri 04/12/2015 17:16:55
That should be Adventure Game Schüssler Salt 3.4.0.6 alpha
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Eggie on Sun 06/12/2015 00:06:11
Oh my goood! I love the way these pseudo-3D racers look!
I want to select Larry Vales as my racer!!
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Jim Reed on Mon 07/12/2015 10:58:34
This looks interesting!
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Mon 07/12/2015 11:11:37
Maybe this whole community racer project discussion can be revived after all :)

But I don't want to brag about it, this is still at a very early stage - but at least the code is in the wild.
Speaking of which:
http://shatten.sonores.de/wp-content/uploads/2015/12/xmas_racer_02.zip

The game is finally back at a reasonable frame rate (around 90fps on my machine) after I got rid of all managed structs ( boost of ~10fps). I also enhanced the calculations a bit, but I'm sure there's still a lot more room for improvements. But at least there's now enough CPU power left for sprite scaling.
Stay tuned :)
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Mon 07/12/2015 21:28:28
(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasracer3.png)
More speed!
..and parallax backgrounds. Yay!

http://shatten.sonores.de/wp-content/uploads/2015/12/Xmas_racer_03.zip
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Monsieur OUXX on Tue 08/12/2015 14:41:54
Quote from: abstauber on Mon 07/12/2015 11:11:37
I got rid of all managed structs ( boost of ~10fps)

Can you elaborate please? Did you have arrays of structs, or just structs? You replaced them with what?
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Tue 08/12/2015 14:51:16
You can still take a look at it, I keep the old code online until I declare this experiment finished.

I had a struct as an array and inside of that I had a managed struct. Basically

Code (ags) Select

managed struct cWorld {
    float x,y,z;
};

struct cSegment {
    cWorld *world;
};

cSegment segments[1000];
segment[0].world = new cWorld;
segment[0].world.x = 0.1235;


Now it's just this:
Code (ags) Select

struct cSegment {
    float world_x;
    float world_y;
    float world_z;
};
cSegment segments[1000];
segment[0].world_x = 0.1235;

It is soooo much faster.
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Tue 08/12/2015 23:26:52
(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasracer4.png)
How much does it cost to add scaled sprites, you might ask?
Pretty much 39 frames :P


But hey, it's still above 100, adding opponents and a bit of game logic might still end up above 60 fps.

http://shatten.sonores.de/wp-content/uploads/2015/12/Xmas_racer_04.zip
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Monsieur OUXX on Wed 09/12/2015 14:57:39
Nice. Have you considered boosting the scaled sprites process by starting off with the larger one and then always scaling down not the source sprite but the one that was scaled down immediately before? It would be like a chain of scaling down. Benefit: AGS would have less and less pixels to process until the most distant (smallest) sprite.
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Problem on Wed 09/12/2015 20:49:38
This is pretty cool!
As far as I know, those old pseudo-3D racing games didn't scale anything at runtime. They just had the same sprite available in different sizes. So if you ever run into framerate trouble, you could just use a number of pre-scaled sprites and be even more old-school. 8-)
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Wed 09/12/2015 23:40:02
yay, replies! :cheesy:
The scaling itself isn't the bottleneck, Drawimage is pretty fast when applying custom width and hight.
The calculations of the scale factor is the party pooper. Also I'm now processing the screen twice: first run is bottom to top environment drawing. The next step is top to bottom sprite and car rendering. I think, those extra loops make it slow.

@Problem: The Sega Arcades (like SpaceHarrier, OutRun and Afterburner) all had hardware support for sprite scaling, as far as I know only homecomputer conversions used pre-scaled sprites. But scaling via DrawImage already looks pretty terrible and therefore is old-school awesomeness :D

Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Thu 10/12/2015 15:54:23
Driving home for Christmas...
(http://shatten.sonores.de/wp-content/uploads/2015/12/road_engine4.png)

Down to 90 fps, but most of the logic is in. It's also a bit buggy and getting slower the longer you drive.
This is new:
* traffic
* basic traffic AI
* Title screen and countdown
* Tween module
* Snow
* Honest CGA colors ;)

http://shatten.sonores.de/wp-content/uploads/2015/12/xmas_racer_05.zip
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: [delete} on Thu 10/12/2015 19:19:21
Amazing work!

But don't think I have forgotten of ShattenReyze; "Biete Pärchen auf's Maul an!" with the Deine Mudder option is already legendary.
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Eggie on Thu 10/12/2015 20:34:00
That is super fun to play! You should feel hella proud!
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Fri 11/12/2015 13:46:32
Quote from: Amélie on Thu 10/12/2015 19:19:21
Amazing work! But don't think I have forgotten of ShattenReyze; "Biete Pärchen auf's Maul an!" with the Deine Mudder option is already legendary.
Haha, you really remembered this from the screenshot? That was 5 years ago :D
Thanks for the comment, it made my day!

@Eggie: Thanks a lot. I'd really love to see a racer from your cartoon universe some day (or at least a mini game) :)
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Sat 12/12/2015 13:00:58
Just a quick update, as I could not leave that bugged version online :)

http://shatten.sonores.de/wp-content/uploads/2015/12/xmas_racer_06.zip


It also includes music so the download is now 10MB.
Btw. I removed all the 3.4 specific code so it should also work with AGS 3.3 now 8-)
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: Monsieur OUXX on Tue 15/12/2015 13:27:13
Two comments:
- could not load the game with 3.3.4.
- When compiling, it still references missing wav files from your filthy German computer ( D:\Eigene Dateien\AGS\Xmas_challenge_2015\resc\sfx\button_press_09.wav ) which prevents from compiling

Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Tue 15/12/2015 13:53:36
I apologize for the filth (laugh)
Was it ever possible to load a 3.4 project in 3.3? The code inside the project should be 3.3 compatible.
As soon as I fix those dang collision problems, I'll upload a new version  - hopefully with the audiocache intact.
Title: Re: WiP: Christmas Racer in pseudo 3D (goodies inside)
Post by: abstauber on Thu 17/12/2015 19:31:20
Alright, I think I'm almost done. But instead of spoiling all the fun, I'll just provide some pics :P
The framerate is pretty stable at around 100 fps on this 4 years old computer.

If you care to read, here are some cornerstones of the development:

(http://shatten.sonores.de/wp-content/uploads/2015/12/road_engine1.png)
yay, soilent green roads

(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasbug1.png)
Mirror roads

(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasbug2.png)
Smooth hills one step ahead

(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasracer3.png)
Getting there..

(http://shatten.sonores.de/wp-content/uploads/2015/12/xmasracer7.png)
Done!


The final release (including sources) will be on Sunday TODAY.