WiP: Christmas Racer in pseudo 3D (goodies inside)

Started by abstauber, Fri 04/12/2015 16:09:22

Previous topic - Next topic

abstauber

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



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.

selmiak

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

abstauber

That should be Adventure Game Schüssler Salt 3.4.0.6 alpha

Eggie

Oh my goood! I love the way these pseudo-3D racers look!
I want to select Larry Vales as my racer!!


abstauber

#5
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 :)

abstauber

#6

Monsieur OUXX

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?
 

abstauber

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

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

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.

abstauber

#9

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

Monsieur OUXX

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.
 

Problem

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-)

abstauber

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


abstauber

#13
Driving home for Christmas...


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

[delete}

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.


abstauber

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) :)

abstauber

#17
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-)

Monsieur OUXX

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

 

abstauber

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.

SMF spam blocked by CleanTalk