• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
wizardpc

Help, I've optimized too much!

15 posts in this topic

So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

0

Share this post


Link to post
Share on other sites

Probably just waiting on VSync would do it.

 

If you are using DirectX lookup the present parameters and something like D3DPRESENT_INTERVAL_ONE.

 

So if your monitors refresh rate is 60hz.  Then your FPS will be 60 at most.

 
That would be a pretty straight forward way to limit your FPS.
 
For lower values there is D3DPRESENT_INTERVAL_TWO and THREE i think.
 
For sleep times you could just track your frame and sleep until 1/60th of second as passed; That sounds kinda weird to me though.
 
 
 
 
 
Edited by HAM
2

Share this post


Link to post
Share on other sites

Well the concept is the same.  Just wait on vsync.  I'm sure there is a way to do it in openGL.

 

A quick google search shows wglSwapIntervalEXT as an extension.  Unsure if that is what you should use.  But I'm sure you can figure it out.

0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

Really? they didn't buzz before. I mean before rework... The CPU usage would be the same with or without optimization with your description so strange...

0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

Really? they didn't buzz before. I mean before rework... The CPU usage would be the same with or without optimization with your description so strange...

I'm not sure why you would assume his CPU load would be the same when he runs at 50 FPS vs 170 FPS, but it is not relevant.  He asked how to limit his FPS.  

0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

Really? they didn't buzz before. I mean before rework... The CPU usage would be the same with or without optimization with your description so strange...

I'm not sure why you would assume his CPU load would be the same when he runs at 50 FPS vs 170 FPS, but it is not relevant.  He asked how to limit his FPS.  

 

Thanks HAM, i'll take a look at what you said earlier.  Yea, I'm not multithreaded, so my update and render functions are right after eachother.  Now that I'm pushing 200 FPS, the fan gets really really loud, so I just read up on it, and basically you gave me some good keywords to google search.  I'm wasting cycles drawing the scene that aren't going to matter anways since I'm limited by the refresh rate. 

 

So If I limit my frames to 60 per second, should I only be limiting my Render function (that renders the scene) or both update and render functions.  Update functions handles all game updates, moving objects, AI, etc......  I'm also single threaded.  This is a small game really.  I'm just kinda asking what the best advice is when limiting FPS.

0

Share this post


Link to post
Share on other sites
So If I limit my frames to 60 per second, should I only be limiting my Render function (that renders the scene) or both update and render functions.  Update functions handles all game updates, moving objects, AI, etc......  I'm also single threaded.  This is a small game really.  I'm just kinda asking what the best advice is when limiting FPS.

 

Well since you can run at 200 FPS that means you are not CPU bound.  And for simplicity sake why not just keep it like you have it.  

 

Lock to vsync.   This will lock you state updates, input, and rendering.  If you start wanting to run at lower than 60 that is when it might become a concern for your input timings.    But you'll create more input woes if you want to start threading anyway, so why not keep it as simple as possible until you need something more.

1

Share this post


Link to post
Share on other sites
So If I limit my frames to 60 per second, should I only be limiting my Render function (that renders the scene) or both update and render functions.  Update functions handles all game updates, moving objects, AI, etc......  I'm also single threaded.  This is a small game really.  I'm just kinda asking what the best advice is when limiting FPS.

 

Well since you can run at 200 FPS that means you are not CPU bound.  And for simplicity sake why not just keep it like you have it.  

 

Lock to vsync.   This will lock you state updates, input, and rendering.  If you start wanting to run at lower than 60 that is when it might become a concern for your input timings.    But you'll create more input woes if you want to start threading anyway, so why not keep it as simple as possible until you need something more.

Yes thanks, I've learned a bit with this thread.  I'll keep things the way it is, and try to reduce the fps to 60.  I'm at work at the moment, so I'll have to give it a go tonight.

0

Share this post


Link to post
Share on other sites
http://blogs.msdn.com/b/oldnewthing/archive/2010/12/03/10097861.aspx

 

I was asking about the Loud fan on my laptop.  i'm guessing it's more GPU related then CPU.  The thing spins up and gets REALLY REALLY loud.  Only when I've got lots of visual apps going on at the same time.

 

Youtube, face time, and maybe a game.  But no where as loud as when my game launches.  I'm sure it has has to do with me trying to flip the backbuffer as many times as I can with each cycle.

0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

Really? they didn't buzz before. I mean before rework... The CPU usage would be the same with or without optimization with your description so strange...

I'm not sure why you would assume his CPU load would be the same when he runs at 50 FPS vs 170 FPS, but it is not relevant.  He asked how to limit his FPS.  

I assumed his program without leash (no VSync, sleep etc...) had 50FPS before optimization and 170 after optimization.

The CPU usage is same in this case, therefore his fan screaming is result of something other.

i merely misunderstood.

 

Regarding topic:

I have no experience in OpenGL delay mechanism, there fore i am unable to help.

 

Going down to 60 fps:

[quote]

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

[/quote]

1000 / 60 = 1.66... per loop

second / FPS = amount time for one loop

[code]This_Loop_Time = (how much time did program take to execute this loop); Max_Loop_Time = 1000/60;// (second / FPS) if(This_Loop_Time < Max_Loop_Time)     Delay(Max_Loop_Time - This_Loop_Time)[/code]

For sleep, i suggest Google for "c++ Sleep" and find what suits your needs

0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

 

I think I need to put something to rest right now that no one else has mentioned. You will NOT cook your GPU because the fan goes up! You would only cook the GPU if the fan dies. Modern GPUs (and CPUs for that matter) have built in heat profiles that adjust fan speed based on core temperature. There is a cut off point that varies by manufacturer and once the temperature passes this point, the hardware will shut down to prevent damage.

Your hardware is doing what it is supposed to and there is nothing wrong. You are wanting to limit performance based on lack of knowledge. Focus your energy on other tasks and be grateful that you can push 170 FPS on a laptop.

Edited by MarkS
0

Share this post


Link to post
Share on other sites
So my game was running around 50 FPS, but then I reworked my terrain by implimenting GeoMipMapping, and sending my entity draw calls to a frustrum check instead of just rendering all entities.

 

I'm now pushing 170 fps, and my laptops fan ramps up and gets loud.  I'm assuming this will cook the GPU after a while.

 

Is there a way to figure out how much to sleep given the FPS? I want to get it back down to 60ish fps (or some lower value).

 

So you were running at 50fps, then implemented rendering-related optimizations, and now run much faster.  So, it sounds like you were (or still are) GPU-bound, which means that previously your CPU was sitting around waiting for the GPU to finish.  Now that the GPU does less work, the CPU waits less, and so it does more work.  More work means it gets hotter, so the fan ramps up.

 

Options:

1. wait for vsync, which should automatically limit it to 60fps

2. put in code at the beginning of each frame to determine the frametime, and sleep until it reaches your target max framerate.

3. dont do anything and let it run as fast as it can.

 

Running the CPU as fast as possible should not be an issue.  If it is then you need to look at options like underclocking, or maybe open it up and make sure the heatsync isnt clogged with dust, or stuff like that.

 

BTW for mobile games, limiting the framerate of your game might be a good idea in order to save battery life.  You could even make it an option that the user can select.  Just something to think about.

0

Share this post


Link to post
Share on other sites

Set vsync for opengl windows

[code]void System_Set_VSync(bool sync){

typedef bool (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
 
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");
 
if (wglSwapIntervalEXT)
wglSwapIntervalEXT(sync);
}[/code]
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0