Issues with your account? Bug us in the Discord!

C++: Game Engines, World Organisation, and the Infinite Memory Quest

BigglesBiggles <font color=#AAFFAA>The Man Without a Face</font>
[b]The Quest[/b]

Here's something for us to discuss (those of us who are interested):
"Object Caches"/"Object Managers". How should they work? What should they manage? And when should they load?

[b]Background[/b]

The basic idea of an object manager is this: You have a class which is capable of loading a certain type of object from disc (eg texture or mesh or sound byte). When the game (or miscallenous multimedia app) wants something, it calls the manager for that object type saying, "Give me this," and giving it some kind of id (eg the path name, a hashed reference, etc). The object manager checks if that object has already been loaded, and if it has returns a reference to it (or a copy of it if the object is going to be modified). If the object hasn't been loaded than the manager loads it, then returns a reference (or copy, as earlier). This prevents duplication of resources and also makes it far easier to keep track of allocated memory. The manager is responsible for creation and deletion of objects of the type it manages.

[b]The Questions[/b]

The biggest one I'm interested in at the moment is load on demand or precache everything? Grant has already made some good points for load on demand, maybe he can repeat them here. Precaching also has its advantages.
Also of importance is the basic design of the manager.

[b]The Lingo[/b]

To make sure we don't get confused, some definitions:

[i]Entity[/i] - Something in the gameworld (eg a person, a tree, a rocket).
[i]Mesh[/i] - The data used to show an entity on screen.
[i]Texture[/i] - Pretty pictures.
[i]Object[/i] - Some resource that gets loaded and used and must be managed.

So... present ideas and work on mine. Maybe you'll get in the credits for my game. [img]http://216.15.145.59/mainforums/smile.gif[/img]

------------------
[b][url="http://www.minbari.co.uk/log12.2263/"]Required reading[/url][/b]
Never eat anything bigger than your own head.
The Balance provides. The Balance protects.

"Nonono...Is not [i]Great[/i] Machine. Is...[i]Not[/i]-so-Great Machine. It make good snow cone though." - Zathras

[This message has been edited by Biggles (edited 01-25-2002).]

Comments

  • bobobobo (A monkey)
    Are you talking about a factory pattern?

    ------------------
    bobo
    <*>
    B5:ITF
  • BigglesBiggles <font color=#AAFFAA>The Man Without a Face</font>
    I don't know anything about design patterns.

    ------------------
    [b][url="http://www.minbari.co.uk/log12.2263/"]Required reading[/url][/b]
    Never eat anything bigger than your own head.
    The Balance provides. The Balance protects.

    "Nonono...Is not [i]Great[/i] Machine. Is...[i]Not[/i]-so-Great Machine. It make good snow cone though." - Zathras
  • BigB: You should consider reading [i]Design Patterns[/i]. A darn good read.
  • BigglesBiggles <font color=#AAFFAA>The Man Without a Face</font>
    What are they? And don't say "A book."

    ------------------
    [b][url="http://www.minbari.co.uk/log12.2263/"]Required reading[/url][/b]
    Never eat anything bigger than your own head.
    The Balance provides. The Balance protects.

    "Nonono...Is not [i]Great[/i] Machine. Is...[i]Not[/i]-so-Great Machine. It make good snow cone though." - Zathras
  • bobobobo (A monkey)
    Have you ever noticed while you were coding an algorithm that it looked familiar? Or realized that this particular design or process, with a little abstraction, could be used in other applications, completely unrelated to the current one?

    Several people have noticed just this, and a discipline has been created to document these types of patters ("design patterns"), stating what they are, how they can be used, when they shouldn't be used, etc.

    I'm in the middle of chapter 2 of "Design Patterns", hitting the descriptions of the patterns as they're raised. I highly recommend it, though its not a quick read, and I know I will need to re-read it several times.

    I'm thinking that I've seen a "Resource Manager" pattern mentioned before. Has anyone else seen documented, and if so, where?

    ------------------
    bobo
    <*>
    B5:ITF

    [This message has been edited by bobo (edited 02-14-2002).]
  • BigglesBiggles <font color=#AAFFAA>The Man Without a Face</font>
    They almost certainly have been mentioned elsewhere before.

    ------------------
    [b][url="http://www.minbari.co.uk/log12.2263/"]Required reading[/url][/b]
    Never eat anything bigger than your own head.
    The Balance provides. The Balance protects.

    "Nonono...Is not [i]Great[/i] Machine. Is...[i]Not[/i]-so-Great Machine. It make good snow cone though." - Zathras
Sign In or Register to comment.