Random Crashes Caused by Input System

Discussion in 'RGSSx Script Support' started by Rikifive, Apr 9, 2016.

  1. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    Hello everybody!


    I've been struggling with this for days and I think I have finally found the source of problem.


    What's Wrong?


    My game crashes randomly when changing parameters ranging from simply HP to ATK etc.. ~ No matter how I'll change these (by items or scripts) there is a chance for a crash. I have absolutely no idea what is causing it and I'm completely helpless.


    People say that nothing happens without a reason in coding/computers ~ but what if the reason itself is random?


    Where it Crashes?


    I'd rather ask where it's not crashing. ( ͡° ͜ʖ ͡°)


    No seriously, it's crashing anywhere ~ in my inventory scene, in the default item scene, in status scene and even in main menu when changing formation...


    How to Crash?


    For example I'll show two of many methods of crashing the game.


    1) Using items


        ~ Using either potion, growth item etc. has a chance to crash the game. It is completely random ~ one time it will take ~500 items to crash, the other time even just 10 will be enough.

    [​IMG]



    2) Just changing the formation... Not much effort required...


    It's also random ~ Russian Crashian Roulette

    [​IMG]





    But WHY?


    I've managed to locate the source of problem ~ It's aaaaaall because of the input system.


    I had problems with that system before - it was crashing my game during battle transitions and what's more - also randomly. - That was one of the reasons why I've restarted my project and that worked, but it will not work for this issue as it's even happening in a fresh project.


    Plot Twist!


    I've sent my demo to Shiggy and he couldn't recreate the issue in any way, so it seems, that it's a pretty complex thing...


    So What Now?


    Does anybody have any idea what's happening there?


    Does anybody had a similar issue?


    Does anybody know of a possible way to fix this?


    Does anybody know better input system? (I think I found one ~ thanks for suggestions!)


    The ability to use more keys is absolutely essential since I'm making a local coop game and I simply can't use just the silly ones that default RM's system gives, duh! =3


    I'm heavily wondering why the creators threw such a silly limits thus I don't agree, that this software is 'powerful enough for a developer'. HATE COMMENTS! =3


    I REALLY liked that system as it's really nice, but ... =/


    Any information/suggestion will be appreciated.


    Thank you! (=
     
    Last edited by a moderator: Apr 10, 2016
    #1
  2. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Add this right before line 270:


    print "----\n"
    p value
    p param_id
    p param_max(param_id)
    p param_min(param_id)




    Then run the game with the console open and make it crash again. When it crashes, take a screenshot of the console window.


    Or send me the demo.
     
    #2
    Rikifive likes this.
  3. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    When I put the code and remove the input system - The console shows information.


    When I put the code WITH the input system installed - The console shows nothing.


    This is .. suspicious...?


    I'll try Hime's Input Script - perhaps that will solve everything.
     
    #3
  4. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Tried your demo, the error didn't happen for me either :/


    Edit: Managed to make the error happen now.
     
    Last edited by a moderator: Apr 10, 2016
    #4
    Rikifive likes this.
  5. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    So that means that RM really hates me... Perhaps reinstalling could help ~ well for now I'll try the other input system ~ I hope that will help...


    Anyway thank you for your time! (=
     
    #5
  6. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I managed to get the error message. I'm debugging it now.
     
    #6
    Rikifive likes this.
  7. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    You've managed to crash the game? That's actually kinda nice to know, that it crashes for someone else as well.. =P
     
    Last edited by a moderator: Apr 10, 2016
    #7
  8. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yup. And the error makes no sense. I wouldn't believe what's happening if I hadn't seen it repeatedly.


    Are you sure it doesn't happen without the input script? Which scripts should I disable to disable the system?
     
    Last edited by a moderator: Apr 10, 2016
    #8
    Rikifive likes this.
  9. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    Exactly! My mind explodes because of that.


    Well ~ I'm pretty sure it is caused by this ~ otherwise I would have to be extremely lucky to not get crash, because I was doing so much things and nothing was happening.


    To disable the system, you need to get rid of these two scripts in the Input System Section


    [​IMG]


    LoadSo loads dlls and such;


    FyXInput handles the configuration and the system in general.


    However, removing these two will result in errors, since keys from there are used in menu scripts ~ You'll be getting errors due to lack of methods and such.


    Now I installed another input system and I'll see what happens. . . Though still what's happening there is a mystery...


    [​IMG]


    No seriously getting rid of that system seems to work. I was spamming with party formation and with parameters ~ everything works fine.


    This system is kind of broken ~ I had similar random issues with that before - that's why I tried Dekita's ~ though it also was throwing random errors, so I've restarted the project and tried that one (Fyx) once again ~ well it seems that there are issues with these systems. I hope the one posted on Himeworks will solve my problems because I absolutely need more keys.
     
    Last edited by a moderator: Apr 10, 2016
    #9
  10. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    The issue here is that the methods Enumerable#min and Enumerable#max are returning wrong values. Those are default ruby methods and getting wrong values out of them shouldn't be possible unless the methods were rewritten, but I found no evidence of that being the case. Maybe FenyxFire did that in his .so module.
     
    #10
  11. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    Hmm I have no idea...


    But thankfully (and hopefully) it is solved. ^^


    Thank you very much for your time and help! (=
     
    #11
  12. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Can I debug it too? I am curious about these mysterious errors. 


    I don't believe in random errors, and the fact that it always points to the same method and same line just indicates that it is NOT random.


    But just to clarify, that input system alone will NOT trigger that error. I used that input system for over a year in one of my projects, and I never got this error.


    However, when I moved the project from my old to my new laptop, the input checks suddenly started to freeze randomly, so I gave up on that input system as well.


    For alternative input systems, I use Neon Black's Keyboard Input script right now, and it works perfectly.


    I added some extra buttons myself for that system (like the numpad buttons, for example), and made my own methods for checking for multiple buttons at once. Adding these, I got everything I needed for my project regarding the input system.
     
    #12
  13. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    Sure, I've sent you PM.


    I know what you mean but this time it really happens randomly, so I don't know what to think anymore. ~ Also very rarely it CAN crash in other scripts/methods.


    Few times I got an error, where the game tried to divide for example current MP by Max MP when using MP growth item - it said that it can't divide by zero. ~ So where did that parameter go? There are happening even weirder things, but they're very rare. For example when you have the party window and you're using let's say potions, then there is a tiny chance, that for example MP of third character will 'move' for 1-2 frames. ~ Or TP jumping from 0 to max for 1-2 frames and getting back to 0. It's just a quick moment, but happened few times. My game scares me to be honest.


    I've made a fresh project and the system alone was enough to crash the game in the default item scene, so I really don't know what to think. Also I need to be extremely unlucky to crash the game now, since I can't recreate the issue after removing that system. Perhaps there is something behind all of this, but I sincerely don't know ~ I'm just telling what I've experienced, since I was looking for the source of troubles for about a week being afraid, that I'll have to restart my project once again*.


    * - I had a similar issue with that input system - It was crashing my game randomly when entering the battle scene - during transition. It also was completely random and unlike this time, it was really throwing me to random places around game battler, event interpreter etc..


    For now the one I'm using seems to work. ~ Unless Neon Black's has nice features like handling both controllers. =P
     
    Last edited by a moderator: Apr 10, 2016
    #13
  14. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Yup, as I mentioned before, the problem is with the "min" method of the Enumerable class. When passed the values 136.0 and 9999, it sometimes returns nil.


    There's no reliable way to trigger the error, so there's no way to know if something fixed it or not.
     
    #14
  15. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Ohh, there is a pretty sure way to trigger the error, and it is indeed related to that input script somehow.


    If you hold down any keyboard button (did not test it with gamepads) during any method running a line with a min+max calculating, the error will happen. 


    It only happens if you use both min and max, only min or only max will not trigger it at all.


    You can test it easily using this method:


    1000.times do
    6.times do
    8.times do
    val = rand(1000)
    p [[val,888].min,1].max.to_i
    end
    end
    end


    This simulates a 6 man party with 8 stats, just like in your menu script, and it executes this calculation 1000 times.


    See that min+max line? That triggers the error. But if I just use a simple min or a simple max calculation, the error never happens, no matter what I do.


    Also, if I don't hold down any button at all, the error won't happen either. But if I hold down a button, it is almost 98% that the error will trigger in the first run of that method, and a 100%+ chance to trigger it the second time running that method above.


    So, it seems that the input system indeed makes this happen. I wonder how thou... Since the error needs both the min and max method running on the same line, I am really puzzled. If only I could open and read that .so file (or that dll for that matter). >.>


    And it also explains why I never had this error in my projects. I prefer to use simple if/elsif checks for comparing two simple values instead of using min/max, and all of my stuffs were coded that way. 


    Anyway, I am convinced now that it is caused by that input system, so the mystery is less of a mystery now, but it still bugs me. Ohh, well, I will have to live with this, I guess. 


    Thanks for letting me check it! 
     
    #15
    Rikifive likes this.
  16. Hudell

    Hudell Dog Lord Veteran

    Messages:
    3,311
    Likes Received:
    2,902
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I'm sure I had that error happening some times without the min and max being on the same line.


    Well, even if they are in different lines, the operation is nearly the same, being in the same line doesn't mean they are executed at the same time. 


    I'll test your method of triggering to see if any of the code I wrote earlier fixes the issue.


    FenyxFire probably changed the min/max methods on his module, resetting those methos to the default native code should fix this, but may break his input system.
     
    Last edited by a moderator: Apr 10, 2016
    #16
  17. Rikifive

    Rikifive Bringer of Happiness Veteran

    Messages:
    1,442
    Likes Received:
    676
    Location:
    Poland
    First Language:
    Polish
    Primarily Uses:
    Other
    I see.


    That's great, that at least I know more about that issue now and that, it was definitely caused by that system. I was looking for the source of troubles for about a week and my mind was blowing.


    I've changed the input system to another one so I should be fine for now ~ but if not, then I'll try the one Sixth is using since I haven't tried that one yet.


    Thank you both so much for your time and help!
     
    #17

Share This Page