TrueMovement (and associated wops)

Help Topics, Bug Reports, Feature Requests, etc.
Post Reply
User avatar
MyNameIsKooky
Rainbow Spirit Master
Posts: 9711
Joined: Mon Dec 01, 2008 10:18 pm

TrueMovement (and associated wops)

Post by MyNameIsKooky » Fri Jan 08, 2016 12:27 am

Yesterday (relative to the time of me writing this post), I released The End 9, an adventure that used CMD4. One of the uses of CMD4 was to make coins "run away" from the player (in a similar to that of a Scritter). To do this, I used wops of Scritters with coin models that were then logic-swapped to become coin logic during gameplay via CMD4. The coins were then collectible. However, they preserved all of the traits of the Scritters' movement behaviors. (I came up with the whole "Scritter logic to coin logic" idea after observing some of the side effects of logic-swapping in previous entries to the The End series, which had also done heavy experimentation surrounding CMD4.)

The coins still preserved their Scritter-like movements upon saving and loading the game after the CMD4 was executed. This meant that within the saved data, the coin object's movement behavior was stored. After I released The End 9, I isolated the "Scritter coin" and the associated command 4 and ran some experiments (primarily involving saving the game and looking at the saved data in a Hex editor). Fortunately, object data in save files is, for all intents and purposes, arranged exactly the same as wop data. This made it a bit easier to figure out what was allowing the coins to move like Scritters.

After much testing (and a lot of excitement on my end upon achieving various results), I had figured out the key to making any object in the game move.

The primary parameter involved is the one that PowerWop labels as unknown parameter number 46 (???46). Because of its huge involvement in making any object move, I have decided to dub it "TrueMovement" (and also because it sounds cool, duh).

TrueMovement is a set of flags that determine what kinds of tiles the object is allowed to move over (floors, water, walls, lava, ice, bridges, etc). By default, a wop file has this set as 00 00 00 00 (all flags disabled), so TrueMovement will not take effect. However, when TrueMovement has its flags properly set (TrueMovement will be nonzero), the object will move while following the rules defined by TrueMovement.

When TrueMovement is enabled, the MovementType and MovementSpeed set in the wop file will (in almost all cases) override the object's default movement behavior. This is especially evident in TrueMovement-modified Chompers, which follow their TrueMovement-set rules rather than hunt down the player.

One critical partner of TrueMovement is unknown parameter 47 (???47), which I have dubbed "PhasePower". Like TrueMovement, PhasePower is a flag set and is also 00 00 00 00 by default. While it does not need to be nonzero for TrueMovement to function, it plays an important role in deciding how objects behave in certain hardcoded situations (in especial regard to what objects they can "phase" through, hence the name I gave to PhasePower). For example, when the second flag of the second byte of PhasePower is set (e.g. 00 02 00 00), this allows the TrueMovement-modified object to pass through barrels rather than treat them as solid objects (this is actually the behavior that Spikeyballs use that allows them to enter tiles containing barrels, cuboids, etc). Of course, there's also a setting that allows objects to move onto the tile containing the player (which, again, objects like Spikeyballs use); this setting is determined by the second flag of the first byte of PhasePower (e.g. 02 00 00 00).

Of course, ButtonReact (formerly unknown parameter 29 (???29)) plays an important role in object behavior when objects become mobile. ButtonReact is a flag. When it is enabled, objects are able to press buttons, be sprung, etc. When it is disabled, the object is unable to do those things.

ButtonReact, MovementType, MovementSpeed, TrueMovement, and PhasePower all come together to create a unique mobile object. Some of the potential results can't be graced with words. I think my demonstration adventure regarding TrueMovement says a lot more than I could in this post. I recommend playing the adventure for yourself if you haven't yet, especially if you're an adventure designer. It goes without saying that the kinds of capabilities that TrueMovement demonstrates have very profound implications for contemporary puzzle design.

TrueMovement wop files have a large number of advantages over creating equivalent objects via CMD4. The biggest advantage is the fact that you don't need to jump through any CMD4 hoops to get a TrueMovement entity in the game. That additionally means no extra General Commands that take up space in adventures. The biggest concern of simulating TrueMovement through CMD4 is the existence of "ghost entities" that are left behind when most varieties of entities are logic-swapped. Ghost entities is a whole subject I'm not even going to get into, along with a whole bunch of other annoying minutiae associated with CMD4 logic-swaps. The only annoying thing about TrueMovement wops is that you'll need to make a new wop for every new MovementType or MovementSpeed you desire, but I'd say the results more than make up for it.

Below are the actual values for the TrueMovement and PhasePower flags, along with some labels that are used on the wop files I created.

-=- TrueMovement -=-

MovementSpeed, MovementType, and PhasePower override logic's "default" movement.

XX XX 00 00

XX XX is a set of flags...

01 00: Move on floors. (F: Floor)
02 00: Move on walls. (W: Wall)
04 00: Move on water. (A: Aquatic)
08 00: ??? (U: Unknown)
10 00: Move on bridges. (C: Collapsible)
20 00: Move on lava. (L: Lava)
00 08: Move on straight ice. (iS: ice Straight)
00 10: Move on curved ice. (iC: ice Curved)
00 20: Move on ice walls. (iW: ice Wall)
00 40: Move on ice floats. (iF: ice Float)

-=- PhasePower -=-

Like TrueMovement, PhasePower is a flag system.

XX XX 00 00.

02 00: Phase through player. (P: Player)
10 00: Phase through items. (I: Item)
40 00: Phase through sunken turtles. (T: Turtle)
00 02: Phase through barrels and cuboids. (W: Wood)


Attached below are all of the TrueMovement wops I've made as of the writing of this post (58 wops total, including some of the ones that didn't really function as anticipated, but I'm sure you weirdos can still find uses for them). The file names probably don't make any sense to people who aren't me, but don't worry; if you're uncertain about something, feel free to ask. Testing the wops for yourself should be very insightful too.

TMXX-YY = TrueMovement: MovementType XX, MovementSpeed YY (both in base 10).

At some point I might program a module that automatically converts a wop to a TrueMovement wop of any desired MovementSpeed and MovementType. I might append the module to PowerWop, should I ever get around to rewriting it. For now, though, I suppose I'll be fulfilling TrueMovement wop requests on a whenever-I-feel-like-it basis. Try and keep the requests reasonable, please; the Wonderland Adventures engine has still yet to be bent entirely to our will. :P
You do not have the required permissions to view the files attached to this post.
Last edited by MyNameIsKooky on Sat Jan 09, 2016 2:04 am, edited 1 time in total.
User avatar
yot yot5
Rainbow SuperStar
Posts: 2294
Joined: Sun May 22, 2011 1:24 pm

Post by yot yot5 » Fri Jan 08, 2016 9:40 am

Wow... this sounds amazing! :o

I'll see if I can incorporate this into my next adventure, if I ever finish it.
User avatar
Pawelec
Rainbow Master
Posts: 690
Joined: Tue Jul 15, 2008 8:37 am

Post by Pawelec » Sat Jan 09, 2016 12:49 pm

MNIK, you have my sincere gratitude. I was desperate to make flying keys for my hub (which was paused for quite a long time because of me lacking time and ideas) and started the research on movement data two days ago to get rid of the ghost entity, but you were faster and saved me a lot of time.

Now if we only could get these objects affected by Brr and Flo...
"Let us return to the past; it will be progress."
by Giuseppe Verdi
User avatar
Pawelec
Rainbow Master
Posts: 690
Joined: Tue Jul 15, 2008 8:37 am

Post by Pawelec » Fri Feb 05, 2016 9:50 pm

I think I know how the system works from the mathematical side: 1, 2, 4 and 8 are all powers of 2 (2^0, 2^1, 2^3, 2^4) and follow additive mechanism, so the hex byte must be converted to binary and yield 8 separate bits which can be easily interpreted as bool values (0 = false, 1 = true). This is quite an inventive solution and may be useful in future research, as we now know that 1, 2, 4 and 8 are the values we should check first. Summing all of these values up gives FF FF flag - such an object should be able to pass through everything. I expect the code to be continuous, so every value up to the highest one should code something.

This also allowed me to predict that more values may be functional. The thing is the WOP format often reads the bytes backwards (Little Endian?) and so did I while giving the values their binary logarithm (in parentheses). It may also mean it's actually possible to define freezability, flashability and floability of objects via various parameters.

ObjectTileTypeCollision (a.k.a. TrueMovement, parameter 46)

This parameter determines which tile logic values are accesible to an object. While it may seem self-explanatory this lead me to discover that certain objects convert the tile they are placed on to a different logic.

Example: deactivating a Teleporter converts its tile to another logic (floor or 09, needs to be tested), a Teleporter which starts as inactive has no effect on logic until activated. Upon activation its tile becomes logic 04.

To be tested: FlipBridges, as they are Flashable they may use Floor (logic 01) or logic 09; closed Cages as they show similarities to logic 06.

01 00 (0) - Floor
02 00 (1) - Wall
04 00 (2) - Water
08 00 (3) - Logic 03 (active Teleporter, see*)
10 00 (4) - Logic 04 (Bridges, Rainbow Floats, Conveyors)
20 00 (5) - Lava
40 00 (6) - Logic 06 (a.k.a. Metatile: diagonally passable, passing only directly cast spells, not Flashable nor Blinkable)
80 00 (7) - Logic 07 (works like 06)
00 01 (8) - Logic 08 (works like 06)
00 02 (9) - Logic 09 (Buttons, acts like Floor)
00 04 (10) - Logic 10 (works like 06)
00 08 (11) - Ice (Straight)
00 10 (12) - Ice (Curve)
00 20 (13) - Ice Wall
00 40 (14) - Logic 14 (Ice Float)
00 80 (15) - Logic 15 (works like 06)

*in PotZ there's a level on Barren in which a Chomper avoids teleporters. In MoFI it was possible to lure Chompers into a teleporter - Patrick may have used this parameter.

ObjectObjectTypeCollision (a.k.a. PhasePower, parameter 47)

Note:
- so far I can tell that this is also very important, because it is responsible for creating ghost entities and enables the use of transporters.

01 00 (0) - ???
02 00 (1) - Player
04 00 (2) - ???
08 00 (3) - ???
10 00 (4) - Items
20 00 (5) - ???
40 00 (6) - Sunken Turtles
80 00 (7) - ???
00 01 (8) - ???
00 02 (9) - Barrels, Cuboids
00 04 (10) - ???
00 08 (11) - ???
00 10 (12) - ???
00 20 (13) - ???
00 40 (14) - ???
00 80 (15) - ???
"Let us return to the past; it will be progress."
by Giuseppe Verdi
Post Reply