Since Retro sounds, Event Manager and some running I've been focusing on a few things lately:

  • Game programming - implemented a Resource Manager using C++/TinyXml2
  • My Tuesday programming course on C in the City
  • Formulation of my frameworks on "Now" and "Zen"
  • Meeting protocol
  • DK Money book
  • University study (Continuing professional development)
  • Avengers: End Game

Let's start off from the top.

I implemented a resource manager for my prototype game which is responsible for cataloguing all the images and music files that my game uses.

Basically, to strategically load and unload game assets during the game, you need to know where they are, what they are and which level they belong to.

All this information is centralised into an XML file that holds this information:

<?xml version="1.0" encoding="utf-8"?>
<Assets>
  <Asset uid="1" level="1" name="MainTheme.wav" type="fx" filename="Assets/Music/MainTheme.wav"></Asset>
  <Asset uid="2" level="2" name="scratch.wav" type="fx" filename="Assets/scratch.wav"></Asset>
  <Asset uid="3" level="3" name="high.wav" type="fx" filename="Assets/high.wav"></Asset>
  <Asset uid="4" level="4" name="medium.wav" type="fx" filename="Assets/medium.wav"></Asset>
  <Asset uid="5" level="5" name="low.wav" type="fx" filename="Assets/low.wav"></Asset>
  <Asset uid="6" level="6" name="maze1r.png" type="graphic" filename="Assets/maze1r.png"></Asset>
</Assets>

And the manager basically loads it up and stores this metadata in memory in the form of a list of "Resources" which is what the resource manager does - it deserialises the XML into Resource objects and caches them:

#pragma once
#include <string>
#include <map>
#include "Resource.h"
#include "tinyxml2.h"
#include <memory>
#include "tinyxml2.h"
using namespace std;
using namespace tinyxml2;


class ResourceManager
{
    public:
        static ResourceManager& getInstance()
        {
            static ResourceManager instance;			
            return instance;
        }
		ResourceManager(ResourceManager const&)  = delete;
        void operator=(ResourceManager const&)  = delete;
		std::shared_ptr<Resource> GetResource(string name);
    private:
        ResourceManager() 
		{
			// Load the resources on creation of the Resource Manager
			LoadResources();
		}
		void LoadResources();
		
		// Record the asset in the catalog of assets
		void RecordAsset(tinyxml2::XMLElement * assetElement);
		
		// Make Asset from Asset XMLElement
		std::shared_ptr<Resource> GetAsset(XMLElement* element);

		// catalog of assets managed by this manager
		std::map<std::string, std::shared_ptr<Resource>> m_resources;        
};

So now, I can strategically remove things that are in memory that don't need to be - I'll know exactly what the resources are and thus I'll be able to unload them appropriately and load new resources using the path meta-data in the resource objects. 

I had to learn how to use TinyXML2 which is supposed to be super fast. it probably is but its a bit weird to use.

For example, you can't just iterate through all the "asset" elements, you need to find the first asset element, then iterate through the remaining 'siblings'. This is probably because the XML file's DOM is stored as a linked-list in memory I think. See TinyXML2

This is how I turn the XML previously shown into the list of Resource objects previously mentioned:

#include "ResourceManager.h"
#include "tinyxml2.h"
#include <iostream>
#include <map>
#include "Resource.h"
using namespace tinyxml2;
using namespace std;

std::shared_ptr<Resource> ResourceManager::GetResource(string name)
{
	auto resource = m_resources[name];
	return resource;
}

void ResourceManager::LoadResources()
{	
	std::cout << "Loading all the resources from the Resources.xml ..." << std::endl;;
	
	XMLDocument resourceFile;

	// Load the resource file into memory
	resourceFile.LoadFile( "resources.xml" );		
	
	// Get first Asset
	auto pRoot = resourceFile.FirstChildElement();
	auto pFirstAssetElement = pRoot->FirstChildElement("Asset");
			
	RecordAsset(pFirstAssetElement);

	// Get remaining assets elements
	auto pNextAsset = pFirstAssetElement->NextSiblingElement();
	do
	{		
		RecordAsset(pNextAsset);
	}
	while ((pNextAsset = pNextAsset->NextSiblingElement()) != nullptr);
}

void ResourceManager::RecordAsset(tinyxml2::XMLElement * pNextAsset)
{
	auto nextAsset = GetAsset(pNextAsset);
	m_resources.insert(std::pair<string, std::shared_ptr<Resource>>(nextAsset->m_name, nextAsset));
}

std::shared_ptr<Resource> ResourceManager::GetAsset(XMLElement* element)
{
	int uuid;
	const char* type;
	const char* path;
	const char* name;
	int level;

	element->QueryIntAttribute("uid", &uuid);
	element->QueryStringAttribute("type", &type);
	element->QueryStringAttribute("filename", &path);
	element->QueryStringAttribute("name", &name);
	element->QueryIntAttribute("level", &level);
	auto asset = std::shared_ptr<Resource>(new Resource(uuid, name, path, type, level));

	std::cout << "Fetched Asset " << asset->m_name << "of type " << asset->m_type << std::endl;
	return asset;
}

I also turned this into a Singleton and used the same pattern in my event manager that I created previously in Retro sounds, Event Manager and some running. I then substituted the global reference that I previously used for a single EventManager::getInstance() throughout the code. It's all quite elementary but fun.

Apart from that, I've not made other major inroads were made however I'm still scheming...

I'm reading "Game Engine design and Implementation" by Alan Thorn which inspired me to turn my event manager into a singleton and implement the resource manager. It's quite an old book but the main gaming concepts remain the same throughout the years it appears.

 I attended the 2nd lecture on C programming on Tuesday and learnt some interesting perspectives about binary and one very quick and easy way of converting to/from binary or Hex.

The other interesting thing that I learnt was about 24bit pictures in relation to how many bits are used to store a single colour in an image. I always find these lateral concepts surprise me from time to time. This is all very serendipitous as I'm loading bitmaps into my game prototype. The other interesting thing I learnt was that another student works for the same company as I do, which is remarkably coincidental.

While studying my course work for "Continuing Professional Development", I've found it quite interesting to learn about some of the emerging and current theories out there around the processes involved in learning. I've become fairly interested in some of the material.

Currently, I'm developing a framework, based on all the study material, that I might use to better reflect on past learning encounters/experiences. I've drawn it up and its currently in the draft stages. I'm calling it my "then framework" as it draws on strategies to reflect on the past.

In parallel, I'm developing a framework to assess situations, which is a precursor to the "then" framework which I'm calling my "now" framework. I know, I'm quite original.

This framework is about understanding or being aware of the current situation, the nature of your strategies and behaviours in these situations and basically defining them so you can better know yourself fundamentally and how you can potentially learn to change these tendencies/strategies etc. moving forward.

Quite interesting really.

On the running front, I'm still loving it. posted a 64 VO2max record last week so things are looking good:

As I've mentioned in one of my tweets, I've got another case of Lateral Shoe Disease, which I've now determined is probably because of a few things.

  1. I under-pronate quite a bit causing excess strain on the sides
  2. I don't look after my shoes enough after running.

Yeah, regarding point 2, I think what is happening is that the material on the outside as shown below is becoming brittle and weaker because of the dust that I pick up while running. My theory is that this settles within the fabric and then forms clumps that fill in the mesh-like fabric making it harder and more easily prone to tearing. In short, I need to clean my shoes.

And as such, I bought a new pair of trainers. These are not replacements but until the LSD is fully set in, I can delay the onset of eventual demise by using other shoes to run in and hence decrease the frequency of strain those poor old shoes have to endure.

So its a matter of setting up running shoe round robin really.

I did a lot of research on these new running shoes (As I do) and I decided on the Adidas Ultra Boost 4.0 Triple Black. Now, as my Pegasus 33, as shown above, are pretty much the flagship Nike running shoe and I've gone through 2 (almost 3) due to excessive wear and tear, I figured I'd switch brands. So I opted for Adidas' running equivalent.

These are they:

So, In other news, I've also been thinking about developing a new project that effectively defines and constrains meetings.

I often find meetings to be painful and ultimately just talky-talky and usually only benefiting some - or maybe everyone else! So I've been thinking of a meeting protocol such that it defines how one should run a meeting. Specifically, what process to follow and prevent skipping steps. Almost like a workflow, I guess. 

It's more of an application that shows meeting attendees where they are in the meeting process and looks to include all participants equally instead of just the ones you shouts the loudest. Quite interesting idea. So that's something I'm keen to do and I'll probably use Angular 6 and deploy it to the cloud. I'm really enjoying this technology at the moment. 

I also watched Avengers: End Game and I enjoyed it. I wouldn't say I was excited or absolutely spell-bound by it but that is to be expected - it's not a new movie so I didn't get new-movie-vibe type excitement. I got an appropriate level of awesomeness and for over $1 Billion spent on the film. I'd hope it was appropriate!

I'm not really a serious movie critic however but I like what I like.