Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
HTML5 Export Physics behave different — Gideros Forum

HTML5 Export Physics behave different

Hello,

I am trying to make my first game with Gideros which will be a clone of flappy bird. When I check from default Gideros player my object jumps correctly. Or when I export as Windows exe, it correctly working. But when I export as HTML5, it doesn't jump correctly.

Generally I can jump up to top of the window for other exports or player. But when HTML 5 I can jump up to 1/4 of the window, even if I try to click fast. Is there any fix for that or it's something like beta and can't fix right now?

Comments

  • please check your game scalemode in the project properties.

    Likes: Apollo14, hgy29

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+2 / -0 )Share on Facebook
  • @MoKaLux thanks for your answer. I didn't understand how physics engine related with scalemode but I still checked and it's set to Letterbox. Do you think I should change?

    I am adding 2 image for comparison, shows how much I can jump difference between player and HTML5 export
    image

    image

    As you can see the second image, html version only can jump up to nearly half screen.
    jump.png
    363 x 693 - 36K
    jump2.png
    434 x 756 - 45K
  • hgy29hgy29 Maintainer
    Did you hardcode your world:step() values by any chance ? Beware that on HTML the FPS is often 30fps and not 60 (due to browser scheduling), so you'd better specify a step value in accordance with the actual fps
  • @retif It is necessary to check which platform (html5, android, win) before starting the game, and depending on this use the jump height factor.

    I was trying to calculate the real FPS as @hgy29 advised - and it didn\u0027t work.
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • @hgy29 thanks, and yes when I make world:step 30 fps I can see same effect on gideros player. But after I fix the problem on gideros player, HTML5 player still has problems. It looks like HTML5 version of engine works different then others :( It seems like can be fixeable with playing gravity and velocity but its not easy to test. Every change you need to export and try again. Thats not possible to make development like that, is there any HTML5 player which works directly from gideros studio?
  • @oleg same question, it will be hard to test on html version because of you need to export again and again on every change to test it. Is there any easier way?
  • hgy29hgy29 Maintainer
    @retif, I think you misunderstood my point.
    Don't use hardcoded values for the FPS, instead use
    world:step(Core.frameStatistics().meanFrameTime,...)
    or eventually the deltaTime of ENTER_FRAME event.

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • olegoleg Member
    edited September 2019
    retif said:

    @oleg same question, it will be hard to test on html version because of you need to export again and again on every change to test it. Is there any easier way?

    You can change the coefficient manually when exporting to HTML5 to set one value and when exporting to win to set another.
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • @hgy29 what does that value will be for different devices? For different computers is that can cause different FPS? Then the engine will behave differently and game can be easier/harder for different computers. I think thats shouldn't be.

    We need a fixed minimum FPS for good experience. I am okay to set variables/values specific for HTML5 but then I can't test it while developing. Because still gideros player and HTML5 player works differently for physics engine :(
  • hgy29hgy29 Maintainer
    Accepted Answer
    That value will reflect what the device can actually do. Understand, this is not HTML5 specific, it is just whatever the truth is depending on the hardware/software the app is running on. Nothing you/we can do about it.
  • Okay, still thanks for all answers :smile:
  • antixantix Member
    Accepted Answer
    @retif did you try as @hgy29 suggested and use the deltaTime for your step value? If you did this you should get the same result on both device and in HTML5.

    Likes: retif

    +1 -1 (+1 / -0 )Share on Facebook
  • @antix Oh I didn't try actually because of I was thinking same with Core.frameStatistics().meanFrameTime but looks like different. I tried and now it works same for Player and HTML5 :) Thank you so so much, if you have paid game I want to buy it now :)

    But it's not like smooth like 30 fps or 60 fps, do you have any trick to make it more smooth?

    Also I want to add code, incase someone else search and came to here, my latest step code is like this;
    function Game:onEnterFrame(e)
    	self.world:step(e.deltaTime, 8, 3)
    end
    +1 -1 (+4 / -0 )Share on Facebook
  • @retif, no problem.. hmm.. checkout Mini Putt Golfing ;)

    I'd have to see some actual code to see if it could be made smoother but really it should be smooth unless the machine hasn't enough horsepower to do everything in the browser.

    do you get different results in different browsers?

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.