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

[c++] trying to squeeze performance

4 posts in this topic

1. Terrain. Right now I'm using multiple quad primitives connected to each other. This way I can divide terrain into blocks and each block can have additional texture specific for that block. But I see in some tutorial that they use one indexed primitives to create terrain. How much performance boost should I expect if I choose to change from multiple quad primitives to single primitive?

2. .X model importer. I have the code from [url="http://www.toymaker.info/Games/html/load_x_hierarchy.html"]this example[/url] and modify a bit. It might not be the best, but it does the job. Recently I notice significant fps drop when many models is on the screen (I'm using View Frustum Cull) and I begin to think I need some change. Is there .X model importer I should use instead?

3. Updating the game state. If I choose to create a thread to specifically handle the "main loop update", will that increase some fps? Is there any problem I should expect?

4. Should I call sin/cos/tan/etc function once and store the result instead of calling those functions every time I need to use the result?
0

Share this post


Link to post
Share on other sites
These are all very case-specific questions, and these can all be answered by doing thorough profiling

First of all ask yourself this: "Do I have any performance issues with my current implementations?"
If the answer to that question is no you should just leave it be and move on to something else, unneeded or premature optimization is asking for major headaches later on

If the answer is yes however you should try out the different suggested implementations and thoroughly profile them against your current implementations in many different use cases. Based on the statistical data you get from that you can make your decisions as to which implementation works best for you.
0

Share this post


Link to post
Share on other sites
[quote name='Knight52' timestamp='1344857736' post='4969019']
1. Terrain. Right now I'm using multiple quad primitives connected to each other. This way I can divide terrain into blocks and each block can have additional texture specific for that block. But I see in some tutorial that they use one indexed primitives to create terrain. How much performance boost should I expect if I choose to change from multiple quad primitives to single primitive?
[/quote]

If you mean that you have one draw call for each quad, then you can expect a huge performance boost from switching to one or a few draw calls for the terrain. You can expect similar performance from rendering 1 or 1,000 triangles with a draw call - the draw call itself is the expensive part so you want to minimize them.

[quote name='Knight52' timestamp='1344857736' post='4969019']
4. Should I call sin/cos/tan/etc function once and store the result instead of calling those functions every time I need to use the result?
[/quote]

If you mean precalculating a table of sin/cos/tan values, that's generally unnecessary nowadays. If you mean you need the same result multiple times, then calculating the result once and saving it is generally considered good practise. There are rare times when one or the other would be much better, but in general it doesn't matter. If it is in a tight loop, definitely cache it. Edited by turch
1

Share this post


Link to post
Share on other sites
[quote name='turch' timestamp='1344865552' post='4969059']
If you mean that you have one draw call for each quad, then you can expect a huge performance boost from switching to one or a few draw calls for the terrain.
[/quote]
You mean DrawIndexedPrimitive() or DrawPrimitive(), right? Is there any way I can still draw additional texture specific to each quad? If the performance boost is that good, I'll consider removing that feature anyway.
[quote name='turch' timestamp='1344865552' post='4969059']
If it is in a tight loop, definitely cache it.
[/quote]
Can you describe what is caching you're talking about?
0

Share this post


Link to post
Share on other sites
[quote name='Knight52' timestamp='1344869735' post='4969088']
[quote name='turch' timestamp='1344865552' post='4969059']
If you mean that you have one draw call for each quad, then you can expect a huge performance boost from switching to one or a few draw calls for the terrain.
[/quote]
You mean DrawIndexedPrimitive() or DrawPrimitive(), right? Is there any way I can still draw additional texture specific to each quad? If the performance boost is that good, I'll consider removing that feature anyway.
[/quote]

Yes, the first thing you should generally do is try to reduce those calls - which is why instancing is nice: instead of drawing 100 orcs with 100 draw calls, you draw 100 orcs with one draw call and save a ton of time.

Why do you need textures specific to a quad? You can definitely use multiple textures, but the way you do it depends on what you are trying to achieve.

[quote name='Knight52' timestamp='1344869735' post='4969088']
[quote name='turch' timestamp='1344865552' post='4969059']
If it is in a tight loop, definitely cache it.
[/quote]
Can you describe what is caching you're talking about?
[/quote]

Caching is simply saving a value for later. So instead of writing

[code]
while(/*whatever*/)
{
total += sin(x);
}
[/code]

you would write

[code]
float sinOfX = sin(x);

while(/*whatever*/)
{
total += sinOfX;
}
[/code]

Assuming that x doesn't change during the loop.
2

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