スーパーマリオメーカー2 専門分野解説記事
座標依存はどうして発生する?| How come position-affected behavior happen?
最終更新:
smm2expert
-
view
For English readers: Click this to access English article.
目次
マリオメーカー2を遊んでいて、このようなことは1度はなかっただろうか?
「合同な配置なのに異なる挙動を示す」
一見物理演算をするゲームとしてあってはならないことに感じますが、実は座標依存の例はいくつか見つかっています。
座標依存とは
その名前の通り、挙動を座標に依存していることです。より簡素に言うと、配置する位置によって動きが異なることを言います。
ここで注意したいのは"座標に依存している"とは他のパーツ(プレイヤー含め)の位置によって挙動を変えると言う意味合いではないことです。
例えば、ドッスンはマリオが接近するとあらかじめ定められた方向に突撃してくる敵ですが、これはふつう座標依存とは言いません。なぜならば、マリオの位置に動きが依存しているのであって、配置されている絶対的な位置は挙動に何も影響を及ばしていないからです。
座標依存はバグなのか?
結論を言ってしまうと、バグである可能性は低いと思いますし、バグ判定でコースが消されることもほぼないと思います。
確かに、スーパーマリオメーカー2の攻略本などを参照すると、配置される位置によって挙動を変えるパーツがあることを明記していないため、少なくとも座標依存の存在は想定されていないといいていいと思います。
ただし、そもそも管理者が参照した攻略本が任天堂公式出版でないこと、座標依存は非常に細かな違いのものがほとんどであること(後述)であり、バグ判定でコースを消してもほとんど意味がないことを
考えるとバグとは考えなくて良いと思います。
考えるとバグとは考えなくて良いと思います。
座標の表し方
ここからは座標依存の例とそれが発生する位置を集めるが、そのためにはまずは座標の基準点をここで約束しなければいけない。

画面の一番左下のブロックの中心位置を(0,0)として、X軸を画面の横方向と並行に、Y軸を画面の縦方向と垂直に取ると約束する。
そして、1マス移動するためにX座標/Y座標が1変わるものとする。
画面の一番左下のブロックの中心位置を(0,0)として、X軸を画面の横方向と並行に、Y軸を画面の縦方向と垂直に取ると約束する。
そして、1マス移動するためにX座標/Y座標が1変わるものとする。
座標依存ギミック一覧
1. 羽付きブロック1マス上昇
発生箇所: 16 < y < 64
この箇所だけ他とくれべて周期が1フレーム(1/60[秒])短い。
この箇所だけ他とくれべて周期が1フレーム(1/60[秒])短い。
2. Pスイッチ積み重ね崩壊

画像の左側はx = 30,右側はx = 36
発生箇所: 32 < x < 64
この箇所だけPスイッチのタワーが崩れてしまう。(逆にこの範囲以外では崩れない。)
この箇所だけPスイッチのタワーが崩れてしまう。(逆にこの範囲以外では崩れない。)
3. 坂コンペア+シューリンガン

左の装置: x = 13, 右の装置: x = 18
発生箇所: 16 < x < 64
この箇所以外ではシューリンガンがわずかなスピードでコンペアに流される。逆にこの範囲ではコンペアの上に止まる。
4. チョロプー+ブラックパックン

左の装置:x = 8, 右の装置: x = 12
発生箇所: x = 8,128
この箇所ではブラックパックンの当たり判定もしくはチョロプーの動きが違うため、ボム兵が爆発しない。この配置は比較的良く使われているため、気にした方が良いかもしれない。
この箇所ではブラックパックンの当たり判定もしくはチョロプーの動きが違うため、ボム兵が爆発しない。この配置は比較的良く使われているため、気にした方が良いかもしれない。
※他にも座標依存ギミックは多数見つかっているが、ここでは配置が比較的簡単なものを選んだ。もっと知りたい方は
https://note.com/shamoji_smm/n/nb9f6507d42c1
へ訪れてみよう。
https://note.com/shamoji_smm/n/nb9f6507d42c1
へ訪れてみよう。
座標依存の特徴
上記に4つの例を挙げたが、これらにはある共通点がある。
挙動の変化の境界が2^n(nは非負整数)[マス]となっている
↓参考
挙動の変化の境界が2^n(nは非負整数)[マス]となっている
↓参考
xの値 | 2^x | この座標が境界となるギミック |
1 | 2 | (なし) |
2 | 4 | (なし) |
3 | 8 | チョロプー+ブラックパックン |
4 | 16 | 羽付きブロック1マス上昇,坂コンペア+シューリンガン |
5 | 32 | Pスイッチ積み重ね崩壊 |
6 | 64 | 羽付きブロック1マス上昇,坂コンペア+シューリンガン,Pスイッチ積み重ね崩壊 |
7 | 128 | チョロプー+ブラックパックン |
座標依存の仕組み考察
ここからは個人の考察なので鵜呑みにしないでください。
まず大事なのは、マリオメーカー2においてはパーツの座標はIEEE754の単精度浮動小数点数で表されることが重要である。
+ | IEEE754の単精度浮動小数点数とは |
ここで注意したいのは、座標の移動が2^nを跨ぐと桁落ちする可能性があるということだ。
例えば、
x = 1.11111111111111111111111, y = 01000100 (64よりわずかに小さい状態)
から0.125マス正の方向に移動することを考える。
x = 1.11111111111111111111111, y = 01000100 (64よりわずかに小さい状態)
から0.125マス正の方向に移動することを考える。
すると、理論上の位置は
x = 1.000000000111111111111111,y = 01000101
となるが、xは上位24桁までしかデーターを格納できないため、xの最後の桁の"1"が消えてしまい、実際のデータは
x = 1.000000000111111111111111,y = 01000101
となるが、xは上位24桁までしかデーターを格納できないため、xの最後の桁の"1"が消えてしまい、実際のデータは
x = 1.00000000011111111111111,y = 01000101となる。
結論
座標依存はまだまだ謎が多いです。今回の議論も管理者の憶測に過ぎません。皆さんもぜひ考察して見てください!!
INDEX
- What is position-affected behavior?
- Posotion expression
- Examples of them
- Features of them
- Mechanism theory
- Conclusion
Have you ever encountered following situation?:
「2 congruence entities behave diffrently」
You might feel this is a serious problem in the viewpoint of physics. However, there are some examples.
I'll introduce them and show my opinion what causes it.
I'll introduce them and show my opinion what causes it.
What is position-affected behavior?
Literally, behavior being different because of where they was placed.
Be aware that the word doesn't refer in case where behavior being different because of other parts.
For example, thwomp activates when player get closer to it. In general, this is not considered as position-affected behavior because thwomp's behavior depends on player's position, not on absolute position.
Is it considered as a glitch?
In conclusion, it is hard to say it is glitch. Also it is unlikely to get your level deleted because of this.
I'm pretty sure it is unexpected phenomena for developers.
However, it triggers minor difference、there are almost no problem of leaving it undebugged.
As far as I know, There are no example of level deleted because of it.
As far as I know, There are no example of level deleted because of it.
Position expression
Before I introduce the examples of position-affected behaviors, we have to define how to express the position.
The center of the lower left block is defined as the origin. Then, we take X axis parallel to the horizontal direction of the screen, Y axis parallel to the vertical direction of the screen.
Finally, the position changes by 1 per block.

The center of the lower left block is defined as the origin. Then, we take X axis parallel to the horizontal direction of the screen, Y axis parallel to the vertical direction of the screen.
Finally, the position changes by 1 per block.
Examples of them
1. Winged music block
Range: 16 < y < 64
In this range its interval is 1 frame faster than other ranges.
In this range its interval is 1 frame faster than other ranges.
2. P-switch stacking collapse

left P-switches : x = 30, right P-switches : x = 36
Range: 32 < x < 64
In this range the stack of P-switch will be destroyed. (They won't in other ranges.)
In this range the stack of P-switch will be destroyed. (They won't in other ranges.)
3. Conveyor and spike ball

left spike ball: x = 13 | right spike ball : x = 18
Range: 16 < x < 64
In this range spike balls stay on the conveyor.(They will be slightly flowed by the conveyors in other ranges.)
In this range spike balls stay on the conveyor.(They will be slightly flowed by the conveyors in other ranges.)
4. Moles and muncher stack

left muncher : x = 8 | right muncher : x = 12
Range: x = 8,128
In this range, the muncher's hitbox is diffirent from other place. This different appears on whether the bomb-omb explode or not.
This might be concerning because this gizmo is widely used.
Range: x = 8,128
In this range, the muncher's hitbox is diffirent from other place. This different appears on whether the bomb-omb explode or not.
This might be concerning because this gizmo is widely used.
Features of them
These 4 examples has common feature:
The place Where behavior changes is always 2^N[block](N is a integer)
↓Table
The place Where behavior changes is always 2^N[block](N is a integer)
↓Table
x | 2^x | Behavior chage |
1 | 2 | (None) |
2 | 4 | (None) |
3 | 8 | Mole and muncher |
4 | 16 | Winged music block & conveyor and spike ball |
5 | 32 | P-switch stacking collapse |
6 | 64 | Winged music block & conveyor and spike ball & P-switch stacking collapse |
7 | 128 | Mole and muncher |
(Since the longest possible level is 240 block long, if x is 8 or larger, we don't have to consider about them. (2^8 > 240).)
Mechanism theory
This is merely my opinion. Don't swallow it.
The important fact is that in SMM2, the position is expressed by IEEE754 single precision floating point numbers.
+ | What is IEEE754 single precision floating point numbers? |
The point is, It means that if the movement of position crosses 2^n, there is a possibility of an order of magnitude drop.
e,g;
Suppose
x = 1.11111111111111111111111, y = 01000100 (slightly lower than 64),
When the position changed by 0.125,The position should be:
x = 1.000000000111111111111111,y = 01000101
{However, only x's top 24digits are stored, the 25th(= last) digit of x will disappear.The actual number would be:
x = 1.00000000011111111111111,y = 01000101
Suppose
x = 1.11111111111111111111111, y = 01000100 (slightly lower than 64),
When the position changed by 0.125,The position should be:
x = 1.000000000111111111111111,y = 01000101
{However, only x's top 24digits are stored, the 25th(= last) digit of x will disappear.The actual number would be:
x = 1.00000000011111111111111,y = 01000101
This means the position is changed unexpectedly. I guess think makes position-affected behavior happen.
Conclusion
It is still in mystery. Why don't you examine it?