Very weird google chrome issue with game.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
like80ninjas
Chaos Rift Regular
Chaos Rift Regular
Posts: 101
Joined: Thu Dec 09, 2010 2:13 am

Very weird google chrome issue with game.

Post by like80ninjas »

I was writing up an engine the same way I always do but this time something odd is happening.

I'm using SFML and setting my framerate limit to 60.

When google chrome is open my game gets 60 fps, or whatever I set it to.
When google chrome is closed my fps goes to about half of whatever I cap it to.

My compiler is Visual C++ Express and I literally just started this new engine,
so all I have is a window and some basic sprite stuff.

I can't figure this out at all, so if anybody knows the magic reasoning behind this I'd appreciate the help!
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Very weird google chrome issue with game.

Post by dandymcgee »

Wait what?? Closing Google Chrome makes your game run slower? Is it's a web-based game? That makes zero sense.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
like80ninjas
Chaos Rift Regular
Chaos Rift Regular
Posts: 101
Joined: Thu Dec 09, 2010 2:13 am

Re: Very weird google chrome issue with game.

Post by like80ninjas »

Yes, I am just as confused as you are.

It's c++ SFML and OpenGL only.

Also, it is very simple code, just bringing up some basic sprites to draw, not a whole game.

If Chrome is closed it will run at 30fps with SFML frame limiter set to 60.

With Chrome open it runs at 60fps with SFML frame limiter set to 60.

Basically with chrome closed I get 30-50% frame rate.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Very weird google chrome issue with game.

Post by Falco Girgis »

How are you limiting your framerate?
like80ninjas
Chaos Rift Regular
Chaos Rift Regular
Posts: 101
Joined: Thu Dec 09, 2010 2:13 am

Re: Very weird google chrome issue with game.

Post by like80ninjas »

I'm using an SFML function in the window class called something like "setFramerateLimit( int limit )".
It seems that this function uses a clock to count the time and then Sleeps the remainder of the frame using the OS.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Very weird google chrome issue with game.

Post by dandymcgee »

Have you considered packaging Chrome as a prerequisite with your game's installer? Everyone should be running Chrome all the time anyway. ;)
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Very weird google chrome issue with game.

Post by bbguimaraes »

Sorry to revive a semi-dying thread, but I just found this. Basically it says some applications on windows (like google chrome) lower the (global) timer interrupt interval when they are running, which may cause the behavior you're seeing.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Very weird google chrome issue with game.

Post by dandymcgee »

bbguimaraes wrote:Sorry to revive a semi-dying thread, but I just found this. Basically it says some applications on windows (like google chrome) lower the (global) timer interrupt interval when they are running, which may cause the behavior you're seeing.
Wow, nice research.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Very weird google chrome issue with game.

Post by Falco Girgis »

Interesting as shit. Sounds like a driver issue with SFML. For framerate limiting, they should be ensuring the global timer interrupt interval is frequent enough to achieve the desired framerate.
Post Reply