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.

Author
Message
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 3rd Sep 2013 09:45
Hey I have a simple program here that creates a sphere and displays text. I don't know if it occurred in the past for me, but for some strange reason. I get a pretty noticeable fps drop when I simply press any random key and hold it down. Even though I have no code that has anything to do with keys in the program. Can anybody explain this? im dropping from about 2.4k fps to 1.2k fps. I know my program doesn't need to be that high, but I was encountering the problem while tryin to run my program at 60 fps. I had a simple move camera while holding key in the program and noticed the fps basically cutting in half, so I put the sync rate at 0 and tried to cap out to see how much of an effect it had and it was definately noticeable. Any help is appreciated.

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Sep 2013 11:39 Edited at: 3rd Sep 2013 11:45
Quote: "2.4k fps to 1.2k fps"


Two things.

Number one, the sync call is more complicated than it appears; amongst other things, it is also iterating through windows message events; including key strokes. I believe FastSync bypasses this pipeline.

Two; the frame-rate drop is very small, even though the digital representation indicates otherwise. 1.2k FPS is 833 microseconds (that is 0.833 milliseconds) between each sync call. 2.4k FPS is 416 microseconds between each sync call. Such a small difference in human perception is impossible to notice in gameplay or animation.

FPS is a measure of frequency, like a Hz, a number of cycles per second. Just like GHz of CPUs, the higher the number, the less significant the performance improvement. It can be illustrated with an up-slope curve.



Anything above your monitors refresh rate is fine in a simple application. Performance management is an advanced topic in its own right. You should cap your FPS at 60 using the sync rate command if that is your target; being the minimum monitor refresh rate. But that is a quick fix, not the professional way. You should cap the FPS unless you enable Vertical Sync or develop your own sync timing pipeline.

The FPS should not be used for timing.

Any additional processing after 60 loops in the same second is wasted battery life on a mobile device, and resources for your operating system. If you check your resource manager you will find your text program consumes the most CPU compared to all of your applications. This is down to processing too many times each second.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Sep 2013 12:03 Edited at: 3rd Sep 2013 12:04
Quote: "I had a simple move camera while holding key in the program and noticed the fps basically cutting in half"


If you can reproduce that and share the code for it, that would be highly interesting.

[EDIT] Ninja'd by Chris
Under the hood, DBP processes the input queue whenever you call sync. If you press a key, the queue isn't going to be empty, thus there is going to be more processing to do.

With such a simple example, the only command you're really calling is sync and a text function, so the impact of pressing a key is going to be very high. I'm sure if you ran this, the impact wouldn't be high anymore:



TheComet

pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 3rd Sep 2013 15:07 Edited at: 3rd Sep 2013 15:21
@Chris
I was originally running it with my sync rate set to 60. it was dropping from 60 to about 35. I'll have to look into fast sync. I've messed with vsync before but that has to do with the buffer drawing at seperate times then the images getting sent to it through the out of sync cycles causing artifacts. I wasn't sure what fast sync did and just believed that it would sync for anything occuring in the background, but would not refresh the screen.

Edit:
I have stripped it down to this. It has to be with the dark basic pro sync function because if i run this program and hold down the space key. I drop down to about 39 fps


So how could I go about fixing this? Will I have to create an entirely new sync function?
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Sep 2013 15:43
OK so the problem is not universal because I experience no slow down whilst holding down keys.

Is there any software driver or automation tool listening to keyboard input on your system? Do you notice any high CPU usage in any other program while the keyboard is being pressed?

I am not sure if DBPRO is the cause of your problem

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 3rd Sep 2013 23:26 Edited at: 3rd Sep 2013 23:27
Quote: "Any additional processing after 60 loops in the same second is wasted battery life on a mobile device, and resources for your operating system. If you check your resource manager you will find your text program consumes the most CPU compared to all of your applications. This is down to processing too many times each second."

Thanks for saying this. I completely agree.
Here's more info in this: http://forum.thegamecreators.com/?m=forum_view&t=202812&b=1

Includes details on how to let the CPU properly rest when the game has free time, to reduce usage, heat, and power. GPU also.

pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 4th Sep 2013 00:47
Hey guys I got it... Although I can't really say what the source was as I don't know. After Chris said that the problem wasn't universal I figured my computer could use a shutdown. I'm not experiencing the problem anymore. After so many days of use with no shutdown. I occasional have to shutdown my computer b/c it begins to slow down. If the problem occurs again and I figure out the source. I'll let everyone know what it was
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 4th Sep 2013 16:34
We forgot the first rule of "IT SUPPORT".
He turned it OFF and ON again.



http://www.youtube.com/watch?v=nn2FB1P_Mn8

[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 4th Sep 2013 17:34
Quote: "After so many days of use with no shutdown."



Or I suppose you was working on it 24/7?

WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 5th Sep 2013 05:26 Edited at: 5th Sep 2013 08:17
Quote: "Number one, the sync call is more complicated than it appears"


I agree, somebody who really knows the inner workings of DBPro should write a tutorial on this. So many here on the forum have problems with this. But there are so many other functions that do a lot more then the help file states. If you run this code in a window and press the X in the upper right corner to close the window, the program will not exit. So, is it the sync function or something else that is processing this window message? As you can see the key press message is still being handled. Now if you replace the repeat/until with do/loop you can close the window with the X just fine. Fastsync appears to just bypass the set sync rate.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 5th Sep 2013 07:45
120 is the new 60. Please please PLEASE keep in mind that a lot of hardcore gamers now have 120Hz monitors. Capping their game play at 60 would crush their little hearts. ;_;

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 5th Sep 2013 07:54
Quote: "120 is the new 60. Please please PLEASE keep in mind that a lot of hardcore gamers now have 120Hz monitors. Capping their game play at 60 would crush their little hearts. ;_;"

I agree, it's good to have a settings screen or some way to adjust the frame limiter.


Quote: "I agree, somebody who really knows the inner workings of DBPro should write a tutorial on this. So many here on the forum have problems with this. But there are so many other functions that do a lot more then the help file states. If you run this code in a window and press the X in the upper right corner to close the window, the program will not exit. So, is it the sync function or something else that is processing this window message. As you can see the key press message is still being handled. Now if you replace the repeat/until with do/loop you can close the window with the X just fine. Fastsync appears to just bypass the set sync rate. "

I agree also the sound system isn't updated with fastsync. You need to use sync to have the listeners update their positions. You really can't use fastsync exclusively.

WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 5th Sep 2013 08:16
I wouldn’t suggest using fastsync exclusively. But for instances where you need to sync to multiple cameras, by using sync once and replacing the others with fastsync you can get your frame rates back up. I wasn’t aware of the sound system issue, thanks for that.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Sep 2013 09:39
Quote: "120 is the new 60. Please please PLEASE keep in mind that a lot of hardcore gamers now have 120Hz monitors. Capping their game play at 60 would crush their little hearts. ;_;"


It's hard to get any game to even run that fast. Especially if you're using DBP...

You don't notice any difference between 60 and 120 anyway, your eyes' reaction speed is around 50 Hz.

TheComet

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 5th Sep 2013 13:10 Edited at: 5th Sep 2013 13:15
Counter Strike GO runs at 64 or 128 updates per second; it is left up to the user to choose their desired refresh rate for their computer or for their dedicated server.

For an FPS game like CSGO or some other action packed or sporty video game the excess updates beyond 60 improves online response and precision; so higher FPS will improve gameplay, it will not improve the look of the game.

Professional video game players; yes they exist; will swear by setting high refresh rates.

You cannot perceive 120 visual frames per seconds as TheComet pointed out; you only notice frame stuttering low frame rates depending on how good your eyes are.

You can think of the DBPRO sync command as a batch rendering call; as well as a windows message update. All the objects are Z sorted, shortlisted, shaded and rendered for each active camera.

You could bypass a sync call every so often if your frame-rate is optimal. Your game can be sync-paused or re-looped without a sync call because it might not be necessary to render what is on screen if what is visible has not changed.

In my game the physics has dynamic iteration, so the host of the game can run a number of physics loops before the next render if any frames have been dropped, or the physics iterations can be reduced or paused if the system is running extremely fast. Catmull-rom interpolation will be used to guess where things are during stuttering and major slow-downs.

Two of DBPRO's performance weaknesses is the object pipeline and bone animation. These processes reside in the sync call and are a potential threat to your FPS particularly when such objects are in the screen.

To create a room with windows and doors, you can save performance by making each aspect of the room a limb. Even better, would be to make all static objects in the room the same limb with an atlas based texture. These kinds of facts come through regular testing and tweaking.

Another threat to FPS is excessive 2D drawing calls; without using a plugin like D3DFunc or my preference Advanced2D.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Sep 2013 17:07
Quote: "If you run this code in a window and press the X in the upper right corner to close the window, the program will not exit."


Closes fine for me. W7 and U77RC7.



Powered by Free Banners
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 5th Sep 2013 17:43
The difference between performance in a repeat/until vs. do/loop, I believe, is that many years ago DBP was modified to avoid automatic checking for an Escape key press during a do/loop specifically. The users were accorded one type of loop that could run faster to reduce the time needed for loading assets in an environment where the escape option would not be in high demand. One can always add a check for Escape (or any other key to trigger a loop exit) in do/loops where a need for an escape is present.
Inflictive
17
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 6th Sep 2013 07:31
Quote: "120 is the new 60. Please please PLEASE keep in mind that a lot of hardcore gamers now have 120Hz monitors. Capping their game play at 60 would crush their little hearts. ;_;"


This ^. Pretty much every modern pc game that isn't crap runs at a variable framerate and uses and many resources as possible. Although it may seem "unnecessary", it does make the game feel less input laggy.

Why wouldn't you want to use all the available resources? The only reason I can see is laptop power saving, and the answer to that is to have a VSync setting, like every other modern pc game. As for overheating, your hardware is designed to run at %100 for extended periods of time, and if they get too hot they should just downclock.

A good way to do timer based movement is, rather than dividing movement by the framerate, multiply movement by the amount of milliseconds passed since the last frame. That way it should completley jitter-free. Even if you don't think it's necessary and don't want to program timer based movement, you need to because the user might have a low-end sub-60 fps system and you don't want the game moving in slow motion.
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 6th Sep 2013 08:45
@mr handy
lol no I am not on it 24/7. I just typically leave my computer in hibernate and don't like turning it completely off unless I'm done with the current project. Even though I could save, exit all windows, and shutdown. I hate trying to back track and figure out what windows I had open and why lol.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 6th Sep 2013 12:21
Quote: "I hate trying to back track and figure out what windows I had open and why lol."

There is an option in Windows to open last opened windows.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Sep 2013 12:49
Quote: "Why wouldn't you want to use all the available resources? The only reason I can see is laptop power saving"


And unnecessary fan noise, wear and tear of course. I would use the minimum resources that get the job done.



Powered by Free Banners
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 7th Sep 2013 00:03 Edited at: 7th Sep 2013 00:11
Quote: "Why wouldn't you want to use all the available resources? The only reason I can see is laptop power saving, and the answer to that is to have a VSync setting, like every other modern pc game. As for overheating, your hardware is designed to run at %100 for extended periods of time, and if they get too hot they should just downclock."

Vsync in DBPro still runs the CPU at 100%. It also has the tendency to deal people down to 30fps if they any quite make it to 60fps.

It's real purpose is to prevent screen tearing.

Login to post a reply

Server time is: 2026-07-07 09:29:02
Your offset time is: 2026-07-07 09:29:02