SimcarStunts SDL3 - Car simulation with software 3D rendering and program for
                    viewing the tracks

Copyright 2010-2025 Matei Petrescu


The files here, except for the ones in directories "sdata1" and "sdata2",
which are 3D models from Stunts, for the tracks (and are not free(?)), are
available under the GNU GPL license, version 3 (see the file "COPYING.txt"
for details).


     1. INSTALLING THE GAME AND VIEWING THE TRACKS
     2. RUNNING THE GAME
     3. SOME DIFFERENCES BETWEEN SIMCAR AND STUNTS
     4. CHANGING THE CARS


1. INSTALLING THE GAME AND VIEWING THE TRACKS

This version requires SDL 3. If you have a new GNU/Linux distribution, you can
probably install some SDL3 and SDL3-devel files from some repository.
If you don't have SDL3-devel installed, download and install cmake and SDL 3:

https://cmake.org/download/

Get the source code - for instance: file cmake-4.1.2.tar.gz

https://www.libsdl.org/release/

Same here, for instance: SDL3-3.2.24.tar.gz

Extract the archives and install the programs. You can install them in
directory /opt/local or anywhere else you want, or simply not specify any
directory and let them install in the default locations. First:

cd /opt/
su -c 'mkdir local'
su -c 'chown username local;chgrp username local'

Enter directory cmake-4.1.2, with command cd, and type:

./configure --prefix=/opt/local/cmake
make
make install
cd ~
ln -s /opt/local/cmake/bin/cmake bin/cmake

Directory ~/bin should be in your path, check by typing:

echo $PATH

Then enter directory SDL3-3.2.24 and type:

cmake -DCMAKE_INSTALL_PREFIX=/opt/local/SDL3
make
make install

No need for "mkdir build" and "cd build". If you don't have SDL3 mentioned
above installed (which should work in these conditions even without
SDL3-devel), type:

su -c 'ln -s /opt/local/SDL3/lib64/libSDL3.so.0 /usr/lib64/libSDL3.so.0'

Then enter directory simcarstuntsSDL3 and type:

cd graphics
./comp
cd ..

This compiles the graphical functions, for which you can configure some
options in file grconfig.h. You can also edit files comp from directories
graphics and simcarstuntsSDL3. Then:

./comp simcar

And the program for viewing tracks:

./comp viewtrack

Run it:

./viewtrack tracks/track1

Then compile the programs for converting track files from game Stunts (1990):

gcc src/convtrack.c -o convtrack -Wall -W

gcc src/cvtrkst.c -o cvtrkst -Wall -W

Run them:

./convtrack trk/r4k12.trk track1

./cvtrkst trk/ZCT020.TRK track1

You can run them for any track made for Stunts (1990), which you edited or
downloaded from the internet. Any converted file can be used to view the track
with the program "viewtrack" mentioned above, or for playing with the track in
the game, i.e. copy the file into directory "tracks", add its address to file
"config", where the total number of tracks is also specified, and start the
game. The first converter creates files suitable for using them the game and
the second converter creates files for viewing tracks that look like in Stunts.
Although files created with both converters can be used for both purposes, see
"some differences between Simcar and Stunts" below.

The first 19 tracks available here (and converted) were created by Cas and are
available at https://www.raceforkicks.com/.


2. RUNNING THE GAME

First, open a terminal/console window and change the current directory to
"simcarstuntsSDL", using the command "cd". To change the screen size you can
modify numbers 800 and 600 in file "config".

After compilation, you can start the game by typing:

./simcar

The tracks available in the directory "tracks" can be replaced with tracks
converted as previously described.

The parameters of the cars can easily be modified. Below are a few details
about the 4 cars:

car1: open wheel, rear wheel drive, with wings which generate downforce
car2: open wheel, rear wheel drive, without wings
car3: rear wheel drive
car4: 4 wheel drive

All cars are electric and therefore don't need gearboxes. The 3D models were
imported from TORCS (http://torcs.org) and Speed Dreams
(http://speed-dreams.org).

The buttons which control the car are:

Q or UP - accelerate
A or DOWN - brake
O or LEFT - left
P or RIGHT - right
SPACE - handbrake
S - rocket; useful on tracks made for Stunts, which are reproduced here
R - reverse
C - change camera
N and M - rotate (the 3rd) camera
ESCAPE - exit

From the documentation of Stunts (1990):

"THE JUMP

You'll need to gather speed for this, but don't overrun the down ramp, or your
bumpy landing may cost you time. Best speed is between 90 and 130 MPH. Yes, you
can hit the cables and crash."

Some recommendations:

To jump in Simcar between 2 ramps with a track square between them, the takeoff
speed should be around 80 km/h with cars 2, 3 and 4, and 100 km/h with car 1,
which, as mentioned above, has wings which generate downforce. Use the rocket
before taking off and maybe a little after, if the jump is longer. If the jump
is 2 squares long, use the rocket until ~100 km/h with cars 2, 3 and 4. With
car 1, start the rocket at the base of the ramp and accelerate until ~170 km/h.
If the track element on which you must land is at a lower height than the ramp
from which you jump, with car 1 accelerate from the base of the ramp element,
without the rocket, until 55...60 km/h and with cars 2, 3 and 4 use the rocket
shortly to reach that speed, if necessary. Before landing you should also use
the acceleration, brake and maybe steering, to control the car's landing
position.

As can be noticed, the documentation of Stunts (1990) highlights the fact that
the speed indicated on the screen is higher than the actual speed of the car.
The cars in Stunts are ~1:2 scale models (you can look at them from outside to
see that), so this was to be expected. Example:

https://silodrome.com/ferrari-250-gt-california-child-car/

The page is also available at web.archive.org. For larger cars, you can play
with my game.

Another recommendation would be that you use keys Q, A, O and P instead of the
arrow keys to control the acceleration and brake with your left hand and the
steering with your right hand, so that you always have fingers on these
controls. I also noticed that the arrow keys are rather unusable on some laptop
keyboards.


3. SOME DIFFERENCES BETWEEN SIMCAR AND STUNTS

The documentation of Stunts is in file "StuntsManual.txt", available here. A
quote from the documentation, chapter "BUILDING YOUR TRACK":

"BASIC BUILDING BLOCKS

Palette 1 contains the basic building blocks of tracks, including straight
East/West track, straight North/South track, [...]

DIRT TRACK

Palette 2 contains the same pieces as Palette 1, except that the road surface
is dirt rather than asphalt. [...]

ICY TRACK

Palette 3, like Palette 2, contains the same pieces as Palette 1, except that
these pieces have ice-surfaced roads."

Stunts (1990) has 3 types of track elements: "asphalt track", "dirt track" and
"icy track". In principle, these types of track elements should have different
friction coefficients, but Stunts doesn't model friction nor the wheels of a
car, being a game made in 1990 for much slower computers. A quote from the
interview with the main programmer, Kevin Pickel, 2003, same file:

"The skidding code was actually easy, the hard part was making it so the skid
happened gradually and the user could try and stop it from happening."

"The skidding code" in Stunts is for artistic effect. In Simcar here, the
wheels are modelled as well as the friction between them and the road. The
friction coefficient is in the file with the parameters of the car. The
coefficient is always the same, so in Simcar there's only one type of road and
program "convtrack" mentioned above converts "dirt" and "icy" track elements
into "asphalt" track elements. In principle, the other types of track elements
could also be used, but parameters "accel" and "brake" of the car, besides the
friction coefficient, should also be modified to make the car drivable with the
keys.

https://en.wikipedia.org/wiki/Traction_control_system

Program "cvtrkst" is useful to convert a track file to be viewed with
"viewtrack", the resulting image having all 3 types of track elements
represented as in Stunts. The file can also be used in the game, but all the
pieces of road will have the same friction coefficient, regardless of their
colour. If you want traction control or support for a joystick or steering
wheel, the game is free and the source code is here, so you can add or modify
anything you want, if you know how.


4. CHANGING THE CARS

The files which define the parameters of the cars, from directory "cars", can
be edited. After "objects n", the numbers on each of the next n lines have the
following significances:

1st: object type, from the list above;

2nd: object function (1 - body of vehicle, 3 - motor wheel, 4 - steering wheel,
     5 - motor and steering wheel, 6 - wheel);

3rd, 4th and 5th: initial coordinates on X, Y and Z;

Axes X, Y and Z are like this (not like in OpenGL):

^ X   __
|     /| Z
|    /
|   /
|  /
| /      Y
|-------->

6th: the radius of the sphere which models the object; in the physics
     simulation, all objects are spheres;

7th: density of the sphere;

8th: elasticity coefficient for contact with the terrain;

9th: friction coefficient.

If the simulation doesn't run properly (or at all), reduce the 8th coefficient
or increase the 6th or 7th coefficient. The rest of the parameters have names
clearly written in the file.

New cars can also be made. Some more 3D models for cars are in game Skunks
(https://matei.one) or you can create your own models. After making a new car,
add the address of the file which defines the parameters to file "config" here,
where the number of cars is also specified.
