ClementSparrow / Pattern-Script

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

Disallow mixing late rules and non-late rules in a rule group #13

Open ClementSparrow opened 3 years ago

ClementSparrow commented 3 years ago

Something like this…:

[ > Player | Crate ] -> [ > Player | > Crate ]
+ late [ Player | Crate ] -> [ Crate | Player ]

…doesn't make sense?

increpare commented 3 years ago

Yeah it's pretty janky. Puzzlescript naively just splits them up, but an error/warning would not be amiss :)

ClementSparrow commented 3 years ago

yeah, actually I think the best way to do it would be to deal with late like we already do with random: only allow the keyword on the first rule of the group and consider then that it applies to the whole group.

That's however something you probably shouldn't do with PuzzleScript because it could break old games, but I don't have this concern with Pattern:Script :-) (yet)

david-pfx commented 1 year ago

If you want to play old PS games, play them on PS. Splitting a group in two (early and late) is never going to be what was intended. I go for late as a group modifier, like rule directions and random.

ClementSparrow commented 1 year ago

I just had a long debugging session caused by a rule group where I put the late on the first rule but forgot to add it after the + in the second rule. And I was like "why is this rule not applied?", and the reason was that it was attempted before the movement phase at a time it could not apply. So I would definitely recommend that the late keyword applies to the whole group.

I would even argue that the late keyword should not exist as a rule keyword but should be a section keyword. Yes, I also had a bug because of that.

david-pfx commented 1 year ago

PS has this warning, which might have helped:

logWarning('Oh gosh you can mix late and non-late rules in a rule-group if you really want to, but gosh why would you want to do that?  What do you expect to accomplish?', lineNumber);

And yes, internally late is a section, and there are arguments in favour of that.