Home > Electronic Games, Projects > Resource Manager in Python & Pygame with Caching and Mapping.

Resource Manager in Python & Pygame with Caching and Mapping.

The project ‘tct‘ (The Crime Tracer) fanned my wish to create a resource manager for the needs of the game. Generally, a resource manager increases efficiency in most cases because it uses internal caching and mapping. The resource manager of the project ‘tct‘ is written in Python and manages graphics, sounds and Pygame fonts.

We can use the resource manager in any case. Most importantly, when we want to increase performance, then we support caching for a resource. Caching is implemented with a buffer, a data structure specific key – value for the direct access [time complexity 0(1)] of the loaded resource. Specifically, we implement the mapper with the dictionary data structure where the keys are the file paths to the resources and values the resources themselves ready for access. Currently, the resource manager is only used for graphics, but could very well be easily extended to support new resources.

An interface could be created in Python for the resource manager and an implementation of it solely for the objects of Pygame so that it can be easily adapted to other frameworks. Those who already work with Python and Pygame can start using it.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: