Stunt Race working in Xors

Community Forums/Showcase/Stunt Race working in Xors

Vorderman(Posted 2011) [#1]
Finally making some progress with this, I've got SRX working using Blitz3D and Xors, and so far it seems like a nice solid 60fps with 8 vehicles on the track on a Windows 7 laptop, compared to Blitz native getting around 10fps.

My editor's track export to B3D format seems to be quite broken at the moment as no textures are working, so that's next on the list to sort out.



Last edited 2011


Vorderman(Posted 2011) [#2]
Getter better, all the textures are now working:




BlitzSupport(Posted 2011) [#3]
Ooh.

(A simple one-level demo, that's all we ask... )


MadJack(Posted 2011) [#4]
Vorderman

Nice!


Kryzon(Posted 2011) [#5]
I'd increase the ambient light factor, but it's looking good!

Ooh, and now you have access to HLSL\FX shaders. Now you can implement blooming "for real", and also have some nice specular shading for your cars, velvet reflections, godrays, color-correction...


Steve Elliott(Posted 2011) [#6]

compared to Blitz native getting around 10fps.



Now we know why you were making us wait for this lol. :)


Vorderman(Posted 2011) [#7]
Ooh, and now you have access to HLSL\FX shaders. Now you can implement blooming "for real", and also have some nice specular shading for your cars, velvet reflections, godrays, color-correction...


Yep, this sort of thing is next on my list of stuff to look at, then I can get rid of that dodgy looking sun flare sprite.

The player spends quite a lot of time looking at the road surface so I'd like to get that looking a bit better.

Last edited 2011


Vorderman(Posted 2011) [#8]
compared to Blitz native getting around 10fps.


This was only on a Windows 7 PC - on both my quite old WinXP machines it has always been a solid 60fs, which is why it was frustrating to continue as most people will be or have moved to Win7.

Last edited 2011


Vorderman(Posted 2011) [#9]
Got Xors realtime shadows working, but not too impressed with the results - they drop the framerate quite a lot, and I can't get them to cast with enough precision to cast the car's shadow onto the road.

Comparison shots below.

The lightmap is pre-processed so the game can shadow the vehicle when it passes into a lightmap shadow, so the overall effect is that the lighmapping is much faster and much sharper, and the shadow doesn't jiggle around as the camera moves.

In both cases the car isn't casting a shadow onto the track, so I'd need to solve that problem either way.

Xors realtime:


Lightmapped:


Last edited 2011


Kryzon(Posted 2011) [#10]

The lightmap is pre-processed so the game can shadow the vehicle when it passes into a lightmap shadow

How did you manage to do this? are you projecting the shadow maps over the vehicles, or sampling the lightmap texel that car is on top of and using that as a material-ambient term?

For the cars, if dynamic shadowing isn't working, you can try using static decals:



Steve Elliott(Posted 2011) [#11]

This was only on a Windows 7 PC - on both my quite old WinXP machines it has always been a solid 60fs



*Steve shakes head in disbelief*

The latest Windows Operating System runs 6 times slower in this case.

*Steve organizes a mob to go ask Bill Gates why?*


Vorderman(Posted 2011) [#12]
or sampling the lightmap texel that car is on top of and using that as a material-ambient term?


Yes that, it's very simple and only works on on one plane (x,z), so I just go through the lightmap before the main game and read the pixel colour into an array, then during the game convert the vehicle position into a position in that array and get the appropriate colour. Very simple, but very fast and works well in the case of my game where there is no real vertical aspect to the world (ie. rooms over rooms).

Last edited 2011


Vorderman(Posted 2011) [#13]
Another update : managed to get a proper diffuse/normal/specular shader working just on the road surface (under the skidmark overlays), then modified the shader so it works with the lightmap:








Grisu(Posted 2011) [#14]
Looks great.

Add cars and let us play a demo. :)


Vorderman(Posted 2011) [#15]
Last update for the weekend:

- Looks like linepick is incredibly slow under Xors, so I've swapped back to a simple polygon that will appear or disappear as the vehicle touches the ground. Not perfect, but it's quick and looks fine 90% of the time.

- tried Xors bloom but it's not as good as FastExt's bloom, which is much faster and gives a nicer overall screen effect, so sad to lose that.

- added back in almost all the code I had to remove to get Xors working, so the lap counter is working, crash and reset with the cranes is working etc.. so almost back now to a working game.

- Added some AI paths to the Big Ramp track so the AI cars can have a go, at the moment they don't make the jump as I've not flagged their AI to use the boost, so I'll sort that next.

- Still at 60fps with 8 cars on my Win7 laptop.

Screenshots of shadows working (mostly):






Last edited 2011


MadJack(Posted 2011) [#16]
Xors's shadowcasting isn't great but I seem to recall Squid's mentioned doing a rewrite sometime - although I think he's busy with physics as the moment.

Regards linepicking, I use the inbuilt Bullet Physics raycasting which I suspect would be much quicker than linepicking?


Steve Elliott(Posted 2011) [#17]
Really looking forward to this one.


therevills(Posted 2011) [#18]
The latest Windows Operating System runs 6 times slower in this case.

*Steve organizes a mob to go ask Bill Gates why?*



Because DX7 isnt really supported anymore and is emulated...

Looking good Vorderman! DEMO NOW!!! :D


Vorderman(Posted 2011) [#19]
Regards linepicking, I use the inbuilt Bullet Physics raycasting which I suspect would be much quicker than linepicking?


Hmm interesting, no idea about that one - how would I go about using that?, and would I need whatever physics system Xors uses implemented also in some way to get that working?

Currently I'm using the B3D Tokamak lib for my car physics, but for the case of the shadows I need to just do a simple linepick / raycast against a Blitz3D / Xors mesh, totally seperate to the physics.


taumel(Posted 2011) [#20]
Can you use a larger lightmap on the terrain?


Vorderman(Posted 2011) [#21]
I could yes, at the moment it's using a 1024x1024, so it could go to a 2048x2048. I can also try blurring it slightly to reduce the pixellated edges, but you don't notice the resolution so much when you're racing around as you do in screenshots.

Last edited 2011


KronosUK(Posted 2011) [#22]
If you could separate the road mesh from the landscape, make the road mesh the only thing that receives shadows from the cars that would probably speed things up. Switch off both shadow receiving and casting on the landscape mesh.

Last edited 2011


taumel(Posted 2011) [#23]
Okay, i still would give it a try, a 2k map shouldn't be much of a performance hit for quite some systems.

One thing i would alter is the texturing of the sides of the road. Either i would alter the architecture so that the colours make sense or most probably easier just alter the texturing for something different.

I like the cars, especially in the first screenshot. Can you also enable AA? Maybe you want to use different colours for the wheels and the rest of the cage structure, this way it would get more believable.

What seems to be a bit out of place is the relationship between the road's texturing and the cars, so i would shrink the roads mapping or increase the texture's tiling.

Last edited 2011


Vorderman(Posted 2011) [#24]
Yeah the road texture is out of scale with the cars when seen from the exterior views, but from the cockpit view it makes sense. If I use a larger texture then it becomes too fussy and the sense of speed is diminished as the pixels merge together too much.

Also it would require a 2048x4096 texture which I really don't want to go to, so I'm happy with the compromise at the moment - a solid 60fps is more important to me than really high-res textures - I can always add those as an option at some point.

The same thing applies to the road sides - as the tracks can be made up of enormous hills I intentionally overscale the texture so that these huge polygons don't tile too much when seen during the game. So you end up with a similar issue to the roads where if you stop and look around the scaling looks wrong, but when playing it works better to have them large.

If you play a game like Burnout you can see how huge their building textures are compared to the cars if you stop and check it out, but when playing they make more sense to be huge as you're normally travelling past them so fast.

Take a look at this screenie from Burnout Revenge - look at the size of the windows on that facing building compared to the buses on the road on the right - you could easily drive a bus through one of those windows and 1 floor of the building is about 30 feet tall, but in the game it works.



Last edited 2011


Pinete(Posted 2011) [#25]
Congrats Vorderman, great job!
how many years have you been working with this buggies?
I remember one of your first versions at least five or six years ago, or more,and even then, it was quite impressive!
Amazing patience ;) and thanks god, every step is better than previous one :P
I join the group that say: "DEMO NOW!"
best!

Last edited 2011


taumel(Posted 2011) [#26]
@Vorderman
Okay i see what you mean. But i once did a nice road textures and it was kind of properly scaled but still felt fine if you raced over it. Maybe the difference was that i also used it from a third person's camera follower perspective, the distance was quite short but of course it wasn't the cockpit as well. I guess it was 1k, tileable, also used a normal map on it and gave it some trilinear filtering. I really liked the result.

Last edited 2011


Vorderman(Posted 2011) [#27]
Yes mine looks odd in 3rd person due to the scaling, but the main focus is the cockpit view, it's very hard to drive from the chase-camera.

Small update for today - added normal/spec to the player's vehicle's tyres.






MCP(Posted 2011) [#28]
Looking great. I want to play it NOW! :P


MadJack(Posted 2011) [#29]
Vorderman

You can set raycast groups (in Xors) without needing to setup extra physics, so I'd expect you could continue to use Xors collisions. Check out the raycast section of the physics module in the Xors helpfile.


Kryzon(Posted 2011) [#30]
Great work on the shaders!


col(Posted 2011) [#31]
This looks really great, still looking forward to playing this :D

BTW. The directional tyres on the right hand side are on backwards :D It's illegal in the UK and I imagine the whole world :D

Excellent looking game.


Vorderman(Posted 2011) [#32]
BTW. The directional tyres on the right hand side are on backwards :D It's illegal in the UK and I imagine the whole world :D

Heh, you're right! I shall fix that tonight.. Wonder which side has the tyre on the right way?

You can set raycast groups (in Xors) without needing to setup extra physics, so I'd expect you could continue to use Xors collisions. Check out the raycast section of the physics module in the Xors helpfile.

Excellent thanks, I'll take a look at that.


col(Posted 2011) [#33]
The left side ( left when sitting in the driver seat ) are facing the correct way. They should all face that same direction. Ie the 'arrow' formation of the tread should point into the direction of rotation. :)

Last edited 2011


AvestheFox(Posted 2011) [#34]
I've been keeping an eye on this thread and I must say now that this just keeps looking better and better with each new update! :D

the bump mapping on the tires is especially impressive!


MGE(Posted 2011) [#35]
jeesh..the first pic I saw was the burnout pic and I was like....wtf!!!!!! Still...the actual game shots look good too. ;)


Vorderman(Posted 2011) [#36]
Here we are, specially for Col - sorted out the illegal tyre treads... :)

Also found an old bug with inverted meshes in the wheels, so nice to sort that out by accident.






Steve Elliott(Posted 2011) [#37]
This is torture! Demo soon lol.


Vorderman(Posted 2011) [#38]
Still got soooo much to do before I can make a demo....

However I have added some sidewall text and slight tread damage to the tyres...

...must...stop...tweaking....




Taron(Posted 2011) [#39]
Now I can't wait! No pressure, though... ...wait, PRESSURE! 8)


col(Posted 2011) [#40]
Hehe :D
Thats better, now if/when we crash, we know its not the tyres at fault :D


Vorderman(Posted 2011) [#41]
Yeah thanks, I don't want to get sued by clumsy drivers... :)


elcoo(Posted 2011) [#42]
Looking great Vorderman!
One small suggestion though: Bake an ambient occlusion Texture on those cars and maybe consider adding a Cubemap, too. I've got the feeling the buggies look a bit too much toy like, in contrast to the scenery.


Vorderman(Posted 2011) [#43]
I can certainly try the AO map idea, might add some depth to them.

They used to have a cubemap, no idea why I turned it off though - I suspect it just got lost in the mix as I went through various revisions to the cars.


RifRaf(Posted 2011) [#44]
What program do you use to make an AO texture for a mesh.. i've tried Faogen but its fails on anything complex and results in completely dark textures.


Vorderman(Posted 2011) [#45]
I'll use GILEs for that, it can import from Silo and export to B3D also.


Vorderman(Posted 2011) [#46]
update : cars need drivers, so I'm reworking an old human mesh to act as my drivers.

In Silo:


Last edited 2011


Steve Elliott(Posted 2011) [#47]
Now you're cooking - drivers! :D


MadJack(Posted 2011) [#48]
I'll use GILEs for that

Good old Giles. V1 or 2 for lightmapping?


Vorderman(Posted 2011) [#49]
Um, not sure. I bought it ages ago, but I think I've also got the version that was released for free.


elcoo(Posted 2011) [#50]
You can also use Blender for Lightmaps btw. The Driver's looking good so far, I like the texture on the protectors.


Vorderman(Posted 2011) [#51]
Well just tried Giles for an AO map, and quite frankly the results were terrible, and Blender is so confusing that it might as well be made by aliens.

So I'm going to leave AO off for the moment. I doubt it'll add much to a mesh that is basically a collection of tubes anyway.

Instead I shall concentrate on giving the car a proper dashboard, sort out the missing exhaust flames, hook up the turbo system again, and perhaps FINALLY sort out how to represent the vehicle's damage state - I need an alternative for Stunt Car Racer's crack-o-doom on the rollbar...


Taron(Posted 2011) [#52]
If you just want to render/generate AO map and you have proper uvs on your car model, then Blender is quite easy for baking them. I mean, it took me a moment, too, but once you know, it's just a few clicks away.

Let's see, if I can still get it together from the top of my head...

- get rid of the dumb box object
- import your model (hopefully you have it uvmapped already!)
- (optional) split the viewport in two and select image view for one.
- switch to EDIT MODE
- go to your image viewport, which should show your uvmap with the mapped polygons. Select IMAGE -> NEW and adjust the resolution to your liking.
- go to (F5) Shading. Next to it pick on World Buttons, if they're not already chosen. There you'll find a tap Amb Occ. You can adjust your settings there. I'd pick "Approximate" and make some adjustments. 2 Passes, Correction 0.5, Error 0.1. Something like that.
- Then go to (F10)Scene and Render Buttons.
- You'll see the Bake tab. Pick Ambient Occlusion. I turn on Normalize, this way you get the maximum value range from black to white. And then...
- BAKE!

Voila'. Now you can save out your image and be done with it. I think that was all.

I apologize, if that was not what you were after.


Vorderman(Posted 2011) [#53]
Cheers Taron, I'll have another look at Blender, shame it has the most obtuse user interface I've ever seen. If they tidied it up and made it more intuitive (along the lines of 3dsMax and Silo) then it would be a great tool.

Another small update - working on a way to represent vehicle damage, so trying out what happens if I add damage cracks to the overlay vignette. It's not too bad, but I really need a persistent way to show damage that doesn't get in the way of your game.




RifRaf(Posted 2011) [#54]
How much damage can a rollcage have ? , and where is that glass mounted in the car ? :)

bent support bars perhaps ?, interchangeable specular + bump mapping on the wheels, engine and framework


Vorderman(Posted 2011) [#55]
and where is that glass mounted in the car ? :)

glued to the driver's face by the looks of it :)

So, I didn't like the glass effect, but I've just tried a helmet-cam type effect, and this one I do like, it adds a nice new aspect to the in-car camera, so I might keep this for a while and see if I still like it in a week or so. The helmet visor area has dirt smudges and scratches on it which are visible when stuff moves behind it, so it feels more like you're inside the driver's head.




Vorderman(Posted 2011) [#56]
bent support bars perhaps


Yeah I thought about that sort of thing, problem is it gets tricky trying to swap mesh parts during gameplay, and there's no way I can dynamically deform them as it's so slow, and somehow I need be able to represent any level of damage between 0% and 100% (and have it obvious to the player what their current damage is) so I can't just have an undamaged and damaged mesh for the rollcage and swap between them.

?, interchangeable specular + bump mapping on the wheels, engine and framework

Again the problem is how to represent 0 to 100% variation without having 100 different textures, I don't know how I would cross-blend them anyway, and would you be able to accurately tell what damage level you're at just by glancing at the tyre's bump map?

There has to be a really great answer to this problem, I just don't know what it is yet....

Last edited 2011


Paul "Taiphoz"(Posted 2011) [#57]
with the mesh why not just have say 5 from fine to wrecked and just toggle between which one you render for the car depending on its state.


Taron(Posted 2011) [#58]
Is that openGL? You must be using GLSL shaders, no? Regardless, with some blending tricks you should be able to progressivle reveal cracks to a set of alpha-"like" masks, depending on what blending method you'd use. Through GLSL you could literally write a routine that would reveal them, even a kind of circular reveal, for example. More cracks on the outside first, maybe some mean ones straight through...dunno.

Anyway, yeah, blender is a mess. I got turned on to it because of those AO maps for working with Sculptris. It's all I ever open Blender for. Other than that it would drive me nuts, too. The newer versions are a bit more elegant, but still... anyway, for AO it's great, especially if that's all you'd ever have to know. ;)

Looking so damn good now, by the way. I really can't wait to try it! 8)


BIG BUG(Posted 2011) [#59]
and have it obvious to the player what their current damage is

Why not do the obvious? Increasing engine smoke and finally engine fire just before it blows.
Matching sound and unhealthy vibration of the cylinder block could be great too.

And moving some vertices of the cage shouldn't be that heavy as the cage mesh has to be updated only when damage is applied...

Last edited 2011


RifRaf(Posted 2011) [#60]
Actually, if you make your cage an animated mesh with bones attached to certain verts, you can just nudge the bones around. you could even make animations such as "anim_damage_1" to anim_damage_10, and have 10 steps to 100% damage in the animation..

Then all you have to do when damaged is playdamageanim(damage_amount) or something like that.


josk(Posted 2011) [#61]
For damage could you have different coloured smoke coming from the engines. White for slight damage black for loads of damage. You could even have flames.


Uncle(Posted 2011) [#62]
Another idea... I think you used to have a speedo gauge in some of the old screen shots. Why not add them back, and have various warning lights on them.. like Oil, Engine, Suspension etc. Each could have a % under them. If one or more get to 100% then game over. They could flash when then critical. It shouldnt detract too much from the visuals, and I dont think it would look out of place. This added to the other suggestions should give enough feedback to the player on the status of the car.


Vorderman(Posted 2011) [#63]
Some good ideas, thanks.

The dash did used to have a speedo and rev counter, I'm in the process of adding them back, so warning lights on the dash sounds like a good idea.

I also like the idea of smoke and flames from the engine, so I'll certainly have a go at that.

I think I might try the damaged rollbar approach as it does sound like it would look nice - I can make a few versions of those 2 vertical bars that sit in front of the cockpit, then just swap them out as needed. They're only a few polys so it should be simple enough.


Vorderman(Posted 2011) [#64]
Another update :
- got the Lotus particle system working in Xors.
- Sorted out the shadow.
- Modified "Big Ramp" track with extra scenery , direction signs etc..

Approaching banked straight

On the banking

Cornering at speed

Hanging from crane

Mid air

Powersliding

And crashing in a shower of sparks and smoke...


Last edited 2011


RifRaf(Posted 2011) [#65]
ok enough stills.. video please


BlitzSupport(Posted 2011) [#66]


Ooh. It looks like that might just capture the lovely spewy feeling that Stunt Car Racer was uniquely capable of!


Luis de la Cruz(Posted 2011) [#67]
Excellent work Vorderman! I also vote for a video please.


Foppy(Posted 2011) [#68]
Over the past ten years or so this must be one of the most anticipated Blitz games! Great pictures! :D


Arabia(Posted 2011) [#69]
Over the past ten years or so this must be one of the most anticipated Blitz games! Great pictures! :D


Yep. I'll most likely be shelling out some moolah when this gets released :)

Played a bit of the original SCR on an Amiga emulator a few months back - still a great game (must be 20-25 years old now).

The physics in the original game were absolutely awesome for it's time - getting this right could be a bit of a challenge. I believe the original programmer (Geoff Hammond Crammond (my bad) I think his name was) had a degree in Physics or some such field :S

Last edited 2011


Vorderman(Posted 2011) [#70]
Over the past ten years or so

:) Yeah yeah I know....


danjo(Posted 2011) [#71]
you all do know he's just been trolling for years now, and the "game" only exsists in photoshop ;)


Blitzplotter(Posted 2011) [#72]
And I thought he was a GIMP fan. Looking great Vorderman, keep up the good work :D


angel martinez(Posted 2011) [#73]
Very good work.


col(Posted 2015) [#74]
Hiya all,

Does anyone know if/when this was finished?


Hardcoal(Posted 2015) [#75]
I'm still working with xors. That's all I can say