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.

AppGameKit Studio Chat / [SOLVED] Best Method To Skip Drawing Frames But Still Process Logic Each Frame?

Author
Message
JeZxLee
2
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 6th Jan 2020 18:17
Hi,

We need to skip drawing frames when the game is running too slow while processing logic each frame.
What would be the best/easiest method to do the above?
Let us know, thanks!

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com

The author of this post has marked a post as an answer.

Go to answer

JeZxLee
2
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 6th Jan 2020 19:00
Hi,

We have the following code in main loop:


And update screen in main loop:


Thanks!

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
PSY
Valued Member
3
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 6th Jan 2020 19:07 Edited at: 6th Jan 2020 19:30
- Have a variable that holds the update interval. An interval of 3 means all the drawing stuff is done every THIRD frame
- If the game runs too slow, the player can set/change the interval value in the game options

Code:




@Jesse
with your code, the higher the FPS, the lower the performance variable. That doesn't make sense. You need to calculate PerformancePercent = ( roundedFPS / 60 ), not vice versa.



Sorry, Bad Gateway while posting.


PSY LABS Games
Coders don't die, they just gosub without return
JeZxLee
2
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 6th Jan 2020 19:44
Good stuff!

Let me play around with what you posted now...
Thanks!

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
JeZxLee
2
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 8th Jan 2020 20:08
This post has been marked by the post author as the answer.
Ok, got it to work, thanks!

JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com

Login to post a reply

Server time is: 2020-02-20 09:41:24
Your offset time is: 2020-02-20 09:41:24