• 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
Lunatix

Rendering solution for saving and increasing performance

10 posts in this topic

Hey there !

I am working on an indie game in time, currently on editors and the engine. [url="http://h3.abload.de/img/screenshot-em4448pdrr.png"]Screenshot?[/url]
Well, the engine runs very good, (don't worry about the FPS, screenshot is a bit outdated, i increased the performance in the last week).

So, i like to implement a rendering process function, that increases performance by rendering only something like "35 FPS"

Currently, the functions looks like:
[code]// main loop
while(!bQuit){

UpdateMessages(); //What messages from windows?
UpdateRenderingObjects(); //Calculations, like "was object x moved? if true, recalculate its model matrix

RenderWorld(); //Renders everything
FlushStates(); //Reset keystates and... other stuff
}[/code]

So, i like to implement a resource saving process, but i had have no idea, so i ask you for your solution, how do you implement something like this?
0

Share this post


Link to post
Share on other sites
So what rendering method are you using now? What GL functionality are you using?
0

Share this post


Link to post
Share on other sites
[quote]What GL functionality are you using?[/quote]

I'm using VertexBufferObjects for the geometry data and a few "deprecated" calls for displaying the colors in the sidebar. (See the screenshot in my first post).
The geometry is shaded, colored and lighted via Deferred rendering and Screenspace Ambient Occlusion.

I don't use glut or something else, i have my own engine with C++ and glew.

[quote]So what rendering method are you using now?[/quote]


Currently i have a loop like this, but it doesn't work realy good. It is an very old code fragment from one of my "BlitzBasic3D" codes, maybe 5 years old.
But in Blitz3D, there was a function "RenderWorld( float FrameTween = ?)" placed inside the updating loop too:

My focus was mostly the engine, the shaders, the rendering scripts, and and and... and now i thought about a newer and better rendering loop ;)

[code]int main(int argc, char* argv[]){

if (!cAppMain::Initialize(argc,argv)){
cCoreConsole::cout<<"Unable to initialize client\r\n";
cCoreConsole::Flush();
return 0;
}

bool bQuit = 0;
float FrameEllapsed = 0.0f;
float MaxFrames = 35.0f;
unsigned int FramePeriod = 1000.0f / MaxFrames;
unsigned int FrameTime = GetTickCount() - FramePeriod;

while(!bQuit){

unsigned long iCalcStart = GetTickCount();
unsigned long AcTime = GetTickCount();

do{
AcTime = GetTickCount();
FrameEllapsed = AcTime - FrameTime;
}while(!FrameEllapsed);

int FrameTicks = FrameEllapsed / FramePeriod;

for (int ticks=0;ticks<FrameTicks;ticks++){
FrameTime = FrameTime + FramePeriod;

if (cAppMain::onEvent()){ //Returns true, if the user hit the [x]button
bQuit = true;
break;
}
cAppMain::onUpdate(); //Updates messages/events

if (!cAppMain::bInActive){
cGLDriver::UpdateWorld(); //Matrix calculation of each registered object (If changes where made)
cVgVoxelFactory::onUpdate(); //Updates the voxelfactory, recalculates voxels (If changes where made)

cAppMain::lpMainViewport->UpdatePickings(); //Updates the pickings - editor only
cVmSidebar::UpdateSidebar(); //Updates the sidebar - editor only

cAppMain::lpMainViewport->UpdateViewport(); //Updates the movements in editor

cUIManager::ClearKeyStates(); //Clears the keystates, to avoid double clicking
}

cCoreConsole::Flush();
cGLDriver::Flush();
}

if (!cAppMain::bInActive){

cAppMain::lpMainViewport->RenderScreen(); //Renders all things to screen
cVmSidebar::RedrawSidebar(); //Renders the sidebars color changer
}

cLuaObjectBuffer::FlushTimer();
}

cAppMain::onShutdown();

}
[/code]
0

Share this post


Link to post
Share on other sites
Using VBO is good. Some info about them here. http://www.opengl.org/wiki/Vertex_Buffer_Object
http://www.opengl.org/wiki/VBO_-_more
http://www.opengl.org/wiki/VBO_-_just_examples

other than that, you need to determine your bottleneck. Perhaps gDebugger can help
http://www.opengl.org/wiki/Debugging_Tools
0

Share this post


Link to post
Share on other sites
Sorry, i think you misunderstood my problem ;)

My problem aren't the/any bottlenecks (there are bottlenecks, i have located several of them and fixed them, increased the speed from 50ms/frame to 24 ms per frame since yesterday)
My problem is the rendering method itself.

The Player "sees" only 24FPS with his eye, so i think rendering 35 FPS per secound is enough, the rest of the time should be spend on calculations. So i don't search for bottleneck optimizations, i search for a good rendering loop, saving time for calculations.

I don't know, what to search for in google, "rendering loop" or something else doesn't realy gives good results ...
0

Share this post


Link to post
Share on other sites
[quote name='Lunatix' timestamp='1308916991' post='4827223']
The Player "sees" only 24FPS with his eye, so i think rendering 35 FPS per secound is enough...[/quote]ugh... The player can "see" over 200FPS (if they had a 200HZ monitor instead of a 60HZ one).
Films only look good at 24fps [i]because they have motion blur[/i]. Without motion blur, animation at 24fps looks absolutely horrible.
[quote]So i don't search for bottleneck optimizations, i search for a good rendering loop, saving time for calculations.
I don't know, what to search for in google, "rendering loop" or something else doesn't realy gives good results ...[/quote]I'm not quite sure what you're looking for either -- perhaps you want to run your update and rending code each at a different FPS? If so, check out the [url="http://gafferongames.com/game-physics/fix-your-timestep/"]standard link[/url].
0

Share this post


Link to post
Share on other sites
Yes, this was exactly what i searched for! Thank you very much =)

[quote]ugh... The player can "see" over 200FPS (if they had a 200HZ monitor instead of a 60HZ one).
Films only look good at 24fps [i]because they have motion blur[/i]. Without motion blur, animation at 24fps looks absolutely horrible.[/quote]

I believe you, but the eye can only see 24 fps. So, if i choose to display 40 - 60 fps, it looks good to player... or am i wrong ? I will not "cap" it at 35 - but i want to implement a function that says: "35 fps - all other resources to the computing behind the scenes. if the computing behind the scenes don't need all of this resources -> display more fps"
0

Share this post


Link to post
Share on other sites
[quote name='Lunatix' timestamp='1308942732' post='4827324']

I believe you, but the eye can only see 24 fps.
[/quote]

http://www.100fps.com/how_many_frames_can_humans_see.htm
1

Share this post


Link to post
Share on other sites
[quote name='JackTheRapper' timestamp='1308944502' post='4827335']
[quote name='Lunatix' timestamp='1308942732' post='4827324']
I believe you, but the eye can only see 24 fps.
[/quote]

[url="http://www.100fps.com/how_many_frames_can_humans_see.htm"]http://www.100fps.co..._humans_see.htm[/url]
[/quote]

That's a pretty good link. Thanks.
Also, even for movies, 24 FPS looks crappy even if they use motion blur. That's why I hate going to the movies.
0

Share this post


Link to post
Share on other sites
[quote name='V-man' timestamp='1309002834' post='4827538']
That's a pretty good link. Thanks.
Also, even for movies, 24 FPS looks crappy even if they use motion blur. That's why I hate going to the movies.
[/quote]


IIRC:

I worked as an optician for quite a while, and when I received my training there was a similar question. Turns out that the brain can distinguish visual changes up to about 60 Hz, that's why when you see a car wheel rotate (or a helicopter's rotors), at a certain point, the wheel seems to rotate backwards or stand still since your brain has to interpolate between images that have almost no visual changes.

Also, when you shake your hand really fast in front of your face, it seems blurred, which is also your brain "filling in the blanks" with blur past 60 Hz. One last example, which is fun: take a pencil, one that hasn't been used much yet so it's plenty long. hold lightly at one end, and shake it so that the other end moves smoothly up and down (along the Y-axis so to speak). Whilst in motion, the pencil will seem like it's bending due to the brain interpolating.
1

Share this post


Link to post
Share on other sites
In addition to what the others have said, rendering with a high frame rate also helps a lot with input latency.
Good article on the subject: [url="http://www.gamasutra.com/view/feature/1942/programming_responsiveness.php"]http://www.gamasutra.com/view/feature/1942/programming_responsiveness.php[/url]
1

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