Licar - Toy car simulation with software 3D rendering (no 3D accelerator
        required) - copyright Miloslav Číž

Track editor for Licar - copyright Matei Petrescu


For information about window$ you can read WINDOWS.txt. The recommendations in
this file are for GNU/Linux.

The files from directory tredsrc/graphics are available under the GNU GPL
license version 3 or later (see file COPYING for details), and as far as I'm
concerned, the other files too unless Mr. Číž mentioned above specifies
otherwise.


     1. LICAR
       1.1. INSTALLATION
       1.2. RUNNNING
     2. TRACK EDITOR
       2.1. INSTALLATION
       2.2. RUNNING
     3. ETC.
     4. DOWNLOAD LINKS


1. LICAR

1.1. INSTALLATION

X11, SDL 2 or SDL 3 is required (see file SDL.txt), make sure you have one of
them installed. An executable file called licarx, which was already compiled
for GNU/Linux and SDL 2, is also available. To compile the game open a
terminal/console window, change the current directory to toycar and type:

./comp

You will have to select the desired options shown on the screen. Example:

Resolution (pixels):
X=
640
Y=
440
Image quality (1...5):
5
Library:
1. X11
2. SDL2
3. SDL3
Select option (1...3):
2

If compilation is successful, the executable file licarx will be created.

1.2. RUNNING

First, open a terminal/console window and change the current directory to
toycar, using command cd. After compilation, you can start the game by typing:

./licar

or

./licarx -f0 -z1 -c2

Options -f, -z and -c are for full screen, zoom (make image larger) and
selecting camera. The options can also be edited in text file licar. For help:

./licarx -h

The buttons which control the car are:

W or UP - accelerate forward
S or DOWN - accelerate backwards (works like braking when moving forward) or
            stop rotating and reduce horizontal speed a little while flying
A or LEFT - left
D or RIGHT - right

Other buttons:

K or Enter - select an option from a menu or go back to the start position
             while driving
L or Esc - go from driving to main menu or back

The documentation of Licar is in file src/media/manual.txt, which says:

"- It's possible to stop the car from rotating mid-air by pressing brake."

This method of stopping the rotation instantaneously by pressing S or DOWN is a
quick-fix for the absence of the wheels' rotational inertia, which, along with
Newton's 3rd law of motion, could have been used to properly control the
rotation of the simulated vehicle. From file src/tinyphysicsengine.h, line 423:

"/** "Fakes" a rotation of a moving sphere by rotating it in the direction of
its movement; this can create the illusion of the sphere actually rotating due
to friction even if the physics sphere object (a body with a single joint)
isn't rotating at all."

From file TPE20261/README.md:

"This is tinyphysicsengine (TPE), a small, [...] fixed point physically
inaccurate pure C header
[...]
## features
[...]
- **no floating point**, only 32 bit integer (fixed point) math"

So some limitations are probably justified by the use of only integer numbers.
From file src/media/manual.txt again:

"The objective of every map is to drive from start to finish (red octahedron)
as fast as possible while collecting all the checkpoints (CP, green octahedron)
along the way (in any order)."

Actually it doesn't matter how fast you drive, but if you drive through all
those green things and then get to the red thing, you can press Esc, save the
replay and watch it. File data includes some already saved replays, which you
can watch if you're interested. To delete a replay you can open file data with
a text editor and look for the replay at the end of the file.


2. TRACK EDITOR

2.1. INSTALLATION

SDL 1, 2 or 3 is required, see file SDL.txt. Make sure you have one of them
installed. To compile the graphical functions edit, if necessary, lines 23-26
in file tredsrc/graphics/genconf.c. Then enter directory tredsrc with command
cd and type:

./comp-graph

Select the desired options and type:

./comp tred

If executable file tred is created, you can copy it into directory toycar,
where an executable file already compiled for SDL 2 is also available.

2.2. RUNNING

From file src/media/manual.txt:

"Where supported, the game uses a so called data file to store data such as
maps, replays, [...] that's usually located in the same directory as the game's
executable and which is called just 'data'. It's a single text file, and so
it's possible to open it with any plain text editor.
[...]
~~~~~ MAKING CUSTOM MAPS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maps are stored in the data file. For its simplicity the original game doesn't
come with a 'user-friendly' GUI map editor (perhaps some will be made over
time),"

It does now. To make a new track enter any directory which contains program
tred (ex.: toycar or toycar/tredsrc) and type:

./tred

From file src/media/manual.txt again:

"In the game a map is represented as a 64x64x64 grid of cells, each of which is
one unit in width, one unit in depth and HALF a unit in height. Each cell can
hold a map block. There are several types of blocks such as ramps, walls,
corners etc. The whole map is composed of these blocks."

To modify a block with the track editor, select the desired type with Y and H,
then select coordinates X, Y and Z with keys W, A, S, D, T and G, then select
material with M, rotation with R and type of flip with F, and then press Enter
to use these parameters for the selected block. The current settings of the
selected block and the desired settings are displayed on the screen. To save
the track in a file and exit press Q or Esc and type the desired name of the
file, which can be, for instance, data, if program tred is in the same
directory as the game's executable - don't forget to first rename the original
file data to data0 or put it in some other directory, so you don't lose it.
Only one start block must be put in the grid (won't work otherwise) and the map
which was saved in file data can be checked by starting the game, pressing
right arrow once and selecting the second map from the menu. The first map,
LC1, is described in the source code (file src/assets.h), not in file data, so
even if file data doesn't exist, one map will still be available. To edit a
track, type:

./tred trackfile

or

./tred data

if you saved the track in file data.

When you're finished editing the track you can rename file data to, for
instance, track17, copy its contents into the original data file and rename
that file back to data.

Files track1 and track2 from directory datafiles were created with this editor,
so you can use the editor to look at them and edit them. However, one type of
block supported by the game but not by the editor is called "mirror copy along
each major axis" (see file tredsrc/src/tred.c, line 44), so the other tracks
from directory datafiles, except for LCbonus1 which doesn't contain this type
of block, can not be accessed properly with the editor.


3. ETC.

To change the music that plays during the game, see file assets/README.txt.

The functions used for graphics and physics are in files src/small3dlib.h and
src/tinyphysicsengine.h, which are modified versions of files (also available
here) S3L20261/small3dlib.h and TPE20261/tinyphysicsengine.h. Only integer
numbers are used and the documentation is available as comments written in
these files. Some demonstration programs are available in directories
S3L20261/programs and TPE20261/programs. To compile a *.c file there, enter its
directory and type (without ".c"):

./make.sh filename

From file TPE20261/README.md:

"a completely new approach: just use soft bodies made of spheres connected with
springs and fake what is possible to fake."

From file src/README.md:

"Unlike in typical racing games there is no live multiplayer: [...] players
instead compete in a speedrunning fashion,"

So only "speedruns". Stunts from 1990 does have an option to use a computer
controlled "opponent" and so do other "typical racing games", but those games
point out the fact that the author of Licar underestimates "what is possible to
fake", i.e. most "racing games" are "arcade racing games", which means ~no
physics. In Stunts (1990) pretty much everything about the physics is fake
(except maybe for a little gravity) and some movements are predetermined (such
as the car's rotation while in the air), which is probably why the feature of
being able to drive backwards is missing, as those movements would also look
fake, besides just being fake. The feature with the "opponents" of Stunts,
however, is quite remarkable, especially for 1990, because those "opponents"
move mostly according to the same fake physics as the player and many newer
"racing games" don't even have that. Of course, in Licar, which unlike Stunts,
does have a physics simulation, computer controlled opponents would be very
complicated, not that this wasn't already complicated for Stunts. A newer game
called Tr**km**ia, from which track TMA01 available in Licar was loosely
inspired, doesn't have computer controlled opponents either, although
considering its hardware requirements it could at least have had some decent
physics simulation, which, of course, it doesn't.


4. DOWNLOAD LINKS

The game:

https://git.coom.tech/drummyfish/

https://drummyfish.itch.io/licar (requires JavaScript, not recommended)

https://git.coom.tech/drummyfish/Licar

To download:

git clone https://git.coom.tech/drummyfish/Licar

Extra stuff:

https://git.coom.tech/drummyfish/Licar-content

This version here which includes the track editor is available at:

https://matei.one/games.html

Library for 3D graphics, used in the game:

https://git.coom.tech/drummyfish/small3dlib

https://github.com/viteo/small3dlib

To download:

git clone https://git.coom.tech/drummyfish/small3dlib

Library for physics, also used in the game:

https://git.coom.tech/drummyfish/tinyphysicsengine

https://github.com/jordan4ibanez/tinyphysicsengine

Library for graphics, input and sound, used for the track editor:

https://sourceforge.net/projects/simple3d/

https://sourceforge.net/projects/simple3d/files/SDL_grf/

Other recommended driving simulations with some similarities, one of the main
differences being that a lot of floating-point arithmetic is used in them (at
least Pentium II or some other CPU with similar floating point performance
required):

https://matei.one/ - Skunks

https://matei.one/idxscr.html - SimCar

The library used for them is the same as for the track editor made for Licar.

https://en.wikipedia.org/wiki/Floating-point_arithmetic

"In computing, floating-point arithmetic (FP) is arithmetic on subsets of real
numbers formed by a significand (a signed sequence of a fixed number of digits
in some base) multiplied by an integer power of that base. Numbers of this form
are called floating-point numbers."
