Logic for Idiots.

  • In case there are any other idiots like me out there. Heed this....

    I have literally spent 2 weeks trying to figure out why my game is broke and it is because....

    Global Variable = 0 (intending game to run nicely)

    Event 1

    If Global Variable = 0

    Then go run game from level 0 with start screen and start menu.

    Event 2

    If Global Variable = -1

    Then go run editor

    Event 3

    If Global Variable is not = 0

    or Global Variable is not = -1

    Then go run the game straight in at level (Global Variable 1) bypass all start screens and menus.

    If you haven't spotted the error by the time you are reading this then you are probably in the idiot camp with me.

    Actually it's pretty easy to spot when written like this. But when it is nestled in your event sheets with all the other code it looks so innocent and blameless I kept skimming over it.. for 2 whole weeks....

  • NetOne

    worse things happen, the important thing is to find the error and solve, sometimes it is not the fault of not knowing how to do things, but the rush to do them, or a moment of distraction while programming..

  • You should have posted this in "How do I...?" forum on day two of your quest

    When I have a hard-to-detect problem like this, I start disabling big chunks of the code and adding debug output everywhere. This usually helps to narrow the search scope and find the rogue event really quickly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NN81 and dop2000 cheers guys. I was on the verge asking for sure. Thing is with bug finding is most of the time you don't know what you are looking for untill you find it. Also my project must be running close to 1000 events now so not easy to sift through. In the end I gave up trying to do it manually and as you suggested made a dubug helper function which outputted to a text box overlay whatever the current operation was. And i dropped this all over the project events so I could then see what was happening in real time. This was a lot of work but did lead me to the issue which happened to be in literally the first few events of the whole engine. On the positive I now have the bones of a decent debugging system built into the game engine for future use. But damn it was a lot of work because of such a small stupid mistake. Not fun nor interesting work. worst of all not work that progressed the actual game in any meaningful way. Relieved to find it though but it has lead me into loading saving issue which may not be so easy to debug. This is all the result of trying to shoehorn a level system into a "my first game" that has been allowed to evolve into something far past what it should have.

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