Trying to debug a simple "touch is released" that isn't triggering
Hey all -
So I finally have a basic prototype of my mechanic up, and it works.... 90% of the time.
I have three actors that all need to be touched at once to be "activated" - thanks to John P and tatiang for their help - and if you release your touch from any of the actors after the "activated" state, they "deactivate."
This is a dead-simple rule in each one of them - Actor on touch release, set to deactivate.
90% of the time, everything works fine. But without any good repro, sometimes the rule does not trigger at all. I've set up a debug counter to count number of touch-release events, and it indicates that that rule sometimes simply does NOT run.
Things are simple enough that I'm contemplating on whether this is a gamesalad issue, because from the structure of gamesalad's touch rules and the crazy workarounds that JohnP and tatiang have had to help me with, it seems that Gamesalad isn't quite ideal with multi-simultaneous-touch games.
Any ideas of what I should try before I try logging a Gamesalad engine bug?
So I finally have a basic prototype of my mechanic up, and it works.... 90% of the time.
I have three actors that all need to be touched at once to be "activated" - thanks to John P and tatiang for their help - and if you release your touch from any of the actors after the "activated" state, they "deactivate."
This is a dead-simple rule in each one of them - Actor on touch release, set to deactivate.
90% of the time, everything works fine. But without any good repro, sometimes the rule does not trigger at all. I've set up a debug counter to count number of touch-release events, and it indicates that that rule sometimes simply does NOT run.
Things are simple enough that I'm contemplating on whether this is a gamesalad issue, because from the structure of gamesalad's touch rules and the crazy workarounds that JohnP and tatiang have had to help me with, it seems that Gamesalad isn't quite ideal with multi-simultaneous-touch games.
Any ideas of what I should try before I try logging a Gamesalad engine bug?
Answers
(1) double-checked all of my rules for ALL vs. ANY conditions.
(2) deleted the actor in question from the scene and re-added it. Sometimes an instance or an actual bug was causing rules to misfire (or "misfire").
(3) created a brand new scene and added my actors to it again to make sure I hadn't accidentally added an extra actor somewhere (checking Scene-->Layers can also help with this).
If you want to post a link (or PM a link) to the game file, I'd be glad to take a look and see if there's something obvious going on.
@Tatiang I did a check through on my ALL vs. ANY's, and yeah, right now the command where I put the "revert actor to default state" command is in an ANY rule. I've also taken your advice and cleared out my scene and rebuilt it. In Scene>Layers, the only actors there are the ones that need to be and the debugging counters I have in place.
I really appreciate both of your guys' help.
Anyway, here's the link to the zipped file:
http://dl.dropbox.com/u/46416476/BombDefusal MultipleNodes 0425.zip
Press a finger down on each one of the targets. Red number counts how many "touch released" events there are. When all targets are touched, they turn green. To repro the bug, then lift a single finger - 10-40% of the time, the touch released is not registered and all actors remain green and activated, despite the fact that all three are identical and have a TOUCH IS RELEASED CHANGE BACK GODDANGIT.
Any insight greatly appreciated.
At least I can give you a more robust debugging system: http://dl.dropbox.com/u/19602014/BombDefusal MultipleNodes 0425 debugger.zip. Maybe since you understand the setup much better than I do, you can find the cause faster than I can. I'll let you know if something jumps out at me.
For what it's worth, I can most often reproduce the bug by holding all three targets and then letting go of two of them at the same time (and still holding the third target). It does seem like the touch sensor is just not recognizing some releases.
Question for you: other than the TouchKiller actor, is there another actor that changes game.TouchKiller to true? I'm finding that game.TouchKiller is false but then must be true according to the debugging text I'm seeing. However, I added a counter to the TouchKiller actor and even though it's in the same rule that changes game.TouchKiller to true, the counter is never increasing. The only time the counter increases is if I drift outside of a target.
Edit: okay, I turned that rule off in the TouchKiller actor and it still sets game.TouchKiller to true. Where is that happening?
Edit #2: okay, found it. The RogueTouchChecker.
I'm thinking I might go back to the drawing board and try to rework this functionality entirely - it's kind of janky and limiting to begin with.
My alternate solution would be to have three... uh.. "tweezer" actors that have no art/collision that immediately constrain themselves to your touch, and then I can do everything as "actor tweezer collides with actor Node" etc, thereby eliminating the need for the Nodes themselves to look at all touches on the screen at the same time. I just got SO close to having this implementation work correctly that I wanted to see if I could push through to the other side.
Off the top of your head do you think this alternate implementation will work, or do you forsee any problems right off the bat? I'm sure I'll come into some difficulties as I dig into it, but hopefully it won't be quite the pain in the butt that this implementation has proven to be.
So you're right, the Touch is Released isn't firing correctly.
I did create a new blank game file with an actor with the rule "When touch is released change attribute game.ReleaseCounter to game.ReleaseCounter+1" and added three of those actors to the scene. For what it's worth, I can't recreate the bug.