FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: New Resource and Memory management  (Read 1880 times)

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
New Resource and Memory management
« on: December 14, 2010, 10:31:12 pm »

As you all know I've been talking about a complete re-design of the resource and memory management within FIFE.  After looking a great deal at FIFE itself and some consultation with vtchill we have decided to do a complete redesign of the resource handling portion of FIFE (or at least have a really good look at doing so).  This doesn't mean that we cannot reuse some code, it just means that to make the process easier we will be stripping out what is there and replacing it with a re-written version.  The interfaces in question are the pools, IResrouce, and the resource loaders.  I haven't gone into great detail on how this all should be redesigned but I'll go over some of the things we have been talking about in IRC.

First we would like to get rid of the "Pool" idea in favor of a master resource manager.  The manager will act as a factory class and manage all resources internally.  The interface will create and load the resource when the client requests it.  The resulting resource will be return to the client using the boost::shared_ptr template class.  There is a swig wrapper for boost::shared_ptr (new to swig 2.0 :D) so we hope to make use of that as well.  The types of resources the manager will take care of specifically will be images (or textures), fonts??, audio files and movies (if we ever get movie support).  Basically anything that should be globally accessed and is not a game/engine related structure.  Everything else will be managed by their container classes..  e.g. Layers will be managed by the Map.  Instances will be managed by the Layers... etc etc.  (I'm still a bit foggy on this idea).  Objects and Animations are global objects as well so they will be handled by a global container of some sort (again, still working this all out).  I realize that this could potentially create a lot of API changes but once the re-design is complete and implemented it will be a definite improvement to FIFE.

There is also the resource loaders that need to be looked at.  Keep in mind that in this case we are talking about the game/engine related data (i.e. maps, objects, layers, animations.. not images or sounds).  We are still working out the details about how exactly we want it to look.   We have a couple ideas we are exploring.  One method would be to provide a "plugable" interface much like there is now where you create your own loaders and savers and add them to the engine.  The engine would then select which loader to use when loading a resource based on filename or some other means.  The other method would be to remove the idea completely and leave it all up to the client.  We would provide a default set of loaders in the engine itself and the client could choose to extent it or write their own.  Any thoughts on this?  I would prefer a simple interface myself as the loaders and savers would almost always be provided by the client anyway.

Thats enough for now (I could probably go on for a lot longer)...  if you have ANY thoughts on the subject please post it here.  I"d like to hear what everyone else has to say.  Oh and if any of this doesnt actually make sense please ask about it and I will try and clarify it.

Peace,

prock
Logged

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
Re: New Resource and Memory management
« Reply #1 on: December 15, 2010, 12:07:08 pm »

Quick update... I have created a wiki page dedicated to this subject here: http://wiki.fifengine.net/Proposal:Resource_Memory_Management
Logged