GM:S 1.4 Compiled game runs much shower

Discussion in 'Legacy GameMaker Community Tech Support' started by Raoul, Feb 11, 2019.

  1. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Hi,
    I have been working on a remake of the original Donkey Kong and after 3 months of develoment I decided to consider it completed.

    The game runs perfectly under GM 1.4 interpreter but the compiled version runs extremely slow even on modern computers.

    I enabled "show_debug_overlay" and it shows same values both in interpreted and compiled mode, on a few systems I tested it I got above 2000/3000 fps.

    Also, I made sure cache was cleared before compiling, disabled Vsync.

    The game is very light, and as I said it plays without glitches when run within the editor.

    I run out of ideas, but I can't imagine that I did all this work for nothing.

    I really hope some expert coder can help me with this, I am open to any suggestion.

    The compiled version can be downloaded via the link in my signature but I guess it will run slow for you as well, so I think I might need to paste here portions of the source code, general settings?

    Please please, don't let my project die in this way :-(
     
  2. JackTurbo

    JackTurbo Member

    Joined:
    Oct 19, 2016
    Posts:
    821
    Runs fine for me on my desktop (Win7 64, 4ghz i5 GTX780)

    Have you tried it on multiple machines? What is your sleep margin set to? Does the game use v-synch?
     
  3. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Thanks for your feedback!

    I have tried it on 3 systems, plus some friends on their own PCs (but I didn't see them while playing)

    Apart from one system on all others the game plays slow.
    V-sync is disabled from global game settings.

    Not sure about the sleep margin question, can u elaborate it further?

    One other thing, on the systems where the game plays slow also the audio is behaving funny, some times playing effects twice, some others just with audio glitches :(

    The most weird thing is that the compiled game runs slow also on the system where GM 1.4 is installed and from where I coded it, while it runs extremely fluent on interpreter.

    P.S.
    Seen the videos from your game, it looks really cool, is there a longer video showing more of the gameplay?
     
  4. JackTurbo

    JackTurbo Member

    Joined:
    Oct 19, 2016
    Posts:
    821
    In your game settings somewhere there should be a setting called sleep margin. If it's less than 10 try setting it to that and testing. If that doesn't work try 15. Don't go higher than that though.

    You can look up sleep margin on here or the manual for a detailed explanation, but it has to do with the idle time between steps. Having it low uses less power, but can have weird frame issues on certain systems.

    Thanks for the kind words about AADay In Valhalla. No more footage at the minute but work will resume on it soon :)
     
  5. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Hi again,
    when you wrote about the sleep margin I was very confident it was going to be it but unfortunately it didn't work neither, I had it to 1, went to 10,15 but no luck.
    I read an interesting post about what that parameter does but unfortunately doesn't apply to my case.

    However I did try using the 'fps' command into the draw event of my main object and things got even more confused now but at least I have a starting point.

    On the same Win 10 system, when I run the game, sometimes it will show 50 fps (all the time, any room), some other times it will correctly show 60 fps.

    I know it sounds impossible but this is what I am experiencing, a non predictive behaviour with fps?

    I just compiled and uploaded a new version which shows fps on screen.

    if it shows 50 then something is wrong and I don't know yet what.

    I hope a few can try it and post here the value they get, it should be 60 stable in every condition, if it shows 50 or less fps then I have really no idea of what is going on
    (I checked video settings but everythng looks ok, but again why should it run at 50 fps and some other times at 60?
     
  6. immortalx

    immortalx Member

    Joined:
    Sep 6, 2018
    Posts:
    296
    Just tried it and I get a constant 50 fps. There's also something wrong with the full screen mode on my machine. I only get a white screen.
     
  7. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Back again, sorry for the flooding but I feel like I want to cry :(

    I run it multiple times and noticed the following:
    When it starts at 60 fps it will always play at 60 fps.
    When it starts at 50 fps, it will never go above 50 but sometimes it will go down to 30, 24, even just 1 fps for a fraction of time.
    I can't think of anything wrong with the code as this has never happened when running the game from the GML 1.4 enviroment without compiling it.

    Adding a few screens showing this weird behaviour, I feel like something is wrong with the compiler?

    30fps.png

    50fps.png


    60fps.png
     
  8. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Thanks for your feedback immortalx, this confirms the weird behaviour with the framerate.
    Unless your screen has a refresh ratio of 50 Hz than I have really no idea why the games does like this.

    I am curious to know if for you it will always start at 50 fps or sometimes it starts at 60.

    Does it shows correctly when not in full screen? (Key F will switch from full screen to window mode, or I guess you can just do a ALT+Enter)



    I am now cheking line by line of code to se if I see something wrong but I think this has more to do with DirectX or the compiler than the code itself :(
     
  9. immortalx

    immortalx Member

    Joined:
    Sep 6, 2018
    Posts:
    296
    My monitor is a 60hz one and the game shows correctly on windowed mode.
    Is there a profiler in 1.4? If there is, maybe it can help you track the problem.
     
    Raoul likes this.
  10. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    I will give a try to the profiler, I abrely used it in the past but this time it seems much needed, thanks for the advice
     
  11. immortalx

    immortalx Member

    Joined:
    Sep 6, 2018
    Posts:
    296
    If you do any test versions, please feel free to ask and I'll test it in my machine.
     
  12. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Man thanks for your help here, I have also some friend doing the same, I will remember to mention your name/nick in the game credits if you wish ;)

    I spent the last hours searching in the blog and I found others reporting similar problems with their projects, in example:

    https://forum.yoyogames.com/index.p...te-synchronization-method-come-to-gms2.22440/

    https://forum.yoyogames.com/index.php?threads/alternate-synchronization-method.34805/

    I have just recompiled the game with this alternate sync method, so if you want to give it a try I hope it will make the game run at 60 fps on your system too.

    Thanks in advance!
     
  13. Bayesian

    Bayesian Member

    Joined:
    Sep 13, 2016
    Posts:
    421
    Running at 60 every time for me
     
  14. immortalx

    immortalx Member

    Joined:
    Sep 6, 2018
    Posts:
    296
    I just tried it in another, much slower and older PC (core2 duo 6400, 4GB RAM, Nvidia GTX 260) and it runs at 60, sometimes going up to 64. It worked in full screen too, no white-screen this time.
    When I get back home I'll try it in the PC in which I run it first time and will report back.
     
  15. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Great, did you try version 98m that I posted last night? I enabled the alternative sync method and it seems to have fixed the problem for many.
    I guess it will also show 60 fps on the first system you tested the game on (the one showing 50 fps)

    I tested it on a very old pc and it was showing 700 fps! enabling Vsyng (key D) fixed it to 60 fps.
     
  16. immortalx

    immortalx Member

    Joined:
    Sep 6, 2018
    Posts:
    296
    OK, I tried it on my home PC and it seems it's fixed. Runs at 60.
    I experimented a bit with the full screen mode, which wasn't working previously and here's what I found: I have a 3-screen setup (2 monitors + TV). The full screen mode works fine on my secondary monitor and on TV, but shows a white-screen on my primary monitor. I don't have a clue what would be causing that.
     
  17. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    1,216
    Do yourself a huge favor an remake the entire game, as apposed to random slight variations of the first level like most people do...

    (Sorry for being off topic but this is just my personal advice)
     
  18. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,136
    You could try the old 'application_surface_enable(false)' free boost, provided your game doesn't specifically rely upon it.
     
  19. Raoul

    Raoul Member

    Joined:
    Dec 13, 2018
    Posts:
    37
    Not sure what you mean, I remade all of the 4 original levels trying to be as much accurate as possible, not just the first one.
    When you complete the 4th level the game starts over again from level 1 with increased difficulty.

    This is how the orignal game (Jap version) works and what I am trying to replicate.

    I am however considering to create one (or more) brand new level, mantaining the original style of the game.
    Given that the engine and all objects are the most of the work and it is already done, I must only spend some time on level design ;-)

    Also, many friends have asked to add the online scores saving which I think it's easy to implsment via PHP/SQL, will have a look at it in the weekend.
     
    Last edited: Feb 13, 2019
    Samuel Venable likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice