Race track, load as another terrain map?

Blitz3D Forums/Blitz3D Beginners Area/Race track, load as another terrain map?

Erroll(Posted 2015) [#1]
Apologies for being super newbie, I haven't done any programming in 15 years or so and wanted to do an ode to John Anderson's Rally Speedway game on the Atari 8-bit.

So I have the car mesh loaded in and the terrain (no height map at present).

I was wondering if I should just load the track in as a second terrain, if that is possible to do? Then depending on where it is colliding, it could slow down if on the grass.

I will be going through the code base and checking everything out.


Matty(Posted 2015) [#2]
There are many ways of doing this. However rather than using a second terrain have you considered multiple textures instead? Layered with alpha?


Volturna(Posted 2015) [#3]
Hi Erroll,

Somewhere in time i did a similar project. I dont recall many details but my terrain was a single mesh with a single texture (huge texture) and then i loaded some objects for collisions (trees, houses, boxes, etc). Track was painted in texture.

When the car gets out of the track you need that information to slow down speed and for some effects (grass or dirt clouds).

For that i created an image from my terrain texture (much smaller) with 2 colors. Red for the track and green for everything else.

While you do the car loop you must pick the color on that image to know if car is out or in the track.

Notice that you have 2 images with different sizes so you need to convert your xy coord when picking color.


RemiD(Posted 2015) [#4]
The track can be directly drawn on the color texture of the terrrain
or
The track can be made of one mesh one surface with a flat subdivided mesh aligned over the terrain depending on the terrain heights.
Similar to a trail... See the tron example in the samples.
Something similar to this :
https://www.youtube.com/watch?v=iffuQ3nuh6U&t=30s


Erroll(Posted 2015) [#5]
Thanks for the responses guys, it helps.