Ive tested this multiple times on my computer to be sure it wasn't a fluke...if its isnt, well I hope it can be fixed for the next release :)
My game (up until I accidently discovered this possible bug) has been running at about 60 fps. I started Windows Media Player with an audio cd, pressed "stop" and minimized it. I then pressed F5 to run my game. The FPS is now 100 fps!! A gain of 40 fps, incredible...
I then closed Windows Media Player and the game. I pressed F5 again, and this time the FPS has returned to 60. So if the WMP is opened, my game runs 40 fps faster...
-Windows 7, x64
-Windows Media Player (version 12.0.7600.16415)
-Direct3D9 mode
-No graphics filter
-Side Borders On
-Smooth Scaled Sprites On
-Run the game windowed
Can anyone else reproduce this?
**EDIT: I tested this with VLC Media player aswell (version 1.1.7 x32) and I got the same results...
ps: (oh, and of course, if this bug could be fixed so that even without a player running the game still runs at 100fps :P)
I tested this at home and I get the same results...also, I found something interesting:
I tested an older version of my game at home with "Enforce new-style audio scripting" set to false, and when Windows Media Player (or VLC player) is open, the fps stays at 60...however, if I set "Enforce new-style audio scripting" to true in that very same game, then the fps jumps to 100 with either of those media players opened.
I believe the "Enforce new-style audio scripting" has something to do with this bug....
**EDIT: Ok , with further testing "Enforce new-style audio scripting" doesnt seem related...
I tested it on my very first version of my game back in 2009 and if VLC player or WMP is open, the FPS jumps up 40 frames per second no matter what setting.
I also reproduced this bug with a fresh newly-created test game:
STEPS:
01) Create a fresh new game (any resolution)
02) Make sure SetGameSpeed is set to 100 everywhere in GlobalScript
03) Make sure in game_start you have Debug (4,1)
04) Run the game (any setting)
05) Open up VLC player
06) Notice the FPS goes up 30-40 fps
07) Close VLC media player
08) Notive the FPS goes back down about 30-40 fps.
...hopefully it can be reproduced on someone else's computer!
What sort of machine are you using?
If you press Ctrl-Alt-Esc [DURRR Ctrl-Shift-Esc] and go to performance, is there any CPU remaining?
It could be you're just running up against a performance limit.
If there's plenty remaining, you could try switching between Direct Draw and Direct3D. You could also try running with different sound options.
[EDIT] Presumably you're not playing with System.VSync... The manual says it shouldn't have any effect with DX9 but that could be out of date.
Quote from: Kweepa on Tue 22/02/2011 04:51:15
Ctrl-Alt-Esc and go to performance, is there any CPU remaining?
Actually to avoid confusion, on Windows 7 it's Ctrl+Shift+Esc to access the task manager.
Quote from: Ryan Timothy on Tue 22/02/2011 05:00:47
Ctrl+Shift+Esc
Oh, I never knew this, I just tried and this works also on XP (Ctrl-Alt-Esc is for minimising the active window only). I always used Ctrl-Alt-
Del to bring up the task manager until now... :-[
Yes, but Gilbot, in Vista OSes (read as Vista and 7, since both are built on the stupid, horrible, broken, worthless Vista kernel) Ctrl+Alt+Del brings up that entire other Menu first which when you're actually facing a total freeze-up unless something (possibly a program leaking memory..) gets killed right away..makes it somewhat counterintuitively worse.
For some reason Microsoft has taken up this idea that making Ctrl+Alt+Del less and less useful, despite being one of the most widely recognized system key combinations ever, is a really good plan. Seriously, CAD in 95/98 > XP > 7. I won't even list Vista because I don't even accept it as an operating system.
Quote from: monkey_05_06 on Tue 22/02/2011 06:30:31
CAD in 95/98 > XP > 7
Hehe, but more seriously:
C-A-D in DOS > 98/98 > XP > 7 :=
You didn't only ignore Vista though, there were also more obscure ones such as 2k (all right, I know that 2k was less aimed at home users anyway) and millen... errr (FORGET IT).
Ok well I did this test this morning:
I have the AGS D3D VSync plugin installed...when it isnt activated and VLC player is open, my fps is 100. If I activate the VSync plugin, the framerate doesnt go up to 100, it stays at 60fps.
The question is, if I dont have this plugin activated, how can I keep my 100 fps without needing to open a media player?
@Kweepa: I checked performance and either way the cpu is between 1-3%...no difference. Also using Direct Draw or Direct 3D doesnt change my test results. This is quite important for me to debug since I can potentially gain 40 fps...which is freakin awesome :)
What is the VSync plugin? Ah, I see. Calin E-S-O-F's plugin. Hmm, so it appears that it only works when a media player is active. Weird. He should probably be informed.
VSync is supposed to set the FPS to 60. If you want 100, you should turn off VSync. But then you'll get tearing.
Why do you need 100FPS? 60 is enough for most games, and most monitors don't even refresh at 100.
[EDIT] Edited in light of discovering what the VSync plugin is.
Well I do have VSync turned off (I disabled the plugin), and I wont get 100fps unless a media window is opened...which is weird, no?
60 is good, but thats when nothing is moving. Ive got a GUI with fullscreen effects and other things, so when the mouse cursor is moving, animations running, etc, in that heavy zone, that 60 drops to around 35. When VLC is open and 100fps, in that same heavy area, it drops to around 50...a gain of 15fps in that heavy area (and I wont have an area heavier than that for the whole game...its a good place for me to test what the lowest fps for my game might be).
Maybe not useful, but this "trick" works on other games too. I first saw people mention it when I was playing Conan a couple of years ago and they looked for ways to get more FPS.
If I remember correctly(which I'm probably not) It has something to do with priority level and I think you would get the same effect by setting AGS to high in task manager.
Hi Zyndikate,
That's a good idea...I tried it on my game, and unfortunatly it didnt change the results...doh!
Is anyone else getting these results or is it just an isolated case?
Huh.
Are you using a laptop with processor throttling?
Perhaps you could fiddle with the power saving options.
(Heh. General_Traitor.)
Oh ok, I might have remembered wrong.
Here is an article:
http://www.nextlevelgamer.com/tweaks/windows-media-player-performance-tweak
@ Kweepa: ok Ill investigate that (not a laptop, tested on my work + home cpu's, both win7 x64)
@Zyndikate : thnx for the link, I'll check it out!
**EDIT**
Here is Zyndikate's article:
Quote
A Windows Media Player Trick
This pertains mainly to load times, but you may see an increase in FPS as well. Next time you run Counter-strike 1.6 or Source try leaving Windows media player idly running in the background (obviously not playing any songs). Apparently Windows Media Player will speed up the performance of your computer due to a service that it uses called, “Multimedia Class Scheduler Serviceâ€.
This article on wikipedia explains this service and what it does to help you gain performance. Here is a quick excerpt from the article:
“Multimedia Class Scheduler Service (MMCSS) is a Windows service that boosts the CPU as well as I/O priority of a thread. It allows an application to get prioritized access to CPU for time-sensitive processing (such as multimedia applications) as well as prioritized disc access to ensure that the process is not starved of data to process. The MMCSS service monitors the CPU load and dynamically adjusts priority so that the application can use as much CPU time as possible without denying CPU to lower priority applications.â€
So from the sounds of it, any of you that have already tweaked steam to run in low processor affinity through this tweak guide, may see almost no performance gain. Still, it’s worth a shot? Post comments if you noticed a difference in speed.
ok so it seems that the Multimedia Class Scheduler Service (MMCSS) is the culprit...I tested this while having Adobe AfterEffects opened at the same time as AGS and the frame rate jumped up to 100 aswell.
What Im wondering is, windows seems to detect certain programs as multimedia, and then that MMCSS kicks in, giving better performance...
...is there a way for someone to add "something inside" compiled AGS games that gives the message to windows to use MMCSS? This way, all AGS games will automatically get that cpu boost for fps wihout having to tweak the task manager or open up media players.
http://msdn.microsoft.com/en-us/library/ms684247(v=vs.85).aspx (http://msdn.microsoft.com/en-us/library/ms684247(v=vs.85).aspx)
Quote
Multimedia Class Scheduler Service
The Multimedia Class Scheduler service (MMCSS) enables multimedia applications to ensure that their time-sensitive processing receives prioritized access to CPU resources. This service enables multimedia applications to utilize as much of the CPU as possible without denying CPU resources to lower-priority applications.
MMCSS uses information stored in the registry to identify supported tasks and determine the relative priority of threads performing these tasks. Each thread that is performing work related to a particular task calls the AvSetMmMaxThreadCharacteristics or AvSetMmThreadCharacteristics function to inform MMCSS that it is working on that task.
For an example of a program that uses MMCSS, see Exclusive-Mode Streams.
Windows Server 2003 and Windows XP/2000: MMCSS is not available.
Registry Settings
The MMCSS settings are stored in the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile
This key contains a REG_DWORD value named SystemResponsiveness that determines the percentage of CPU resources that should be guaranteed to low-priority tasks. For example, if this value is 20, then 20% of CPU resources are reserved for low-priority tasks. Note that values that are not evenly divisible by 10 are rounded up to the nearest multiple of 10. A value of 0 is also treated as 10.
The key also contains a subkey named Tasks that contains the list of tasks. By default, Windows supports the following tasks:
•Audio
•Capture
•Distribution
•Games
•Playback
•Pro Audio
•Window Manager
OEMs can add additional tasks as required.
Each task key contains the following set of values that represent characteristics to be applied to threads that are associated with the task.
Thread Priorities
The MMCSS boosts the priority of threads that are working on high-priority multimedia tasks.
MMCSS determines the priority of a thread using the following factors:
•The base priority of the task.
•The Priority parameter of the AvSetMmThreadPriority function.
•Whether the application is in the foreground.
•How much CPU time is being consumed by the threads in each category.
MMCSS sets the priority of client threads depending on their scheduling category.
I wouldn't make it automatic, as most games don't have a lot of effects and don't need to burn the CPU. As a laptop user, I appreciate not having my testicles toasted for no reason.
A checkbox in the options pane might be better.
hehee!
An option box is a good idea...!