berniw torcs driver readme

## berniw development snapshot for torcs-1.2.0

### 1.0 what is berniw?

berniw is a car driver for the open racing car simulator, look at torcs.org. at this place i would like to thank the developers of torcs, i had a lot of fun during the development of this driver, they do a great job:-)

### 1.1 license and download

gnu general public license 2. anyway, please don't look too hard in the code yet, or my reputation will be lost...;-). download the latest version berniw20020125.tar.bz2 here (it's more recent than the one included in 1.0.0). if you get the CVS version of torcs, you don't need this package, berniw is already included.

#### 1.1.1 older versions

- berniw20011225.tar.bz2 for torcs 1.0.0.
- berniw20011103.tar.bz2 for torcs 1.0.0-pre7.

### 1.2 how do i install berniw?

so, first you need a working version of torcs 1.2.0 under linux with sources installed. i assume in this instructions the following:
you have the permisson on the system to do the needed tasks. the torcs sources are in /usr/src/torcs/torcs and the installation is in /usr/local/games/torcs. in case you use other directories, just replace this directories with the ones on your system. i also assume that the berniw20020125.tar.bz2 is in your home directory.
first export the following environment variables (for bash):
export TORCS_BASE=/usr/src/torcs/torcs
export MAKE_DEFAULT=/usr/src/torcs/torcs/Make-default.mk
now change to the drivers directory:
cd $TORCS_BASE/src/drivers
unpack the berniw package (where YYYYMMDD means the version you got, eg. 20011225):
tar xfvI ~/berniwYYYYMMDD.tar.bz2
compile and install:
cd berniw
make
make install
if you discover trouble send me a mail to berni4you@gmx.ch.
run it:
cd /usr/local/games/torcs
./torcs
now choose a berniw, have fun.

### 1.3 features

- pit stop.
- simple collision avoidance.
- stays quite good on various tracks.
- overtaking.
- let opponents overlap.
- pit speed limiter.

### 1.4 todo

- improvment of letting overlap.
- prepare flag and rule handling (todo is just yellow flag, and perhaps drive through).
- better strategy.
- improve stability (of car, not of the code).
- review the code and choose better names for variables/procedures, improve comments.
- replace quick hacks with serious routines.
- communication between berniw's.
- improve behavior model.

### 1.5 would you like to get involved?

if you are interested, you can tune the setups for the cars. they are in the berniw 1-10 directories, named according to the track. if you have a good one, it's welcome, of course (berni4you@gmx.ch).

### 1.6 contributors

- windows port has been supported by my brother michael.

### 1.7 changes

#### till 30. dec. 2002

- fixed array index underflow.
- improved gear changing, it uses now enginemaxrpmRedLine instead of enginemaxrpm.
- setups.
- improved overlapping support.

#### 8. dec. 2002

- reduced trajectory footprint, pathfinder.*.

#### 4. dec. 2002

- changed correctpath(), takes now actual car direction to compute trajectory instead of parrallel to the track.
- setups.
- new skin for berniw 2-7.

#### 21. nov. 2002

- basic overlapping support.

#### till 19. nov. 2002

- setups.
- berniw 5 changed to gt-40.
- berniw2-7 changed to porsche-gt3.
- skin for berniw 5.

#### till 10. oct. 2002

- setups.
- berniw 2-10 changed to 360-modena.
- changed skins of berniw 9 and berniw 2-9.
- some changes in breaking code.

#### 3. sep. 2002

- added pit speed limiter.

#### 26. jun. 2002

- changed some parameters in mycar.cpp to improve starts.
- some setups.
- changed braking code.
- changed overtaking.

#### 25. jun. 2002

- changed ABS from take care of average slip to maximum slip.
- some setups.

#### 22. jun. 2002

- make use of curbs and concrete patches in turns.
- minor performance improvment.
- rearranged some code.

#### 21. jun. 2002

- changed some methods in TrackSegment, to access original data and get rid of local copies. with this i hope to get more cache-hits, because few data is accessed often, and reduce the memory footprint.
- changed some setups.
- improved performance of distToMiddleOnSeg(), distToMiddle().

#### 19. jun. 2002

- changed pathslope() for better connection between spline and track.
- removed connection smoothing.
- fixed one of the "stop and go" bugs in overtake().

#### 18. jun. 2002

- made overtaking more aggressive.

#### 16. jun. 2002

- some setups.
- changed parameter MAXALLOWEDPITCH to fix crazy behaviour on a-speedway (mycar.cpp).
- some changes in steer code (berniw.cpp).
- changed overtaking, tried to compensate "noise" from interpolation.

#### 12. jun. 2002

- some setups.
- some old stuff removed and small changes in overtake code.

#### 20. mai 2002

- minor change in overtaking code.
- minor cleanups.

#### 17. mai 2002

- commited windows port.

#### 12. mai 2002

- fixed bug #554910 (hopefully...).

#### 10. mai 2002

- added "anti fly code".

#### till 9. mai 2002

- merged with torcs 1.1, eg. no frontwing anymore, etc.
- added some updates for efficiency.
- changed berniw 3 to porsche-gt1.
- fixed a minor bug in my aerodynamics stuff.
- experimental windows port. - ...

#### 12. mar. 2002

- continued cleanups, introduced linalg.h to put vector stuff into it. messed a bit around with overtaking and breaking code.

#### 4. mar. 2002

- starting major cleanups in mycar.h, mycar.cpp.

#### 21. feb. 2002

- bugfix in collision(), minor changes.

#### 29. jan. 2002

- little overtaking code change, which should avoid some obiously bad overtaking attempts.

#### 25. jan. 2002

- minor changes and cleanups.

#### 4. jan. 2002

- minor cleanups (comments, regrouped some code, ...).

#### 29. dec. 2001

- tried things out (speed dependent margins, ...), improved overtake().

#### 27. dec. 2001

- did some testing, races are with new overtake more spectacular, so the show improves;-).
- texture for viper.
- setups for acura-nsx and viper on e-track-4.

#### 26. dec. 2001

- improved and changed overtake() a bit.
- setups for acura-nsx and viper on e-track-1.

#### 23-25. dec. 2001

- tried to improve overtaking and breaking, try it out.
- reworked some code, later a merge of overtake() and collision () has to be done for efficiency.

#### 19. dec. 2001

- added a viper (berniw 4), setups and texture are not done.
- added an acura-nsx (berniw 3), setups and texture not done.
- minor code cleanups.

#### 18. dec. 2001

- Eric released torcs 1.0.0. hurray:-).
- just played a bit with the setups of my cars.

#### 17. dec. 2001

- added defines in pathfinder.h. you can now choose the trajectory on compile time through defining PATH_K1999 or PATH_BERNIW. if you choose none, the driver will drive on the midde of the track. if you choose both, first a berniw path is generated, then a K1999 optimisation is performed. the reason for having two path's handy is, that you can check, if an idea is "in general" good, and not just on one path.
- added support to take care of bumps (ala dirt-2).

#### 15. dec. 2001

- hopefully fixed the SIGSEGV bug.

#### 13. dec. 2001

- fixed a potential bug (never appeared in tests:-)).
- cleanups.

#### 12. dec. 2001

- performance improvements.
- newlines at *.cpp, *.h files, strange, my gcc 2.95.3 didn't complain?!.
- make all ready to deploy to cvs.

#### 10. dec. 2001

- added path finding from Remi Coulom, K1999.cpp, (c) by Remi Coulom.
- make all ready to deploy to cvs.

#### 7. dec. 2001

- simple overtaking.

#### 4. dec. 2001

- setups for berniw 9, so it stays on every track.
- little strategy (refueling: laps behind leader) change in berniw.cpp.

#### 28. nov. 2001

- finished setups for eroad, e-track-4.

#### 26. nov. 2001

- setups for berniw 1-9, eroad, e-track-4.
- textures for berniw 6-8.
- handling of rwd, fwd and 4wd.
- moved some code.

#### till 25. nov. 2001

- moved berniw 10 into a buggy.
- moved berniw 9 into a mc-laren-f1.
- moved berniw 8 into a corvette.
- moved berniw 7 into a lotus-gt1.
- moved berniw 6 into a 155-DTM.
- new setups for berniw 1-5 (brake balance).
- cleaned up old stuff.
- added some trajectory code (not used yet).
- bug hunting, reporting.
- berniw becomes integrated into the torcs CVS:-).

### 1.8 how does it work

#### 1.8.1 let opponents overlap

1. the opponent needs to be nearer (e. g. distance < 50m) than a certain threshold, then a timer gets started.
2. if the distance becomes again greater than a threshold (e. g. distance > 80m), then the timer is reset to zero.
3. if the opponent is nearer than another threshold (e. g. distance < 15m) and the timer value is greater than e. g. 10s, let him pass.