implementation.txt 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. Some more or less unsorted implementation details. Some comments
  2. are included in [].
  3. 1) Collectables
  4. ===============
  5. A collectable is an object used once in each kart. It stores:
  6. - a type (e.g. zipper)
  7. - an icon (displayed in the gui)
  8. - a number (how many of this items have been collected)
  9. - can have a model (for missiles etc).
  10. The information about collectables is stored in several data files
  11. (data/*.collectables, and data/*.projectiles). The mapping from
  12. collectableType to data file is currently hard-coded in
  13. CollectableManager (look for initCollectableType and ict).
  14. When a red herring is hit, Collectable::hitRedHerring for
  15. the collectable being used in the current kart is called. When a
  16. collectable is used, Collectable::use is called from PlayerKart::update
  17. or AutoKart::update.
  18. The collectables can have different styles, for example, in some tracks
  19. they can look like a fish and in others like a box with a question mark.
  20. All herring models are stored in models/herrings and are loaded at the
  21. start of the program. The only exception are the original fish models,
  22. which are created within tuxkart. They can be specified by using the
  23. special model names; OLD_GOLD, OLD_GREEN, OLD_RED, and OLD_SILVER.
  24. The herrings to use are defined in herring style files in
  25. data/*.herring - for example:
  26. (herring
  27. (gold "goldcoin")
  28. (silver "silvercoin")
  29. (green "OLD_GREEN")
  30. )
  31. This would use the new coin models for the energy boosters, but the
  32. old green for bad collectables. Since no value is specified for
  33. red herrings, the system default will be used.
  34. The program can load up to 4 different style. First of all it loads
  35. the (hardcoded) defaults (which are the newly defined models in
  36. models/herrings). Then it will a user specified model (using the
  37. --herring command line option). Then it will load a herring file
  38. specified in the track, and if a grand prix is used, it will load
  39. the grand prix specifications last. This means, that a grand prix
  40. setting will overwrite a track setting, which in turn will overwrite
  41. a user setting, which will overwrite the defaults. This way a grand
  42. prix can specify a consistent style.
  43. To create a new herring model:
  44. 1) create the model and put it in models/herrings
  45. 2) create a herring style file in data/*.herring,
  46. which specified for which to use the model.
  47. 3) Then either specify the name of the new herring style file
  48. on the command line option (which will then become your
  49. new default, since it will be loaded), or add it to a track
  50. or cup file in data (as (herring "new-name-without-extension")
  51. 2) Projectiles
  52. ==============
  53. Projectiles inherit from Moveables. The projectile_manager
  54. maintains a dynamical list of unused projectiles (deletedProjectiles).
  55. If a new projectile is needed (because of the use of a collectable):
  56. - one projectile from this list will be used (and removed from
  57. this list) if one is available,
  58. - otherwise a new one will created.
  59. The new projectile is added to the list activeProjectiles, see
  60. ProjectileManager::newProjectile. When the projectile hits
  61. something, the 'somethingWasHit' flag gets set. This flag
  62. get tested after updating (i.e. moving) all projectiles from
  63. ProjectileManager::update. In case of a hit, a new explosion
  64. object is used (similarly from either a list of unused explosions
  65. or created newly, see ProjectileManager::newExplosion), the
  66. projectile is removed from the scene, and put in the dynamical
  67. list of available projectils for later reuse (deletedProjectiles).
  68. The speed and model of the projectile are taken from the
  69. collectable_manager (who takes this information from the files
  70. data/*.projectile).
  71. [Note: this design is a little bit awkward, since not all
  72. collectables have/need speed. A more complicated implementation
  73. might make the ProjectileManager inherit from the CollectableManager,
  74. ... - but on the other hands, that makes (imho) all further handling
  75. more complicated: e.g. depending on whether the collectable is
  76. a missile or not, different managers have to be called ...]
  77. 3) Default parameters
  78. =====================
  79. All default parameters (mostly physics related, including default
  80. kart properties) are stored in data/physics.data, and managed by
  81. PhysicsParameters, which has KartProperties as a base class, so it
  82. can automatically store all kart data as well.
  83. This class checks if all necessary parameters are defined, so
  84. missing data in data/physics.data will be detected.
  85. To add another parameter:
  86. 1) add the parameter to data/physics.data
  87. 2) add a variable to PhysicsParameter.h
  88. 3) add a call to list->get to PhysicsParameter::getAllData
  89. 4) add an initialisation to PhysicsParameter::init_defaults
  90. (this value if possible should be <-99, since this is used
  91. to detect missing values. If this value should be a valid
  92. value for the new parameter, find something else and adjust
  93. the test in PhysicsParameters::load accordingly).
  94. 5) add a test to PhysicsParameters::load to see if this value
  95. was defined.
  96. 4) Menu handling
  97. ================
  98. The ScreenManager contains the main event/redraw loop in its
  99. ScreenManager::run function. The next screen can be defined, which
  100. means that the ScreenManager will delete the current screen, and
  101. replace it with the next screen. The main loop for the
  102. ScreenManager can be aborted by calling ScreenManager::abort().
  103. There are currently two screens:
  104. - StartScreen
  105. --> background rendered image of tuxkart
  106. - WorldScreen
  107. --> Handles the display of the actual race, but is also
  108. used when the race menu pops up
  109. The screens are then mainly responsible for:
  110. - drawing the actual screen (background image for StartScreen,
  111. race track, karts etc for WorldScreen)
  112. - calling plibdrv.pollEvents (which manages all input)
  113. - calling updateGUI to handle keyboard etc.
  114. - swapping the display buffers
  115. StartScreen
  116. -----------
  117. A gui-stack (gui/BaseGUI) is responsible for handling the
  118. menus. StartScreen pushes GUI_MAINMENU on the guistack, which
  119. is the first menu. When a choice is made, the next menu
  120. (see BaseGUI the function updateGUI) is pushed on the stack.
  121. The updateGUI function then updates the current gui.
  122. When the main menu is finished, StartScreen::switchToGame
  123. gets called, either from:
  124. - start_tuxkart (profiling, quick start)
  125. - gui/CharSel (GrandPrix)
  126. - gui/NumLaps (all other racing modes)
  127. switchToGame clears the guiStack and calls RaceManager::start().
  128. There, a RaceMode object is created and start() gets called,
  129. where (after some setup) a new WorldScreen is created and set
  130. in the screen_manager.
  131. If a race is over (or aborted), a new StartStreen is created
  132. (see ::next() of all racing modes in RaceManager), and the
  133. menu handling starts again.
  134. WorldScreen
  135. -----------
  136. Similarly to StartScreen, WorldScreen::update gets called
  137. regularly by the ScreenManager.
  138. 5) Physics
  139. ==========
  140. The new physics (esp. new turning code) enables (well, soon)
  141. karts to start sliding when driving too fast in too tight
  142. curves. There are quite a few parameters which can and must
  143. be tuned to get the right feeling. All these parameters
  144. are stored in data/physics.data and can be changed with
  145. any editor - no recompilation is necessary, but tuxkart
  146. has to be started again for the new parameters to be used.
  147. Here a short explanation on how the parameters interact
  148. with each other:
  149. - Driving in straight lines
  150. The engine force is defined by 'engine-power', which
  151. results in a force pushing the kart forward. There are
  152. two forces countering this: rolling resistance (see
  153. roll-resistance), and air-resistance. Rolling resistance
  154. increases linearly with the velocity of the kart
  155. (speed * roll_resistance); while air resistance increases
  156. with the squared speed of the kart
  157. (speed*speed*air_resistance). Rolling resistance is more
  158. important at lower speed, while air-resistance is most
  159. effective at higher speed (and it's ultimate responsible
  160. for the top speed of the kart).Therefore:
  161. - engine_power and roll_resistance determine how fast
  162. a kart can accelerate
  163. - engine_power and air_resistance determine the maximum
  164. speed of the kart.
  165. E.g., to make the kart accelerate faster, without changing
  166. the maximum speed: either decrease roll-resistance (the
  167. effect to the maximum speed can be neglected); or increase
  168. engine power and air resistance.
  169. Additional effects are the tire grip and the surface the
  170. kart is driving on: tire-force*tire_grip*surface_grip
  171. is the maximum grip (tire-force = force on the tire, caused
  172. by the weight of the kart), and if the forward force is
  173. greater than the maximum grip, slipping occurs: the
  174. effective force is reduced to 40% (arbitrary value), and
  175. skid marks are drawn.
  176. - Turning
  177. Turning is implemented by computing two lateral forces
  178. acting on the tires. These forces are caused by the
  179. difference of the direction the kart is driving (velocity,
  180. which is a vector), and the direction the tires are
  181. facing. This is called the slip angle. For example,
  182. consider a kart driving in a straight line, when suddenly
  183. the steering wheel is turned left. At this time, the front
  184. tire will face in a different direction than the direction
  185. the kart is travelling, but the rear tire will still face
  186. in the same direction as the velocity. Therefore, a force
  187. will act on the front tires pushing them to the left,
  188. while no such force acts on the rear tires. As a result of
  189. this, two changes take place in the kart:
  190. 1) The force pushes the kart a bit to the left
  191. --> this is responsible for the centre of gravity
  192. to describe a circle
  193. 2) this force causes a turning moment to the kart,
  194. causing the kart to rotate to the left.
  195. Notice that these two effects are to a certain degree
  196. independent: if the turning moment is too small (close
  197. to zero), the kart will be sliding to the left, but not
  198. actually face in the direction. If the turning moment
  199. is too big, the kart will rotate too much - not facing
  200. the direction of travel either.
  201. Later in the turn the behaviour is quite similar, except
  202. that the rear tires will (usually) face in a different
  203. direction than the velocity, causing a force there as
  204. well. So the correct description is:
  205. 1) The sum of the forces on the front and rear tire
  206. cause the centre of gravity of the kart to move
  207. sideways
  208. 2) The difference of the two forces causes a turning
  209. moment on the kart.
  210. Well, that's somewhat simplified, since there are a
  211. few cos(alpha), sin(delta), ... happening, but that
  212. is enough to understand the parameters in the
  213. data/physics.data file. For more details see:
  214. http://home.planet.nl/~monstrous/tutcar.html
  215. This page is currently down :((
  216. Another recommended read is Ted Zuvich's "Vehicle
  217. Dynamics for Racing Games" (available on
  218. gamasutra, just google to find it). More information
  219. can be found online, search for slip angle, car
  220. physics, ...
  221. The slip angles for front and rear tires depend on:
  222. - steering angle (obviously only for front tires)
  223. - distance between tires and centre of gravity
  224. (and rotational velocity of the kart).
  225. The CoG is assumed to be in the middle of the kart, so
  226. this distance is wheel-base/2. The longer the wheel
  227. base, the longer the way the tires will move as
  228. a result of the kart rotation, the more lateral force
  229. will be produced.
  230. The force acting on the tires is then linearly dependent
  231. on the slip_angle: slip_angle * corner_force
  232. (well, it's only linear for small angles, and the function
  233. Kart::NormalizedLateralForce will cap the values if the
  234. angle is too big). The acting force for the front tire
  235. is modified by cos(steer_angle) to compute the lateral
  236. force on the centre of gravity from the lateral force
  237. on the tire.
  238. The sum of these two lateral forces causes the sideway
  239. movement of the kart, and the difference between these
  240. two forces multiplied by wheel_base/2 causes the turning
  241. moment or torque, which gets divided by the inertia of the
  242. kart to computer the rotational acceleration.
  243. To tweak these values, consider:
  244. - increasing the cornering forces for the tires will
  245. result in larger forces to work on the tires
  246. --> the radius of the turn will be smaller, since the
  247. force pulling the kart to the middle is bigger,
  248. --> the kart will rotate more, since the difference of
  249. the two forces will be bigger as well.
  250. - increasing max_steer_angle will increase the force, but
  251. at the same time decrease the later component for the
  252. front tire (see cos(steer_angle) above)
  253. --> tighter curve, but less rotation of the kart
  254. - increasing the wheel base will increase the turning
  255. velocity, causing more force
  256. - increasing the inertia will reduce the effect of the
  257. turning moment on the kart, resulting in less rotation,
  258. but the same pulling force causing the kart to go in
  259. a circle, so the kart will not 'oversteer'2
  260. All those parameters are tightly coupled, and sometimes even
  261. minor changes will result in big changes in playability, i.e.
  262. the kart might suddenly only rotate on the spot, or hardly
  263. turn at all. Testing and tweaking and tweaking and testing
  264. is necessary.
  265. 6) Moving textures
  266. ==================
  267. A texture can be marked as 'moving', creating an animation effect - for
  268. example the lava in geekopeak. To do this, a new node must be added
  269. into the models. I don't know how to do this in blender, the manual
  270. way is:
  271. Find the texture to be moved, and look up for the first previous
  272. 'OBJECT' statement (which is the begin of a node), e.g.:
  273. OBJECT poly
  274. name "rect.010"
  275. texture "lava.rgb"
  276. ...
  277. Before that insert a new node like, having a @autotex line:
  278. OBJECT poly
  279. name "wrapper"
  280. data 14
  281. @autotex y=0.1
  282. kids 1
  283. OBJECT poly
  284. name "rect.010"
  285. texture "lava.rgb"
  286. ...
  287. The data line indicates the number of characters in the next line
  288. (@autotex...) - including the '@'. The 'name' line is only inserted
  289. to help finding the node in a dump of the track for debugging
  290. purposes.
  291. The possible parameters can be found in the file moving_textures.cpp
  292. (function parseData).
  293. 7) Physical objects
  294. ===================
  295. Similar to moving textures (above), part of the track can be declared
  296. to represent a rigid body when bullet is used, i.e. this part of the
  297. track will be following the physics rules, and can move around etc.
  298. To do this, similar to moving textures, insert a node like:
  299. OBJECT world
  300. data 20
  301. @physics cone mass=1
  302. kids 1
  303. at the beginning of a file (see roadcone, roadblock), or begin
  304. with an "OBJECT poly" statement (instead of world).
  305. Currently, only 'cone' and 'box' are supported. Additional parameters
  306. can follow on the same line, but currently only 'mass=...'
  307. is supported (which defaults to 1).
  308. 8) Track design
  309. ===============
  310. This was written originally by Steve Baker for TuxKart. Most of the
  311. information contained here is still valid, though it might be good to
  312. contact an experienced track designer on the supertuxkart-email list.
  313. A TuxKart 'level' (a race track) is just a bunch of static
  314. models - perhaps just one if it's simple enough.
  315. The model files can be in any format that PLIB's "SSG" library can
  316. load - there are quite a few loaders now for a range of common
  317. formats. I havn't tested many of them though and I suspect that some
  318. of them are 'patchy' in implementation.
  319. I've been using AC3D to model stuff for TuxKart - and the AC3D file
  320. format is pretty well supported.
  321. RACETRACK MODELS.
  322. -----------------
  323. The race always starts at the origin of the model - with the players
  324. facing due north. The karts start out spaced a couple of meters apart
  325. - so make sure the track is wide enough!
  326. Karts are dropped onto the track - it's very important that the road
  327. surface at X==0, Y==0 is slightly below Z==0. That may seem a nasty
  328. restriction that I should fix - but think about what would happen if
  329. you wanted to start the race inside a tunnel or something where there
  330. were multiple layers of polygons above the origin...the program would
  331. have no way to know which layer you wanted to start at.
  332. I've had to 'extend' the AC3D format a little by using the "Object
  333. Data" field to contain the additional parameters. The TuxKart engine
  334. knows how to do simple repetitive motion on either whole objects or
  335. texture maps based on that data...eg, I have moving water and lava
  336. streams by setting up a moving texture in the AC3D Object Data
  337. field. There are various other similar extensions for 'model switched'
  338. animations and such like.
  339. It would be easy to add other kinds of effects into the model in that
  340. way.
  341. Since most model formats allow for some kind of text field to be
  342. attached to nodes in the database, this same technique should work for
  343. other model formats - although we may need to get the authors of those
  344. loaders to support the callback function that the AC3D loader uses to
  345. tell the application program that this happened.
  346. IMAGE AND TEXTURE FILES:
  347. ------------------------
  348. All 2D icons and texture maps have to be in either BMP or SGI 'RGB'
  349. format. I greatly prefer the latter because BMP changes often and my
  350. loader can't keep up.
  351. All images and textures have to obey the rules for OpenGL texture maps
  352. - they must be even powers of two in size (ie the X and Y dimensions
  353. must be 2,4,8,16,32,64,128,256,etc). You can have rectangular maps (eg
  354. 128x64).
  355. Whilst there is no limit to the size of a texture map or image - you
  356. need to be aware that 3Dfx cards (which are VERY commonly used) cannot
  357. cope with maps larger than 256x256. The map loader will downsize your
  358. maps as necessary to make them fit - but beware that this will make
  359. them fuzzy.
  360. 3Dfx cards also have a limitation that maps must not have an aspect
  361. ratio of more than 8:1 or less than 1:8. That's rarely a practical
  362. limitation.
  363. Textures are ALWAYS MIPmapped and displayed using the highest quality
  364. settings.
  365. Ideally, all the maps for one track should fit into texture memory -
  366. and on early Voodoo-1 cards, that could be as little as 2Mb...of
  367. course with a GeForce-2 you get something like 64Mb of compressed
  368. texture memory - perhaps 100Mb. How much can you use? That's your
  369. problem!
  370. COORDINATE SYSTEMS:
  371. -------------------
  372. I have chosen one 'unit' in the database to be one meter in the real
  373. world - but since we don't really know how big Tux and his friends
  374. are, this is pretty arbitary. Another way to think of this is that Tux
  375. is one meter tall (that's just how big I think of him as being) - so
  376. one 'unit' is one 'tux' high - which is one meter. Real world penguins
  377. do get as big as a meter tall - but Tux is a 'Jackass Penguin' and
  378. they only grow to about 30cm...however, if he was that small, it would
  379. be hard to make levels because he ends up being too short to reach
  380. furniture, door knobs, etc convincingly.
  381. I come from a flight-simulation background where we use the convention
  382. that Z-is-up - so all my software works like that. However, the PLIB
  383. loaders know that some modellers use Y-is-up and do the axis swap as
  384. needed. Hence, in AC3D, Y-is-up - but in the game, your models will be
  385. converted to Z-is-up. If you find this confusing, forget I mentioned
  386. it - everything comes out OK automagically.
  387. RACETRACK MATERIALS:
  388. --------------------
  389. Another kind of effect comes from which texture map you use. I find
  390. that model file formats don't tell me all I need to know about a
  391. polygon.
  392. For example - do you crash if you hit it? Yes - if it's a brick wall,
  393. No - if it's a cloud of smoke. What is the coefficient of friction?
  394. Different for Ice than for Concrete.
  395. These things are listed in a 'Material Reference File' called
  396. 'data/materials.dat'. Since the default settings are generally what
  397. you want, most textures needn't be listed in the material file. It's
  398. really there for special materials such as those that make up the
  399. 'zippers'.
  400. Hence, if you need an icy surface, you apply the texture "ice.rgb" and
  401. when the model loads, I check that filename against my list of
  402. materials in 'data/materials.dat' and note that "ice.rgb" is a
  403. slippery material. This means that you can't re-use the ice texture
  404. map for anything that isn't supposed to be slippery - but what the
  405. heck...that's a really easy solution. It also allows me to add new
  406. material properties without going back into every single model adding
  407. that property into every single polygon.
  408. The format of 'data/materials.dat' is described in the file itself in
  409. comments. Each material is on a line of it's own. Start with the
  410. texturemap name in double-quotes, then follow a number of boolean or
  411. numeric fields separated by spaces.
  412. An example of a line in this file is:
  413. # TextureName UVClamp Trans AlphaRef Light Friction Ign Zip Reset Collide
  414. "lava.rgb" N N N 0.0 N 1.0 N N Y Y
  415. The fields (in order) are:
  416. * TextureName -- the name of the texture map - stripped of it's
  417. pathname. (All textures should be in the 'images' directory).
  418. * UVCLAMP -- two booleans - the first indicates whether the
  419. texture coordinates should be clamped in the U direction - the
  420. second for the V direction.
  421. o N N - repeats endlessly.
  422. o Y N - repeats in the V (ie Y) direction only.
  423. o N Y - or only in the U (ie X) direction.
  424. o Y Y - makes the texture not repeat at all.
  425. If the polygon is larger than the map and the map is clamped
  426. then the edge texels of the map will be repeated endlessly.
  427. * Trans -- True if the polygon or texture is likely to be
  428. transparent and therefore rendered with GL_BLEND enabled.
  429. * AlphaRef -- the 'alpha clamp' value - pixels with an alpha less
  430. than this are not rendered.
  431. * Light -- is 'lighting' enabled for this polygon? If not, the
  432. polygon will be drawn at it's full brightness and it'll glow in
  433. the dark.
  434. * Friction -- the frictional coefficient. 1.0 is 'normal', larger
  435. numbers represent rougher surfaces, smaller are more slippery.
  436. * Ign/Zip/Reset/Collide -- four booleans that describe the effect
  437. on the Kart of touching polygons made of this material:
  438. o Ign -- Ignore this polygon for the purposes of collision
  439. testing.
  440. o Zip -- means that this is a 'zipper'. If a kart touches
  441. it, the kart will accellerate to high speed.
  442. o Reset -- This material is "fatal" to karts - if you touch
  443. it then the rescue squad will come and hoist you away from
  444. it and up onto the track.
  445. o Collide -- if no set for a horizontal surface, it means
  446. that a kart can drive on it - for a vertical surface,
  447. karts that hit it will only slow down a little and can
  448. 'slide' along the polygons. If set, it means that any kart
  449. that hits this polygon will crash and drop to zero speed.
  450. THE 'LOCATION' FILE.
  451. There is a 'data/xxx.loc' file (where 'xxx' is the name of your level)
  452. that contains the location of each model file in (x,y,z) and (h,p,r) -
  453. Heading, Pitch and Roll.
  454. It's convenient to have some objects automatically 'conform' to sit on
  455. the terrain. If you wish to do that, then you can replace the Z
  456. coordinate with a pair of curly braces '{}'...you can also leave out
  457. either Pitch or Roll (using '{}') - and they will be computed so as to
  458. position the object onto the underlying surface.
  459. Since objects are added to the scene in order, the track models needs
  460. to appear earlier in the file than things you wish to conform to it.
  461. There are some models that are 'built-in' to the game engine - notably
  462. the the various colours of herring.
  463. Comments can be placed into the '.loc' file by placing a '#' at the
  464. start of the line.
  465. The easiest way to understand the '.loc' file format is to look at
  466. some of those from existing levels - the format is easy enough. Here
  467. is an example:
  468. #
  469. # The track itself.
  470. #
  471. "bsodcastle.ac",0,0,0,0,0,0
  472. #
  473. # Two Zippers (clamped to the track)
  474. #
  475. "zipper.ac",-70,0,{},90,{},{}
  476. "zipper.ac",-75,0,{},180,{},{}
  477. #
  478. # An advert for SuSE Linux
  479. #
  480. "susesign.ac",130,-40,5,-90,0,0
  481. #
  482. # A Gold (Yellow) herring
  483. #
  484. YHERRING,-45,-140
  485. #
  486. # Two Red herring
  487. #
  488. RHERRING,29,-139
  489. RHERRING,29,-141
  490. #
  491. # Two Silver herring
  492. #
  493. SHERRING,20,80
  494. SHERRING,120,-65
  495. #
  496. # Two Green herring
  497. #
  498. GHERRING,25,70
  499. GHERRING,30,70
  500. THE 'DRIVE LINE' FILE:
  501. ----------------------
  502. The second file you need is 'data/xxx.drv' - which is an ordered list
  503. of 2D points that lie along the approximate centerline of the track -
  504. starting at the start line, going all the way around the track and
  505. ending again at the start line.
  506. The DRIVE LINE file is used for several things:
  507. * To tell the computer players where to steer.
  508. * To let me figure out how far around the 'lap' each player is.
  509. * I also use it to generate a 'plan view' of the track with
  510. coloured dots for the players.
  511. Here is an example of a typical 'drv' file.
  512. 1.6556,-2.09912
  513. -0.6416,15.1328
  514. -7.5344,35.8112
  515. -22.469,54.192
  516. -40.8496,59.936
  517. -59.2304,51.8944
  518. -75.3136,33.5136
  519. -83.3552,22.0256
  520. -100.587,1.34728
  521. -122.414,-8.99188
  522. The simplest way to generate such a file is to load your track into a
  523. suitable 3D modeller and digitize a 'polyline' (or 'line loop' or
  524. whatever) around the track. Then delete all the other things in the
  525. model and SaveAs to a separate file. Presuming your modeller can
  526. export an ASCII format of some kind, you can easily hand edit the
  527. points to delete the vertical coordinate and all the non-vertex data
  528. from the file.
  529. You can test whether you got it right by loading the model and drv
  530. file into TuxKart and driving Tux around the track. Observing the
  531. planview as you go around will make it easy to tell whether you got it
  532. right.
  533. The computer-controlled players have a hard time making it around
  534. tight corners, so please try to have the drv file take a 'racing line'
  535. through the turn to give them a better chance.
  536. KART MODELS:
  537. ------------
  538. Right now, the Karts in TuxKart are pretty simple - just a plain rigid
  539. model. That's going to have to change so the characters do stuff like
  540. leaning into the corners, turning their heads, waving their fists (oh
  541. - wait, none of them *have* fists :-) ...however, remarkably little of
  542. that happens in MarioKart - and my first goal is just to be AS GOOD AS
  543. MK64 - being better than it can come later!
  544. The Karts also need 2D icons for use in various parts of the game.
  545. Have a look at the data/*.tkkf files for details.