LE-CODE/Track FAQ

From Custom Mario Kart
< LE-CODE
Revision as of 06:22, 2 June 2021 by Krummers (talk | contribs)
Jump to navigation Jump to search

This is a special help page for track editors. It explains how to edit your tracks to use the extensions provided by LE-CODE. A Distribution FAQ exists too.


Cannon properties (KMP/CNPT)

Issue

There are 3 hard coded cannon types. They have different characteristics. A track can select the type by KMP/CNPT. Changing the characteristics will affect all other tracks with cannons. So the track designer has to live with the predefined characteristics.

Solution

A LEX file is the solution. If such file exists and has a cannon section defined, LE-CODE will use these local characteristics instead of the global characteristics. Standard code will still use the global characteristics. So it is save to add the LEX file.

It is also possible to define more than 3 different characteristics. The use of more than 3 types makes a track incompatible for distributions without LE-CODE. So it is not recommended.

Example Tracks:

Creating a LEX file

Tool wlect of Wiimms SZS Tools support creation and conversion of text and binary LEX files. See LEX Commands for details.

Example for a minimal LEX text file with original cannon values (can be used as template):

#LEX

[CANN]
#---------------------------------------------------
#                          Deceleration    End
# Idx    Speed     Height     Factor   Deceleration
#---------------------------------------------------
   0    500.000      0.000   6000.000     -1.000
   1    500.000   5000.000   6000.000     -1.000
   2    120.000   2000.000   1000.000     45.000

Use the following command to create a course.lex with a cannon section:

wlect create cann >course.lex

Common Files

Issue

All tracks use objects and settings loaded from Common.szs. A modification has impact to all tracks. So modifications are generally forbidden.

Solution

Place private versions of Common files into the sub-directory ./Common/ of the track's SZS.

Template:LE-CODE common files

Reference: Tracks with common files

Epropeller speed

Issue

Setting #1 of Epropeller defines the number of rotations in 12 seconds (N = S1/12s). The minimal value for S1 is 1. So it is impossible to get slower Epropeller's.

Solution

With LE-CODE it is possible to change the speed to any fraction of N = (S1/S8)/12s = S1/(S8*12s) if S8≥1.

Extended presence flags

Issues

Questions:

  • Because of different object timings offline and online, 2 track files with 2 different objects settings must be relased. Is it possible to put all into 1 SZS file?
  • I want an object, that is only activated in Balloon Battle, but not in Coin Runners. Is it possible?
  • I want that a tracks looks different on every start. Is it possible?

Solution

Yes, since LE-CODE build 15, all of above and much more conditions are possible. See Extended presence flags for an introduction and Extended presence flags/Track Tutorial for more details.

Example Track: Test: Display XPF

Reference: Tracks with extended presence flags

Finish line (Second KTPT)

Issue

Usually, the start position of a track is placed very near to the finish line (CKPT lap counter). But some tracks use special start positions (starting boxes) far away from the finish line and sometimes with different direction. In this case, the finish line of the minimap is drawn at the wrong place.

Solution

LE-CODE provides a solution for this issue. If a second KTPT at index #1 with player_id -1 is defined, it is used as alternative draw position for the finish line. The point at offset #0 is still used for start position. Executors other than LE-CODE simply ignore the second KTPT. So there is no need to release 2 versions (one with and one without second KTPT) of a track.

If you set up a second KTPT, search the relevant lap counter (section CKPT) and place the KTPT at the check point line. The direction (Y-rotation) of the KTPT is important.

Wiimm edited more than 40 SZS files to insert a second KTPT. If you update such track and don't change the finish line, please copy the second KTPT (leave it unchanged).

Reference: Tracks with second KTPT

Solution using Wiimms SZS Tools

As of v2.03 of Wiimms SZS Tools, command »wkmpt KTPT« analyses the track and prints a recommendation for the second KTPT in 2 formats: as a complete KTPT record, and as option --ktpt2:

Recommendation based on nearest ENPT #32:
  Recommended KTPT record:   1  -82892.672     152.510   50314.219  0  33.52 0  -1 0
  Recommended patch option:     --ktpt2=-82893,50314

The option can be used to insert or replace the second KTPT:

wszst patch --ktpt2=-82893,50314 FILE.szs

Rotation and Y-position (height) are determined automatically. The position is adjusted.

As of v2.05a of Wiimms SZS Tools, both steps of above can be combined into a single command:

wszst patch --ktpt2=auto FILE.szs

Hide the position tracker

Issue

The position tracker spins in an area of the track and displays incorrect values. This could be due to unusual check points.

Solution

As of LE-CODE build 15, the position tracker can be hidden dependent on offline/online, the current lap index and the current check point of the player. Therefor you have to create a LEX file with section HIPT.

Example Track: Test: Hide Pos Tracker

Reference: Tracks with hidden position tracker

Item positions if playing online

Issue

If playing online, items are disintegrated immediately in some parts of the track. The reason is that the online protocol only supports start positions for items in the range of ±131071. See »Item Position Bug« for more details.

Solution

Add a LEX file with section SET1 to your track's SZS and define suitable stretch factors. Command  wszst check TRACK  will give you a recommendation.

Example output:

....
> All sections
  + WARNING: At least 1 Y coordinate of ENPT/ITPT is outside online limit
    of 1..131071. Used range: 0..177150
  + WARNING: At least 1 Z coordinate of ENPT/ITPT is outside online limit
    of ±131071. Used range: -181905..206893
  * SUGGESTION: Shift the whole track by --shift 0,100,-12494
    and setup LEX/SET1 with @ITEM-POS-FACTOR=v(1.00,1.54,1.67)
  * SUGGESTION: ... or setup LEX/SET1 only with @ITEM-POS-FACTOR=v(1.00,1.54,1.77)
....

Mushroom Car (penguin_m)

Issue

You want to integrate a Mushroom Car for tracks like GCN Mushroom City.

Solution

The solution uses Object penguin_m and is a joint work of Leseratte, kHacker35000vr and Tock.

Add 1 or more objects of type penguin_m to KMP/GOBJ and set setting #8 to value 1 (= Mushroom Car support enabled). Don't forget to set up a route and a start point. Usually the route of the other cars are used. Setting #3 can be used to define the item the mushroom car should drop (same as itemDirect).

The track needs the following new and modified files:

  • ./penguin_m.brres
  • ./effect/penguin_m/rk_penguin_m.breff
  • ./effect/penguin_m/rk_penguin_m.breft
  • ./brasd/penguin_m/walk.brasd
  • ./Common/GeoHitTableKart.bin
  • ./Common/GeoHitTableKartObj.bin
  • ./Common/GeoHitTableItem.bin
  • ./Common/ObjFlow.bin

You can get all files from download.wiimm.de (35K, 2019-07-03). See section »Common Files« for the support of Common files.

Reference: Tracks with Mushroom Cars

Woodbox: Respawn height

Issue

Object woodbox respawns after 5 seconds, drops from 5000 units above the origin and drops onto the first face it touch. This is problematic, if an upper floor exists less than 5000 units above. In this case, the woodbox will respawn in the wrong floor. DS Airship Fortress is an example for this.

Solution

Use setting #8. Set it to a value >0 to define an alternative drop height.

Reference: Tracks with alternative woodbox height