ClementSparrow / Pattern-Script

Open Source HTML5 Game Engine based on PuzzleScript
20 stars 2 forks source link

Decide on what to do with disambiguation of movements #16

Open ClementSparrow opened 3 years ago

ClementSparrow commented 3 years ago

And in particular, should I implement increpare/PuzzleScript@d85b8058a1705dfca6463a77cb006079859ca8b5? I'm inclined not to, but I should certainly clarify why.

The main reason is that it may seem totally unnatural for some devs (including myself), even if others would have no problem with it. I like the concept of pattern matching and how simple it is to understand (despite some subtleties), but when inference becomes too powerful the simple visual matching becomes an exercise of being able to think like the machine that does the inference. Among the examples that increpare took:

right [ horizontal Player | perpendicular Player ] -> [ perpendicular Player | ]
right [ vertical Player | perpendicular Player ] -> [ perpendicular Player |  ]
right [ moving Player ] [ orthogonal crate ] -> [ orthogonal player ] [ crate ]
[ orthogonal a | moving a ] -> [ moving a | orthogonal a ]

None of this makes sense to me, visually. I can think visually about cells and objects inside cells, either present or absent before and after the application of the rule, which I can interpret as the creation/destruction/teleportation of objects. I can think about a property as an abstraction for a group of multiple possible objects, and hence infer that the same property appearing on both sides of the rule can correspond to the same object – although it will not always, and there are already issues with that, some being greatly alleviated by the introduction of rule parameters.

But making sense of the propagation of ambiguous movements is much harder, conceptually. I see movements as attributes of the objects: objects are primary concepts, movements are secondary. Matching movements requires me to ignore the object to which they are attached, and it's harder. How do I know when an object changes direction and when its direction is swapped with the one of another object? And how do I know if I'm supposed to interpret that as swapping two objects, preserving their movement, or as two objects staying in their respective cells but swapping movements?

Another reason for my reluctance is that I would like to add other features in the language and I'm not sure how they would interact with this kind of inference. Directional mappings are one thing. Identification of individual objects is another. I prefer to play with these ideas first and see what they have to offer, and then fine-tune them with inference if needed.

[end of the rant]

increpare commented 3 years ago

FWIW that level of movement-disambiguation is not a particularly useful feature I think; I never felt the need for it, and I mostly implemented it for consistency's sake.

david-pfx commented 1 year ago

The important thing IMO is to make it all transparent and not to set traps. It needs test cases to show the difference in behaviour, and it needs a way for someone with a PS game affected by this choice to be made aware that this is so, if their game triggers a (possibly very puzzling) change in behaviour.

@increpare this choice it seems to me is inconsistent with your decisions elsewhere to preserve old behaviour if a game depends on it.

increpare commented 1 year ago

@increpare this choice it seems to me is inconsistent with your decisions elsewhere to preserve old behaviour if a game depends on it.

@david-pfx The previous behaviour was to not compile IIRC. e.g. https://github.com/increpare/PuzzleScript/issues/682