Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Question: Do We Have To Flip The Screen Buffer Every Frame?

Author
Message
TheFallenAngel
6
Years of Service
User Offline
Joined: 13th Feb 2018
Location: Long Island, New York, United States, Earth
Posted: 15th Feb 2018 18:01
Hi,

Android is ready, HTML5 is not...
We need to get better performance on HTML5.

We tried flipping the screen buffer only on changes but it did not work as expected.
Do we have to flip the screen buffer every frame?

Let us know, thanks!

Jesse
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 15th Feb 2018 23:18
Hm, would you call it a frame without swaping the screen buffer ?
You could maybe skip the update and render for 3D if you make a 2D only game !?

Not sure if this helps at all.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Feb 2018 14:39
Why are you managing the buffer?
Or are you referring to Sync()?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
TheFallenAngel
6
Years of Service
User Offline
Joined: 13th Feb 2018
Location: Long Island, New York, United States, Earth
Posted: 18th Feb 2018 17:18
Hi,

We want to skip frames for slower computers on HTML5 version.
(HTML5 performance of our game is terrible)



We tried the above code but it does not work as expected.
(above code is called each frame at end of main loop)

Any ideas?
Thanks!

Jesse
puzzler2018
User Banned
Posted: 18th Feb 2018 17:35 Edited at: 18th Feb 2018 17:36
You should always have 1 sync per loop cycle

cause you have 1 sync in this If statement, does that mean you have another sync at the end of the main


This is probably way odd things happen
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Feb 2018 17:53
Sync() does more than just update the screen. It checks mouse position, keyboard input, runs physics, tweens and many more things.

The normal way to deal with slower machines is to reduce the overall frame rate. This can be self-managing if you use the frame rate to dictate your sprite movement etc. For example, at 60FPS a sprite moves 1 pixel per cycle, and at 30 FPS it moves 2 pixels per cycle. This is a very simple example, but scales to any frame rate.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
TheFallenAngel
6
Years of Service
User Offline
Joined: 13th Feb 2018
Location: Long Island, New York, United States, Earth
Posted: 18th Feb 2018 23:16
Ok, I'll see what I can do, thanks!
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 7th Mar 2018 20:56
Quote: " sync() // = Update() Render() Swap() "


It only updates 2D physics by the way, not really 3D physics. For that you need to still call Step3DPhysicsWorld() before the Sync() or Update() Render() Swap() if you manage the buffer/rendering manually).
The manual is actually slightly confusing, because Update() doesn't update 3D physics when Step3DPhysicsWorld() isn't called. And StepPhysics(time) is an optional command mostly useful for pausing physics, and generally called by Sync() or Update().

Using a second Sync() in an If statement most likely causes a frozen frame or huge stutter. I would never use multiple Sync() calls.

Login to post a reply

Server time is: 2024-11-21 20:02:27
Your offset time is: 2024-11-21 20:02:27