Systematic Gaming

September 11, 2008

Load Times: Compression

Filed under: game programming, memory management — Tags: , — systematicgaming @ 11:49 am

We’ve gone over what happens when we read files, and came up with some ways to reduce stalls between our game and the OS and hardware. We designed a file manager that allows us to read files asynchronously and remove all the wait time. What next?

Well the simplest way to reduce load times is to load less data. If we simply compress our data we’ll reduce load times a lot. General compression algorithms can often get a 50% or more reduction in file size, which translates directly into reduced load time.

(more…)

Advertisements

August 26, 2008

Memory Management: Summary

Filed under: game programming, memory management — Tags: , — systematicgaming @ 2:59 am

This series hasn’t been much more than a quick over of the memory management issues facing console game development. Hopefully it’s been informative, but keep in mind it’s only an introduction and was fairly light on many of the nitty-gritty implementations details.

To wrap up this series here’s a few quick topics that deserve mentioning, as well as some links to some suggested reading.

(more…)

August 25, 2008

Memory Management: Budgets, Tracking and Profiling

Filed under: game programming, memory management — Tags: , — systematicgaming @ 2:16 am

The last few entries in this series mostly focused on memory allocation. However allocation is only one part of memory management. To create a complete memory management system we need to do a lot more than allocate and free blocks of memory. We need to look at memory as a system wide resource. This involves

  • budgeting memory for the various game sub-systems
  • tracking memory use, to ensure budgets are honoured and memory doesn’t leak
  • profiling memory use to look for worst case spots in or program and trend memory usage over time

We’ll look into how we can enhance the allocation interface we’ve designed to help accomplish these goals. As well, we’ll see how these features aid us in managing memory system-wide.

(more…)

August 19, 2008

Memory Management: Design

Filed under: game programming, memory management — Tags: , , — systematicgaming @ 12:29 pm

We’ve reviewed the different types of memory in part one and looked at issues specific to consoles in part two. Now we’re ready to start designing our own memory manager. Lets review our requirements:

  • Our memory manager must be fast and efficient. We don’t want to waste CPU cycles or extra bytes of RAM managing memory.
  • We need to allow memory to be allocated with arbitrary alignment.
  • We need to support managing multiple physical memory heaps as well as the ability to support both internal and external heap managers.

These are the main requirements we have above and beyond the basic functionality of allocating and releasing memory.

(more…)

August 15, 2008

Memory Management: Consoles

Filed under: game programming, memory management — Tags: , , — systematicgaming @ 9:23 am

In part one we described the main types of memory. This time we’ll take a look at the memory management issues specific to consoles, or issues that are at least more prevalent in console game programming. The key differences between your regular PC and consoles are:

  • No virtual memory, which means once you’re out of memory, you’re out of memory. No swap file is going to save you on a console. Also, this makes memory fragmentation a serious concern.
  • Multiple physical memory types. On the PC you have RAM and video RAM, but you have a video driver that manages it for you, not so on consoles.
  • Memory alignment is also a problem on consoles. The x86 CPU is very forgiving. However console CPUs are generally stricter. Alignment is also very important for performance.

Now let’s take a look at these issues and others in more detail.

(more…)

August 7, 2008

Memory Management: Overview of Memory

Filed under: game programming, memory management — Tags: , , — systematicgaming @ 2:19 pm

Before we can really delve into the design of a memory management system we need to have a solid understanding of memory. In this post we’ll go over different types of memory and look at how they are used in your average program. We’ll also take a look at the main issues faced with each memory type, such as lifetime, scope and problems such as fragmentation.

Disclaimer: You’ll see some code samples in the following article, they’re in pseudo-C, not compilable or even compliant. They’re included for illustration and discussion purposes.

(more…)

August 5, 2008

Memory Management: Introduction

Filed under: game programming, memory management — Tags: , , — systematicgaming @ 2:16 pm

Memory management is a large part of systems programming for games. Especially on consoles where memory is a limited resource.

The main problem with memory is that there’s never enough. Modern consoles (like the Xbox 360 and PS3) have about 512MB of memory. This might seem like a lot compared to the 32MB of the PS2, but really isn’t that great compared to a PC, or the requirements of modern games. Additionally, consoles don’t generally support virtual memory, a feature of PCs which let the operating system use the hard disk as additional RAM when needed. The end result is that console games have many extra constraints and must take over the burden of managing their own memory more closely than normal PC applications.

Over the next few posts we will examine the basic memory management issues faced with console programming. In the process we will examine the goals and design of a modern game memory management system. The focus will be on how we manage memory within the complexities of a modern game development environment and how to make the best use of the limited resources of consoles.

Part One: Overview of Memory – A look at different memory types and how they are handled by compilers and applications.

Part Two: Consoles – What’s so special about consoles? We’ll look at special considerations needed for console games.

Part Three: Design – We’ll create a high level design of a memory allocation system.

Part Four: Budgets, Tracking and Profiling – So we can allocate memory, what else do we need?

Part Five: Summary – Wrapping up the series, we’ll also go over some more advanced topics for future consideration.

Create a free website or blog at WordPress.com.