WohlSoft / SMBX-64-Compatibility

The configuration package for Moondust Project which is an implementation of SMBX-64 standard to provite the compatibility layer with the Legacy Engine (SMBX Engine v1.3)
2 stars 0 forks source link

Stabilize platform.lua #1

Open Wohlstand opened 6 years ago

Wohlstand commented 6 years ago

platform.lua - it's implementation of the NPC-AI which a Platform that following the rail path. This implementation is intended to match Vanilla SMBX's platform with some improvements to allow platform to pass more complex rail routes and don't fall out from rails or don't switch different path on crosses or 90-degree angles. Vanilla SMBX platform has some clunky logic related on 90-degree angles or on some other things. SMBX38A also has similar troubles. Current implementation is not so stable while passing angles and does some sort of jitter while aligning position after pass of the angle. One another issue is that speed multiplier from customized NPC-txt doesn't affects the actual move speed of the platform.

@Sambo3975, I see you made a stable and great custom-made platform thing on LunaLua system, and I inviting you to review my implementation and give some suggestions to improve it.

The stabilizing is needed for the platform motion itself, as any things are related on an objects speed-adding stack (objects are staying on platform and then staying on each other) are side of the physical engine of PGE Engine that must correctly move all objects in the stack by following the "moving floor" body. I stabilizing it separately. Issue of the Physical engine side is the case when some NPC changes it's speed, the staying on a head objects are figuring out for that only in a next iteration only that I must to fix: all staying on the head objects are must know the speed of their floor correctly!

To move and control platform motion I tweaking with the speed changes to let the speed-adding stack correctly process the physics. When I using setX and setY directly and absolute position change will don't affect staying on a head objects. I see that you in LunaLua implementation have to process speed-adding stack manually by the lua.

P.S. A current Lua API of PGE Engine is documented here with the minimal information: http://pgehelp.wohlsoft.ru/_tech/pge-lua/

Alucard648 commented 5 years ago

Just did some tests with those platforms. They fail horribly at 135 degree turns. scr_2018-11-18_01-37-21 Test level: https://yadi.sk/d/6zcU4h3mo5JgQg