Even if urbanski is a good example of a minimalistic implementation that
can be used for learning, it is far from a competitive driver and is
highly prone to crash in race, which would affect user experience
negatively.
Therefore, it is better to leave the source code available for reference
purposes, but do not include it into the build so that urbanski-drivers
cannot be selected.
Former-commit-id: 277281ef785291f0e7deb262e2c2c3b8f9cffc3b
Former-commit-id: efde653b918a8a4df65ac23b15025e4aeefc9275
These drivers are considered obsolete and were not even built any more.
Former-commit-id: 951cff0a690a7fe9320ed767863495266bac5159
Former-commit-id: 923e07a5ee892d5dab22593934c98958fdd63ed7
Having statically allocated buffers in this context was not only
unnecessary, but also dangerous because these strings would be shared
among all TDriver instances, even if they really should not, since every
TDriver instance belongs to a different driver, and therefore different
parameters.
Also, since racing lines are now dumped into JSON files, it makes sense
to reflect this into the file extension, too, so that text editors can
easily recognise the syntax.
Former-commit-id: 3421b724bfc040f288fe61ffc0fc78fe5a25cd4f
Former-commit-id: 0844542eecaa950c1f96a860e2fcd21d6807059a
Since oPathPoints is defined as a std::vector, dumping TPathPt instances
as Plain Old Data is not valid any more. In fact, C++ compilers would
already warn that offsetof(3) could not be safely used with TPathPt
members since it never was Plain Old Data, but this warning was
suppressed only because raw pointer manipulation had been used instead
of offsetof(3).
On the other hand, dumping binary data is inherently non-portable and
not human-readable, so this commit suggests to dump such data in JSON
format, as cJSON is already used by the project and XML is bad, among
many other things, to store arbitrarily large arrays.
Former-commit-id: 4a447adb452dd9ae85ca4cce9993cbe9ad0487f6
Former-commit-id: b462a614ed53f1938eadb4680a10ef57576b29d9
Otherwise, copying TLane objects using the default copy operation would
not be possible.
Former-commit-id: be7ac7e2191792ad8e43766ea39f745591f10916
Former-commit-id: 4d17b9524cd539c0dca0220108dea1d7a38e9f9b
- Replace some non-const-correct char * to std::string to avoid
potential dangling pointers and manual memory management.
- oCommonData was deemed redundant, so unitcommondata.{cpp,h} have been
removed.
- There was no need to define non-default destructors or operator= for
TCarParam.
- oSideScaleMu and oSideScaleBrake were always set to 0.95f instead of
0.97f by all categories, so assume these values as defaults and remove
both TDriver::ScaleSide and these variables altogether.
- Since robots now allocated driver data dynamically i.e., without
any arbitrary limits, oExtended was deemed redundant.
Former-commit-id: 6f64dba41e036e37345bfba1d2de75bdb347a976
Former-commit-id: bd10700dae55653ef15936f3613c942a8ec753a7
Similarly to other driver implementations, simplix relied on
arbitrarily-sized buffers to store driver data, instead of allocating it
dynamically.
Furthermore, simplix relied on having per-category copies of its shared
library (e.g.: simplix_ls1, simplix_sc) to perform per-category
initializations and store them into statically allocated variables.
This has been fixed so that per-category initializations are perfomed
from the driver side, which means that one shared library can be used
for all car categories.
Since drivers are now re-indexed on every call to GfDrivers::reload,
IndexOffset is no longer needed.
Former-commit-id: f621a13850e08c9f36c90286d6548ed0c117290b
Former-commit-id: 6d93fe0a4d4130712e08a1d75336b4286bcf3039
Most of dandroid's private parameters are shared among cars and even
entire categories, and only a small fraction of such parameters are ever
changed.
Therefore, this commit suggests sane defaults so as to remove all
redundant parameters in order to greatly simplify dandroid-based driver
parameters. Also, it adds the possibility to set per-category
parameters.
Former-commit-id: a052f11ff35809692afbc17c62c62efc65e00412
Former-commit-id: e98696da43da0967a8af167540da4733754f71ce
C++ requires members to be initialised in the same order as they are
listed on the class definition. Otherwise, some compilers might throw a
warning message.
Former-commit-id: 3e05446ec7f0924384c84fe521800bac7a685cfb
Former-commit-id: 51f964c03df3bc1fd5988db2a39acae7984e5531
So far, usr would crash the game if parameters were missing for a
specific car, track or weather code. Since dynamically generated
drivers introduce a combinatory explosion, it is no longer acceptable to
crash on missing parameters, so now sane defaults are assumed.
Former-commit-id: 7975c8252737cd565fad3a1abb8b8684f8628782
Former-commit-id: ed19385aa318ffd24e86b254ebe75aac45657540
Robot clones were shared library duplicates with a different name that
the game would rely on to perform different actions based on the car
category.
Not only this was a hacky solution, but it also involved around 50
extra libraries loaded into the game, which means higher resource
consumption and slower startup time, as well as making driver management
more difficult to the much higher of directories involved in
data/drivers/.
Now, only 1 shared library per robot is defined.
Former-commit-id: 4c5141000bc9b46363a16c0928e90b14f40a430a
Former-commit-id: 773f3d6987da3f6ef8e78e0f0276e2d4bf2b07f2
Career mode was meant as an alternative championship mode with
dynamically generated drivers, but it is now redundant since dynamically
generated drivers are available to all racing modes.
Former-commit-id: 6f989742df5d35d8ac578e9e985653387585ec8a
Former-commit-id: ae91a723182e29f2ded228dfcc6da9466a950fe7
Dynamically generated drivers have introduced a few breaking changes:
- Now, all drivers, whether generated or not, are stored into
GfLocalDir.
- Driver indexes, and therefore directory names, are recalculated every
time GfDrivers::reload is called, so the in-game must find the next
available index number on a given subdirectory.
- As a consequence of this, the file-based timestamp mechanism used in
cars and tracks cannot be used for drivers, since the directory name can
(and will) change at any time. Instead, GfDrivers::self() is looked up.
Former-commit-id: 05dcbec981a449be50e8656f105481b77881508b
Former-commit-id: c965c211b9e427f37317c84c16a6746f1b817eff
shadow's LearnedGraph relied on manual memory management and non-default
copy operators, which is error-prone (in fact, m_pAxis was being leaked)
and does not provide any benefits over std::vector.
Former-commit-id: 0ade39d572f94ba718556072a2ea3da15b9aabfe
Former-commit-id: ef035240597399743265a4c17a2ee47399956976
Defining a m_pShared as a per-object pointer that always points to the
same object is redundant, and can introduce a risk for dangling
pointers.
Instead, s_shared (now, m_pShared) has been defined as a static member
in Driver.
Former-commit-id: 1f0baed4cfba1ddc47dc905d1791780164a23cc7
Former-commit-id: 7f8bdec56810b51ed8dde0d76e5aac4d462e6e87
An excessive use of operator= overloads was defined so as to copy
common parameters from Path-derived classes, such as ClothoidPath and
PitPath. However, this could be simplified since the default copy
operator would suffice.
Former-commit-id: c8954549c68036713840357c6851aec68ce713cb
Former-commit-id: bd91f618590a9f3dcc1c5cfec2ae995536840526
Even if shadow was defined with OOP in mind, for some unknown reason
Driver::Drive relied on a statically allocated array with an arbitrary
size of MAX_MOD_ITF elements (20). Because now the game supports a
virtually unlimited number of drivers (aka interfaces), it was possible
to read past the last_srslip array and cause undefined behaviour.
As hinted above, this array did not make any sense since last_srslip
should be part of each Driver object, and not a statically allocated
array.
Former-commit-id: e365060392b1d08c40a1e3d27f0e113d5a31594d
Former-commit-id: d8954641d78f83d198493e7cb36ffe3db9ef0a55
Since driver indexes are now recalculated every time GfDrivers::reload
is called, they can be no longer relied on. Instead, driver names are
now used to find a specific driver, since names are set on creation.
Former-commit-id: 7a1d950db421e3cffee05736e0c31948cf534e4c
Former-commit-id: a6e0b38cbffb89ee9a47c1da926fc5959f1b7424
Driver parameters (name, short name, code, etc.) are now stored into
GfLocalDir by GfDrivers::reload.
Former-commit-id: c02545750adda862a4c31f837dc6e710a256cdb7
Former-commit-id: a258d6510bb7da1402b3fca3e82a2d1d7a56a2f3
So far, every robot would set up an arbitrary limit on the number of
drivers that could be defined. Not only it was an inefficient approach
because of the fixed-size statically allocated buffers this would incur,
but also there is no reason why this should not be allocated
dynamically.
Now, the internal data structures for each robot are generated
dynamically depending on the number of drivers defined by its parameter
file.
Former-commit-id: 65682fb3d457e2a38fe62cd5b2f00e908bb6aca8
Former-commit-id: 10d86064d066c96f0061080b9ec817e39548277f
Since drivers can be now dynamically generated and this requires write
permissions, they are now always stored into GfLocalDir instead of
GfDataDir.
Former-commit-id: 2dac3225c4710caa2afa5da36cbbe5a9b86d3be8
Former-commit-id: 317f9d9b04b4ff7f78e3da15c82f1b77c894415c
Now, drivers from any category, robot type or car model can be generated
or deleted from the driver selection menu.
Former-commit-id: 41f2eec41a9ce23d84fe3779c496223c5a19da9b
Former-commit-id: 1957959d6bb70cc75caf980e9931c089b3d0d17c
Since cars can be now downloaded from the in-game download manager,
the internal list of cars must be updated without having to restart the
game.
Former-commit-id: 0f5f9a71ad85129e7640df853cbdf9e917c4e5a8
Former-commit-id: c9482b032444635021a00970310ccca57d49fe50
Future commits will simplify the current directory structure of
per-category robot directories (e.g.: "dandroid_ls1", "usr_mp5"),
instead only having one directory per robot (e.g.: "dandroid", "usr").
Therefore, these exceptions must be removed so that drivers can still be
looked up.
Former-commit-id: 390647d05f9d09d0976a475e836a21015a40c785
Former-commit-id: 060cde8bb168ef7a4a57420911097e6e205bcb29
This should fix some of the leaks as reported by:
https://sourceforge.net/p/speed-dreams/tickets/1297/
Former-commit-id: 5f077f2955f87078eca94048fba8093c066f3e25
Former-commit-id: ade4ccc2a849bbd45bb3e864f21fa9bafd3c3d93
Future commits will make use of this tag.
Former-commit-id: 9a47827be752dccb90f977215b366e2e728a044d
Former-commit-id: d1c9f47d0b7b19f8dfbcb9c241a16dae7969b461
While it is true that FList::unknown equals zero and therefore it is
implicitly initialised by the prior call to calloc(3), it is still
advisable to initialise it explicitly for enhanced readability.
Former-commit-id: 6ca4ae3b6e8aca4ac2bb2c3553f75f98247cfccf
Former-commit-id: 48006ca77dbe6faf4c0e41c3d3bafc0fb6f82ef2
Regular files in Windows might not only include the _A_NORMAL attribute
[1]. In fact, experiments with WINE revealed that most files would in
fact include the _A_ARCH attribute.
Otherwise, most files would default to FList::unknown and therefore
functions relying on FList::file would not work.
[1]: https://learn.microsoft.com/en-us/cpp/c-runtime-library/filename-search-functions?view=msvc-170
Former-commit-id: 4fb5d0a07fe84b67ebe6541a7e0c9bc630579b42
Former-commit-id: 6dc6253ef0a737ab1c7881adc9b02088e7722243
- Improved overtaking response to slower cars
- Greatly reduced lifting of throttle when letting faster cars past
- Improved tire selection capability for both race starts and during pit stops, depending on both track temperature *and* race length
- Shifting point is now adjustable. Use parameter "shift up point" (range: 0.01 - 1.0)
- Improved tire change strategies. Bots will now pit when their most worn tire reaches "Pit Tire Wear Threshold" (range: 0.0 - 100.0, default 25.0). If they do not reach this point when they pit, they will change tires anyway if the remaining life is less than 2x this threshold value.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9647 30fe4595-0a0c-4342-8851-515496e4dcbd
Former-commit-id: a2cf9acfa90744298531d98e9fb4bd135fe356e2
Former-commit-id: 73064a7ada0a992c0282ef4ef3ce345f618bf541
Also roll back a change to tire pressure that caused strange behavior with very small cars, like karts.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9629 30fe4595-0a0c-4342-8851-515496e4dcbd
Former-commit-id: 0cf90392430b237ee451169ed8e86c8f924b992e
Former-commit-id: 99fc40c6f0dcbb44c1ba4390dc32ef62b95d8146
According to the documentation, applications using SHFileOperation
should only check for zero or non-zero. Moreover, the return values for
SHFileOperation are marked as not reliable or stable. [1]
Because of this, it is not possible to achieve the same behaviour
between Win32 and POSIX for portability::rmdir_r.
[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationa
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9627 30fe4595-0a0c-4342-8851-515496e4dcbd
Former-commit-id: 5dcfb5a9d09f1b2b1509d50f3a3d842d140161d6
Former-commit-id: a19aa1200ed65c285e9649d8050fb1a8ee0d227e