*** Wait Object - another strange problem

This forum is currently in read-only mode.
From the Asset Store
Strange factory themed set of tiles for your platformer game
  • Hi Guys.

    I hit a problem a few days ago which I couldn't find an answer to.

    It just didn't make sense.

    I think I've finally nailed it, but the problem still doesn't make sense, and seems to be down to object error rather than Krush error.

    I can't upload the cap, but I can try and explain the method of coding used, and why the error (to me) doesn't seem right.

    I use groups extensively, because they can be used in so many ways, and are a great way to control your code.

    I generally have one or two groups active at a time to control the game, with occasional groups being enabled to perform a function or set up as a handler, which self-terminate when needed.

    Now, with this in mind, lets say I have a MainLoop group which monitors keyboard input, enables other groups that update the screen, etc.

    When a specific key is pressed (lets say Space), the group will terminate itself and enable another main control group (lets say MainLoop2).

    Now, from this MainLoop2 group, all sorts of things could happen, and control could be passed around to various other groups, and some groups enabled to perform a specific self-terminating task.

    It's not important really, because it's just an example, but it gives an idea of how I structure my coding with Construct.

    It works very well.

    That is until a few days ago.

    I noticed that the MainLoop group which monitors keyboard input for certain tasks was still triggering even when the group was disabled.

    Obviously, this meant things went haywire, and it took me a little while to notice that the disabled group had an event that was still triggering.

    Even more bizarrely, when I created a Global Variable "Phase" to make sure that the event couldn't trigger more than once (by setting it to 1 and adding a condition to the event allowing it to only trigger when it was 0), it still triggered, even though the debugger shows that the variable Phase was 1, and therefore it should be impossible for the event to trigger.

    What's all this got to do with the Wait Object?

    Well, this afternoon, I spent a considerable amount of time going through the code (and wondering if I should have written it in HGE and C++ after all), I noticed that to set the timing of automated events, I'd used the Wait Object.

    I haven't used this object in any other projects, and only added it in the last couple of weeks because someone mentioned it on these boards.

    I hadn't even realised it was there until then.

    I am now in the process of replacing all the Wait commands with my own wait loops, but it looks like things are now triggering only when they should.

    I can't explain why using the Wait Object would make things act so strangely.

    I think that there were only about 5 or 6 Wait commands used, but it knocked my game for six.

    I'm not sure how easy it would be to reproduce the error in a sample cap, because I'm just glad to be able to get on with my game, rather than binning it.

    But if you are using the Wait Object and you are getting strange behaviour for no apparent reason, it's something worth looking at.

    Once I've replaced them all with my own wait loops, I'll post back here and see if it solved all the problems.

    In the meantime, anyone else have strange behaviour with the Wait Object?

    Krush.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The Wait Object is unfinished, so at this point I think its safe to say it should just be used for testing purposes. I hope you can track down the bug, as the plug is another one of those must haves for 1.0 imho.

  • Yeah, although it doesn't take 2 minutes to write custom wait routines, the temptation to use a plugin for it was too much.

    I didn't know that it wasn't finished though.

    Maybe we need a "Verified" state for plugins that have been checked thoroughly, and are considered finished by the author.

    I'm sure that a lot of people are using plugins that aren't finished without knowing it.

    BTW, I can confirm that my game now works as it should since I've taken out all use of the Wait object, and put in custom routines in their place.

    It's odd how a plugin could affect the logical path of programs though, especially allowing disabled groups to run.

    Krush.

  • Yeah if you can replicate the bug, I would defiantly add it to the tracker.

  • I can confirm as well weird behavior with the Wait object. I was using it for online games and got strange behavior, but I wasn't able to pinpoint exactly what the bug was. I'll try to use it again to work out some of the bugs. This is definitely a useful plugin so it would be nice to have it working!

  • I think replicating the bug is going to be difficult, because it doesn't seem to have any specific error other than conditions triggering when they definitely shouldn't and disabled groups still being executed.

    I can only hope that that can point the devs in the right direction.

    Krush.

  • Yikes...when did the wait object get added into the distributed version of Construct

  • lol David

    That was answer everyone wanted to hear

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)