Difference between revisions of "LE-CODE/Track FAQ"

From Custom Mario Kart
Jump to navigation Jump to search
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[File:lecode-circ-160x160.png|right]]
+
{{LE-CODE Content|logo}}
 +
 
 
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 [[LE-CODE/Distribution FAQ|Distribution FAQ]] exists too.
 
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 [[LE-CODE/Distribution FAQ|Distribution FAQ]] exists too.
  
Line 5: Line 6:
 
__TOC__
 
__TOC__
  
== <span id=cannon>Cannon Settings (KMP/CNPT)</span> ==
+
== <span id=cannon>Cannon properties (KMP/CNPT)</span> ==
  
 
=== Issue ===
 
=== Issue ===
Line 13: Line 14:
 
=== Solution ===
 
=== Solution ===
  
A [[LEX|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. It is also possible to define more than 3 different characteristics.
+
A [[LEX|LEX file]] is the solution. If such file exists and has a ''[[LEX#CANN|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.
  
Reference: [https://ct.wiimm.de/?s=.cannon Tracks with alternative cannon settings]
+
It is also possible to define more than 3 different characteristics. The use of more than 3 types makes a track incompatible for [[distribution]]s without LE-CODE. So it is not recommended.
 +
 
 +
Example Tracks:
 +
* [[Wiimm's Test Tracks#xpf|Test: Cannon]]: Test a very slow, a very fast and a very high cannon.
 +
* [[SK64 Ninja Land]]: Very fast cannons for the long distance.
 +
* Reference: [https://ct.wiimm.de/?s=.lex-cannon Tracks with alternative cannon settings] (ct.wiimm.de)
  
 
=== Creating a LEX file ===
 
=== Creating a LEX file ===
Line 34: Line 40:
 
   2    120.000  2000.000  1000.000    45.000
 
   2    120.000  2000.000  1000.000    45.000
 
</pre>
 
</pre>
 +
 +
Use the following command to create a ''course.lex'' with a cannon section:
 +
wlect create cann >course.lex
  
 
== <span id=common>Common Files</span> ==
 
== <span id=common>Common Files</span> ==
Line 43: Line 52:
 
Place private versions of Common files into the sub-directory ''./Common/'' of the track's SZS.
 
Place private versions of Common files into the sub-directory ''./Common/'' of the track's SZS.
  
Supported files until now are:
+
{{LE-CODE Common Files}}
* [[ObjFlow.bin]]
 
* [[GeoHitTableItem.bin]]
 
* [[GeoHitTableItemObj.bin]]
 
* [[GeoHitTableKart.bin]]
 
* [[GeoHitTableKartObj.bin]]
 
* [[minigame.kmg]]
 
  
 
Reference: [https://ct.wiimm.de/?s=.common Tracks with common files]
 
Reference: [https://ct.wiimm.de/?s=.common Tracks with common files]
 +
 +
== <span id=epropeller>Epropeller speed</span> ==
 +
=== Issue ===
 +
 +
Setting #1 of {{obj-ref|0x1a6|Epropeller}} defines the number of rotations in 12 seconds ({{math|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 {{math|N {{=}} (S1/S8)/12s {{=}} S1/(S8*12s)}} if {{math|S8≥1}}.
 +
 +
== <span id=xpf>Extended presence flags</span> ==
 +
=== 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#b15|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: [[Wiimm's Test Tracks#xpf|Test: Display XPF]]
 +
 +
Reference: [https://ct.wiimm.de/?s=.xpf Tracks with extended presence flags]
  
 
== <span id=ktpt2>Finish line (Second KTPT)</span> ==
 
== <span id=ktpt2>Finish line (Second KTPT)</span> ==
Line 61: Line 89:
 
=== Solution ===
 
=== Solution ===
  
[[LE-CODE]] provides a solution for this issue. If a second [[KMP#KTPT|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.
+
[[LE-CODE]] provides a solution for this issue. If a second [[KMP#KTPT|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 [[KMP#CKPT|CKPT]]) and place the KTPT at the check point line. The direction (Y-rotation) of the KTPT is important.
+
If you set up a second KTPT, search the relevant lap counter (section [[KMP#CKPT|CKPT]]) and place the KTPT at the check point line. The direction (Y-rotation) of the KTPT is important.
 
 
[[Wiimm]] edited 15 tracks 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: [https://ct.wiimm.de/?s=.2ktpt Tracks with second KTPT]
 
Reference: [https://ct.wiimm.de/?s=.2ktpt Tracks with second KTPT]
Line 81: Line 107:
 
As of v2.05a of [[Wiimms SZS Tools]], both steps of above can be combined into a single command:
 
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
 
  wszst patch --ktpt2=auto FILE.szs
 +
 +
== <span id=hidepos>Hide the position tracker</span> ==
 +
=== Issue ===
 +
 +
The position tracker spins in an area of the track and displays incorrect values. This could be due to unusual [[KMP#CKPT|check points]].
 +
 +
=== Solution ===
 +
 +
As of [[LE-CODE#b15|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. Therefore you have to create a [[LEX]] file with section [[LEX#HIPT|HIPT]].
 +
 +
Example Track: [[Wiimm's Test Tracks#xpf|Test: Hide Pos Tracker]]
 +
 +
Reference: [https://ct.wiimm.de/?s=.lex-hide-pos Tracks with hidden position tracker]
 +
 +
== <span id=itempos>Item positions if playing online</span> ==
 +
=== 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 [[LEX#SET1|SET1]] to your track's SZS and define suitable stretch factors. Command &nbsp;<tt>wszst check TRACK</tt>&nbsp; will give you a recommendation.
 +
 +
Example output:
 +
<pre>
 +
....
 +
> 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)
 +
....
 +
</pre>
 +
 +
== <span id=long>Long Tracks</span> ==
 +
=== Issue ===
 +
If playing online, the racing time is limited. The original game uses 5:00 and LE-CODE and [[CTGP Revolution]] use 5:40 by default. Despite this, a track might need more time to play three laps using 100cc.
 +
 +
=== Solutions ===
 +
One (and the usual) solution is to reduce the number of laps to one or two. Therefore, you have to change the first [[KMP#STGI|KMP:STGI]] setting. LE-CODE, CTGP Revolution and many other distributions support this.
 +
 +
Another solution is to apply an alternative online time limit with [[LEX#APPLY-ONLINE-SEC|LEX:SET1:APPLY-ONLINE-SEC]]. This works only if the distribution uses an LE-CODE build from 2023-06-05 or later, and if the distribution author(s) allows the alternative time.
 +
 +
Reference: [https://ct.wiimm.de/?s=.lex-apply-otl#list Tracks that apply an alternative online time limit]
  
 
== <span id=mcar>Mushroom Car (penguin_m)</span> ==
 
== <span id=mcar>Mushroom Car (penguin_m)</span> ==
 
=== Issue ===
 
=== Issue ===
You want to integrate a ''Mushroom Car'' for tracks like [[GCN Mushroom City (Tock)|GCN Mushroom City]].  
+
You want to integrate a ''Mushroom Car'' for tracks like [[GCN Mushroom City (Riidefi & Tock)|GCN Mushroom City]].
  
 
=== Solution ===
 
=== Solution ===
The solution uses Object {{obj-ref|$$penguin_m|penguin_m}} and is a joint work of [[Leseratte]], [[KHacker]] and [[Tock]].
+
The solution uses Object {{obj-ref|$$penguin_m|penguin_m}} and is a joint work of [[Leseratte]], [[kHacker35000vr]] and [[Tock]].
  
Add 1 or more objects of type {{obj-ref|$$penguin_m|penguin_m}} to [[KMP#GOBJ|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 {{obj-ref|itemDirect}}).  
+
Add 1 or more objects of type {{obj-ref|$$penguin_m|penguin_m}} to [[KMP#GOBJ|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 {{obj-ref|itemDirect}}).
  
 
The track needs the following new and modified files:
 
The track needs the following new and modified files:
Line 103: Line 175:
  
 
Reference: [https://ct.wiimm.de/?s=.mushroom-car Tracks with Mushroom Cars]
 
Reference: [https://ct.wiimm.de/?s=.mushroom-car Tracks with Mushroom Cars]
 +
 +
== <span id=ritp>Random Item Points</span> ==
 +
=== Issue ===
 +
Normally only the first next-link of [[KMP#ITPH|KMP:ITPH]] is used for Bullet Bill and Red Shells (except when the shell has already targeted a player). In the case of equivalent routes, however, it would be desirable for one of the possible routes to always be selected at random.
 +
 +
=== Solution ===
 +
Setup [[LEX]] section [[LEX#RITP|RITP]] to define a list with rules. Each rule defines the index of the ITPH element, the number of next-links affected, and the type of modification.
 +
 +
{{update|This feature is available as of LE-CODE build 37 & Wiimms SZS Tools v2.35a.}}
  
 
== <span id=woodbox>Woodbox: Respawn height</span> ==
 
== <span id=woodbox>Woodbox: Respawn height</span> ==
 
=== Issue ===
 
=== Issue ===
Object {{obj-ref|$$woodbox|woodbox}} respawns after 5 seconds, drops from 5000 units above the origin and drops onto the first face they 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.
+
Object {{obj-ref|$$woodbox|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 ===
 
=== Solution ===

Latest revision as of 18:05, 28 February 2024

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.

Currently, there are six files that are supported:

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.

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. Therefore 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)
....

Long Tracks

Issue

If playing online, the racing time is limited. The original game uses 5:00 and LE-CODE and CTGP Revolution use 5:40 by default. Despite this, a track might need more time to play three laps using 100cc.

Solutions

One (and the usual) solution is to reduce the number of laps to one or two. Therefore, you have to change the first KMP:STGI setting. LE-CODE, CTGP Revolution and many other distributions support this.

Another solution is to apply an alternative online time limit with LEX:SET1:APPLY-ONLINE-SEC. This works only if the distribution uses an LE-CODE build from 2023-06-05 or later, and if the distribution author(s) allows the alternative time.

Reference: Tracks that apply an alternative online time limit

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

Random Item Points

Issue

Normally only the first next-link of KMP:ITPH is used for Bullet Bill and Red Shells (except when the shell has already targeted a player). In the case of equivalent routes, however, it would be desirable for one of the possible routes to always be selected at random.

Solution

Setup LEX section RITP to define a list with rules. Each rule defines the index of the ITPH element, the number of next-links affected, and the type of modification.

This feature is available as of LE-CODE build 37 & Wiimms SZS Tools v2.35a.

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