Presence flag

From Custom Mario Kart
Revision as of 17:11, 22 January 2020 by Wiimm (talk | contribs)
Jump to navigation Jump to search

The presence flags is a 16 bit parameter of KMP/GOBJ and defines for which number of players an object exists (is visible and active).


First and wrong interpretation

The first interpretation of the flags were derived from /Race/Course/koopa_course.szs/course.0:

<ObjDefine>
    ...
    format    sepa1_SW  user_data  1  Bool  1
    format    sepa2_SW  user_data  1  Bool  1
    format    sepa4_SW  user_data  1  Bool  1
    format    sepaW1_SW  user_data  1  Bool  1
    format    sepaW2_SW  user_data  1  Bool  1
    format    sepaW4_SW  user_data  1  Bool  1
</ObjDefine>

Because a usual presence flag has the value of 0x3f, the first (and wrong) interpretation was:

Bit
Number
Hex
Value
First and wrong interpretation
0 0x01 Offline single player and time trials.
1 0x02 Offline 2 players.
2 0x04 Offline 3 or 4 players.
3 0x08 Online single player.
4 0x10 Online 2 players.
5 0x20 Online 3 or 4 players.

Correct interpretation

In 2016, Wiimm tested all 16 possible bits of the flags and found a new interpretation: Only the 3 least significant bits are used, all other are ignored:

Bit
Number
Hex
Value
Correct interpretation
0 0x01 Single player (offline and online) and time trials.
1 0x02 2 players, offline and online.
2 0x04 3 or 4 players, offline.
3 0x08 no meaning (ignored)
4 0x10 no meaning (ignored)
5 0x20 no meaning (ignored)

It is important to hide objects for 2 players mode only, if they are decorative. Otherwise online players at split-screen will use another track than single players!
In other words: For objects with impact on the gameplay, bit 0 and bit 1 must be equal!

Typical values

The following table shows typical values. The second column (Same as) reduces the value to the 3 least significant bits:

Value Same as Description Usage
0x00 0 Object is always disabled. It's like not defined. This value is used by custom track authors to disable objects temporarily.
0x09 1 Object is only enabled for single player mode (offline and online), but not for 2 or more players.

Don't use it for objects with impact on the gameplay!

This value is used by Nintendo to reduce slow motion bug at multiplayer split screen. This value is only used for decorative objects like WLscreenGC, but never for objects with impact on the gameplay.
0x39 This value is used by many custom track authors to reduce slow motion bug.
0x3f 7 Object is always enabled. Standard value.

Alternative file *_d.szs

For each track file with the name NAME.szs exists an alternative file with the name NAME_d.szs. This _d file is loaded for 2, 3 and 4 players, but only offline. Theorically it can be a total different track. The idea is to allow easier and less animations to reduce the slow motion bug, but it doesn't help for online racing.

Extension

There is a definition for expanding the flags: Extended presence flags