Are there any "best practices" for testing logic in a reliable way?
When logic gets complex, sometimes some parts of it can be triggered (or not) in an unreliable way. Of course it's my fault for how I built it in the first place, but I routinely miss edge cases or problems that occur, for example, 1 time out of 5. Question is: how do you make testing more reliable? I usually add textboxes everywhere to alert me visually if something is firing, but is there something else you can reasonably do to make testing easier and more reliable?
-
As you build the logic, thoroughly test that specific part. Like, make your detection which should trigger something... but instead of moving on to the thing it triggers, make sure the detection part is working properly.
Or if you've already added the triggered part, turn that off. Focus on the thing doing the triggering.
Use test mode a lot to watch the gadgets as you play, to make sure it's all working as expected.
-
Also for testing a position or something, I tend to emit an object at that position every frame, with max-at-once at 1, and recycle on.
-
The method I prefer at the moment is run it in test mode with everything involved exposed, record it with my capture card, and then go through it frame by frame. It would be nice to be able to set up breakpoints. Maybe we can? I have no idea.
-
Ahah, i've opened a thread in the ideas forum exactly for this use-case, Lucid_Stew! :D
It's still in "moderation" though
-
The best approach is to build things out of elements. Like any logic contraption be in its own element. That way you can test them independently and make sure they work. I also test each part throughly and think of how I can break it instead of just making it work. Once the element is done stamp it and then test it in the scene. Then just make sure you do hundreds of play through. Each play gives you a way to check if things are still working like you need to.
Please sign in to leave a comment.