Trying to debug a simple "touch is released" that isn't triggering

frankwashburnfrankwashburn Member Posts: 32
edited April 2012 in Working with GS (Mac)
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?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    Not to say that you haven't found a bug, but when I've discovered what I thought were bugs, I tried the following:
    (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.
  • 95orange95orange PRO Posts: 18
    Have you tried putting your "when released" code in the "otherwise" part of the touch pressed rule? I've often found that works better than counting on the release event trigger.
  • frankwashburnfrankwashburn Member Posts: 32
    @95Orange, I'd like to, but I'm dealing with some relatively complex cases and a simple "otherwise" in any one of them isn't quite broad enough to catch them all.

    @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.
  • frankwashburnfrankwashburn Member Posts: 32
    @Tatiang dangit I'm trying to figure out how to PM you to send you my email for this dropbox folder but the stupid gamesalad forum website is busted... hold on..
  • frankwashburnfrankwashburn Member Posts: 32
    @Tatiang well I'm stupid, I should have just zipped the file like you did in the other discussion in which you answered my question.

    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.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Okay, I reproduced the bug. I'll try to figure out what's causing it.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    @frankwashburn I like a good challenge, but this one might be beyond me. :(

    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.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    @frankwashburn A couple more thoughts... your release counter is checking for when Touch is Released, but your game actually requires that Touch is Released AND game.TouchInsideActors is false AND game.TouchKilled is true for it to register correctly. In my testing, it seemed that the three conditions failed when I released two targets at the same time because game.TouchInsideActors is true and game.TouchKilled is false. But I can't figure out why those two booleans don't get set correctly in that circumstance.

    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.
  • frankwashburnfrankwashburn Member Posts: 32
    @tatiang But my "disable actor on touch is released" rule is an ANY rule, so it shouldn't matter what those other conditions are! Those are for handling things like rogue touches and the like.

    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.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    I was just about to edit my comment because I missed the fact it was an ANY rule. Sorry about that.

    So you're right, the Touch is Released isn't firing correctly.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @frankwashburn I feel a bit silly for having missed that ANY rule especially in light of the fact that I was the person who told you to double-check your ALL vs. ANY. Your ReleaseCounter is actually right on the mark and points to the problem. I can't tell you if your new plan is going to work better... I don't quite understand it.

    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.
Sign In or Register to comment.