Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Lucky 10,000th viewer!

Sign in to follow this  
Trapper Zoid


You might be the lucky 10,000th viewer of this journal! If so, I have a spare picture of an Xbox 360 from my last competition you may collect!

One thing with my architecture design I'm still having trouble conceptualising is the resource manager. My usual breakdown for game engine design is to lump all the related material together into their own modules: a video manager for the graphics, audio manager for the sound, input manager for the control etc. This helps keep all the hardware related stuff buried behind an interface layer so I don't have to worry about it that much when actually making the game.

However I'm not sure what to do with all the resources a game needs: textures, sounds, music, data files, etc. Do I let all the relevant modules handle their own resources, or do I create a resource manager for handling everything? Given I haven't done that much in memory management programming myself, and there's also aspects like the video card memory to deal with, it's all rather confusing for me. I'd like to have a system where I could just specify how much memory I'd like to use for each resource, and then precache textures and sounds to minimise loading times for computers with more memory, but this requires a way of keeping track of all resources as well as the amount of memory left in the system.

Since I'm unsure about this, I'd like to ask you what your solution was to general resource management. Any suggestions as to how you structured the architecture, or pointers to good articles out there that could explain a good solution to me?
Sign in to follow this  


Recommended Comments

Holy carp! I am the 10 000th viewer (and the 10 001th viewer). [grin]

Share this comment

Link to comment
We have a winner! [grin]

I bet at least 2,000 of these views are from myself, checking for comments or from minor corrections to my journal entries.

Share this comment

Link to comment
I'm not sure if the resource management I do is particularly good, but it's the best I've made.

A resource manager is nothing more than a [pluggable] factory. I use a common ResourceDefinition class [which in the end is just a string/string pair] which acts as loading instructions for a particular resource. A common templated [C# generic] resource manager handles common code, a common interface, and specifies the factory type via the main virtual function T Load(ResourceDefinition);. Particular managers [for sound objects, images, etc.] then inherit from the resource manager base, and specify handlers to the pluggable factory to interpret the ResourceDefinition commands.

This allows for code re-use as needed for the common parts, but leaving much flexibility in the specific requirements for different resources, and even addition of various loading procedures for resources stored differently.

In the end, this is how it ends up used:

font_manager.Add(new resource_definition("Arial12", "simpletext arial 12"));
font_manager.Alias("ConsoleFont", "Arial12");
ConsoleDisplay = new renderable.ChatBox("ConsoleFont");

Share this comment

Link to comment
Ah, that's a really interesting approach. I hadn't heard of the pluggable factory pattern before. I guess I also hadn't considered using the more advanced features of C++ to shape my architecture design (I really just treat it like C with classes [smile]).

Share this comment

Link to comment

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

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!