FicEngine: Asset Management

flowchartDevelopment on the FicEngine is going very smoothly, and quicker than I expected. I’m having a blast at the moment playing around with shaders and assorted 3D objects, but that will be the subject of a later post. This post is unfortunately about more boring foundation-type shit!

The reason I’m able to so easily play with shaders and various art assets is the Asset Management system in FicEngine. A vast improvement over what I used in my previous games, my new Asset Management system is completely data-driven, easily extendable, easy to use from the application standpoint, and is still damn fast. These features allow me to add all kinds of new content to my games effortlessly.

The first goal I wanted to accomplish is to data-drive all my assets. This has always been a sore spot in my previous games, where I had managers to handle textures and sounds, but the assets themselves were hard-coded into the game. Adding new textures and sounds was always a pain in the ass, and adding new TYPES of assets was downright scary. Now, assets are defined using XML, so assets can be added without needing a recompile. Excellent.

This also accomplished a second goal, which was making my asset system much more extendable. Defining asset lists with XML makes adding more textures and sounds very easy, but what about adding new TYPES of assets? That’s where the concept of the Catalog comes in. The Catalog is a special kind of data structure that holds assets, and allows me to look them up by name. The Catalog contains a special function that loads all assets defined in my XML from file- but the best part is, it doesn’t need to know what type of file it is! The asset class itself handles that on its own in functions that the Catalog requires (basically, given a filename, load yourself and let the catalog know if you were successful. If so, the catalog adds the asset.) It’s a very elegant system- instead of copying lookup functions and such for every manager for every type of asset, I just keep catalogs for textures, sounds, music… and since then I’ve been able to easily add asset types for shaders, OBJ models, MD2 models, Animated Sprites, Gun/Bullet definitions (for ARSENAL) and User Interface definitions (for FUI2). All of this can be changed without requiring a recompile.

The catalogs also make writing applications very easy. Gone are the days where I have to go back to my list of textures to look up what index I need. I just refer to it by name, and I can do this with any type of asset. And before you snotty programmers out there start screaming “OH EM GEE STRING LOOKUP SLOW UR AN IDIOT” I’ll have you know that the slow lookup is done once at the launch of the program to get the exact index of the asset, which can then be used for a much faster lookup. BLAM.

So there you have it. It’s not the most exciting thing I could be talking about right now, but I’m proud of how it works and how much it simplifies life for me, allowing me to spend more time creatively expressing myself with my games.

Saturday, September 29th, 2007 FicEngine

1 Comment to FicEngine: Asset Management

  1. [...] my sound manager a few new tricks that I know I’ll want, for instance, using my Catalogs (see Asset Management to easily reference sounds in code, and adding panning based on the position of a sound source on [...]

  2. JustinFic.com - Justin Ficarrotta » Blog Archive » FicEngine: Sound on October 11th, 2007

Leave a comment