Jump to content
  • Advertisement
Sign in to follow this  
marshdabeachy

Better performance with... Flash?

This topic is 4411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This seems absolutely bizarre to me, since it makes no sense, but it seems that my DirectX programs encounter hitching and stuttering unless I have the Macromedia Flash Player running in the background. As soon as I open an instance of the Flash Player, the hitching almost completely disappears. This isn't just my computer either, if I move the EXE to another system the same thing occurs. I have no idea what the link between these things are. Has anyone else experienced this?

Share this post


Link to post
Share on other sites
Advertisement
That is incredibly bizzare. It makes me think that it has something to do with your initialization code or your main program loop. How is your CPU usage for your program?

Share this post


Link to post
Share on other sites
I know sometimes on my comp (a Mac running OSX btw), I used to be able to get a great performance boost in my OpenGL apps simply by shuffling my mouse cursor through the menubar, which, technically, should decrease performance. I don't know why this happened or under what exact circumstances, and of course, this is a completely different OS...but it seems to be the same type of thing somewhat.

Share this post


Link to post
Share on other sites
Quote:
Original post by Moe
That is incredibly bizzare. It makes me think that it has something to do with your initialization code or your main program loop. How is your CPU usage for your program?


I won't have access to the program until tonight (at work right now), but I believe it hangs around 10%. I don't remember it spiking at all, but I'll double-check.

Share this post


Link to post
Share on other sites
Is that a managed program? Not that I'd be able to explain this either way, but strange performance changes happened to me with managed.

Share this post


Link to post
Share on other sites
I don't even know what a "managed program" is, so probably not (I'm new to DirectX). It's just a standard Windows program. I'm using code from my instructor (from DigiPen) for the window wrapper. I asked him about the problem and he had no idea either. It may be somewhere in his code though.

Share this post


Link to post
Share on other sites
This definatly sounds like a render loop issue to me. I'd guess Flash's drawings cause an invalidation of some sort in your app, triggering the rendering faster.

What language are you using? And can you possibly paste the code to it?

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Flash is probelly changing windows internal timer resolution with timeBeginPeriod() as some mediaplayers do too. BTDT.

Share this post


Link to post
Share on other sites
I am using C++. I will post when I get home later tonight with the loop code.

As a side note, Flash doesn't have to be running in an open window for this to occur. It just has to be a process running in the background.

Share this post


Link to post
Share on other sites
Okay, here is the code for my main loop. I'm forcing the timeStep right now, but this problem happens either way.


int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {
MSG msg = {0};
HACCEL hAccelTable;

// Initialize resources
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MODE7);

CMainWindow* pMainWindow = CMainWindow::CreateMainWindow( hInstance, szTitle );

if (pMainWindow)
{
// Main message loop:
while(msg.message != WM_QUIT) {
Sleep( 10 );
while( PeekMessage( &msg, NULL, 0, 0, TRUE ) ) {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
// update game
pMainWindow->Update(
0.02f, // timestep
GetAsyncKeyState( VK_LEFT ) & 0x8000, // holding left
GetAsyncKeyState( VK_RIGHT ) & 0x8000, // holding right
GetAsyncKeyState( VK_UP ) & 0x8000, // holding up
GetAsyncKeyState( VK_DOWN ) & 0x8000 // holding down
);
}

delete pMainWindow;
}

return (int) msg.wParam;
}



I checked the CPU usage, and came up with some interesting results. When Flash is not running, my program is using roughly 0-2% of the CPU (and is choppy as hell). As soon as I open Flash, my program jumps to 35-45% CPU usage, and becomes noticably smoother.

And as a sidenote, what is the tag on these forums for code?

[Edited by - marshdabeachy on May 17, 2006 11:07:47 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!