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

Relation between memory used and frames per second

14 posts in this topic

Hi, I have a doubt about optimization. 
Until now I dont care about load more than one time a image. So, for example, if I had two classes that need the same image I load two times instead of load one and share two pointers to the image. 
But now I need to increase the speed of my games, so I have a cuestion: What is the relation between memory and fps? I can get more Fps wasting less memory, or it is only usefull when I have a limited memory space like in a mobile phone?

 

Thanks in advance for the help! 

 

0

Share this post


Link to post
Share on other sites

To what rip-off said, it also depends on whether you allocate & deallocate memory too often per frame (even regardless of the amount) or allocate once and then reuse & share.

And if you're working with managed code that has garbage collection, that's a whole different world on how memory usage patterns may impact framerate.

1

Share this post


Link to post
Share on other sites

So, the best can I do is to identify where im lossing speed and try to optimize this parts of code?

Im reading about profilers right now, but it seems to be more complex than I expected.

Do you know any good and simple profiler for start to learn about this?

 

Also Im using SDL, maybe is the moment for start with OpenGL?

 

Thanks you!

0

Share this post


Link to post
Share on other sites

One thing to keep at the top of your head is that bad cache behavior in your program can result in an orders of magnitutde slowdown compared to the same bad cache behavior from ten years ago!

 

This is because the disparity between processor speed and memory speed has increased exponentially since then. So today more than ever it is important to access memory in cache friendly ways.

 

Of course, you should use a profiler to help you identify these spots. But sometimes you can imagine them, for instance if you access data in a "striped" fashion instead of a "linear" fashion, you will likely result in cache misses.

1

Share this post


Link to post
Share on other sites
The purpose of my post was to demonstrate how one optimises like an engineer, rather than a hacker. Yes, it is complex.
 
However, for this case the advantages are obvious. It is wasteful to load the files multiple times, and it is wasteful to have multiple copies of the same image in memory. You should fix this anyway.
1

Share this post


Link to post
Share on other sites
One thing to keep at the top of your head is that bad cache behavior in your program can result in an orders of magnitutde slowdown compared to the same bad cache behavior from ten years ago!

 

This is because the disparity between processor speed and memory speed has increased exponentially since then. So today more than ever it is important to access memory in cache friendly ways.

 

Of course, you should use a profiler to help you identify these spots. But sometimes you can imagine them, for instance if you access data in a "striped" fashion instead of a "linear" fashion, you will likely result in cache misses.

 

In my case I think the problem with the speed is that, a bad memory access, because the problem is very random. Often the game run perfect and suddenly it become very sloooow. 

I have many cuestions about this:

What do you mean with: "access memory in cache friendly way"? Can you explain with a simple example?

 

About the profilers, if I write my own little proffiler like a class that mesure the time and the number of calls in each frame will be enougth for simple optimizations like this?

0

Share this post


Link to post
Share on other sites
Thanks you! With this information I can start researching about memory optimization.

Edit: Just the last cuestion,
how can memory leaks affect the preformace of the aplication? Edited by buumchakalaka
0

Share this post


Link to post
Share on other sites

It depends on the platform.  On console platforms, it's bad.  You almost cannot leak any memory at all, because consoles don't have a sophisticated virtual memory system that modern desktop PCs do.  When you run out of memory on a console, you just crash and burn.  But it's unlikely you're working on a console.

 

Desktop PCs, because of their fancy virtual memory systems, memory leaks are still bad but they're not nearly as catastrophic as on consoles.  The amount of "fast" working memory for the operating system to hand out to running processes will slowly decrease and it will start to page out processes onto the disk, which is extremely slow.  I like to think of memory use on desktop PC platforms as mostly about being what I like to call "A good software citizen".  Use your share of memory; don't be greedy and send back what you don't need.  If you do end up using too much, it's usually not the end of the world, but everyone is going to hate you, especially the user of the computer.

1

Share this post


Link to post
Share on other sites

You really should strive to have no memory leaks though.  Even though desktop platforms can be forgiving, it can be a huge nuisance to end users if you leak memory since it will cause the whole system to drag even though it's just your application that's leaking.  Mozilla has been fighting this exact fight for years now, and only recently have they made significant improvements to the way Firefox reclaims memory, specifically from addons, which are a prime source of memory leaks.

 

There are some good points made in this GDC 2008 presentation by Elan Ruskin about a bunch of things related to game development: http://www.valvesoftware.com/publications/2008/GDC2008_CrossPlatformDevelopment.pdf.  I would highly recommend taking a look at slide 25 and onwards for some treatment of memory in games.  A lot of those things are really only necessary for large studios or games that really push limits of systems, but there are a lot of useful tips in there, such as knowing where all the memory is going.

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