1 sentence description of the problem: Custom rules are run out of order, after everything that is one layer of custom rules above it.
The expected behavior is that code will run in the order that it is written. Instead it runs in an incredibly confusing order that is not very clear to the user at all and requires many unnecessary custom rules clogging the keyboard in order to make make sense.
See this project for what I mean:
It should count from 1 to 10, but instead it counts all out of order. It also has another bug where the input to one instance of a custom rule is being overwritten by the input to another instance of the same custom rule. See Custom rule inputs overwrite each other
Wow. Shuffling without even trying. Weirdest bug I’ve ever seen…
also pretty convenient in some rare cases :D
I’ve brought this up with the team, and essentially the order which custom rules should run in is not really deterministic here.
They all have “When game starts” and Hopscotch simulates them being all run at the same time (though in practice one is run after the other because Hopscotch doesn’t use threads to run them all concurrently)
Though the code usually does end up running in order that you put the rules, this is more relating to Hopscotch not using threads for concurrency and trying to simulate it (if you want something to run in order, you would probably not put them to run simultaneously in separate rules)
Can I ask more about how this case is affecting projects that you’re making? (I know the bug report would be the most simplified case and not necessarily what you want to use in practice)
hopscotch has blocks that arent instantaneous and using multiple custom rules is one of the way to accelerate some calculations
at least, thats how i use them
so hopscotch not running from top to bottom and from clone 0 to clone n is very problematic for some of us who’s absolutely relating on fullfilling each frame as much as possible for best performances of our engine/game/anything
It mostly affects me when I want to use custom rules and pass input into them every frame, and then take the result of that and give it to another custom rule later. For example I do it a lot in https://c.gethopscotch.com/p/12xzzqnz24. For example one of the collision checks looks like this:
(If you’re using this code for collision do note that it doesn’t work completely in this state, it only checks half the cases it needs to. Just copy the existing code but change the object you’re getting the vertex positions of in the preparation rules to the one checking the collision)
I feel like those preparation custom rules should just be regular rules, but that would not work with the way the custom rules are currently ordered.
I guess a better solution for this case would be making custom blocks and other containers not take extra frames if they only have instant blocks inside of them, but that is not the current behavior.