OK, here is a (rather technically) update for the current PoC. The PoC itself is not finished yet, but I finished an important piece - and I am very VERY satisfied with this, so I thought I might share this. Maybe you glanced some screenshots beforehand about this.

Well, I was working the last weeks in my spare time (which was highly ultra spare due to a number of certain recent events) on a number of code related things to ultimately support the following use case:

1) extract a color schema from an image / the screen as XML file
2) load the XML file into the game (from plain XML file or encrypted WRS)
3) create game objects with their current schema color accordingly

This is intended for:

a) fast and easy creation/modifaction of a puzzle's look because of human readible schema files
b) loose coupling (colors are defined outside the game)
c) update friendliness
d) end-user SDK / game editor capability

For this, I implemented the following, which took much more time than I expected:

- First I chose to include a XML parser as DLL, but decided against that. Now, I ported the opensource C++ irrXML XML parser to Lite-C and added a SAX-like interface.
- This included the implementation of i) a new String library with my own (dynamic) String type and functions to support the XML parser and ii) a (dynamic) pointer arraylist.
- a standalone JAVA client GUI, that makes it possible to click a pixel on the screen and fetch it's color.

This is now finally done. It is not polished, but it works reliable.

Example: In the following screenshot you can see, that I took a a picture of me and uploaded it into ColorLover's photocopa web tool, to create a a colorscheme ("Overseas Highway") from it. With the tool, I extracted the colors and saved it as XML.



In the game, I just call

Code:
AvColorSchema* avColorSchema = loadColorSchemaFromXml(xmlFilename);



which essentially executes

Code:
AvColorSchema* avColorSchema = avColorSchemaCreate();

AvXmlCallback callback;

memset(&callback, 0, sizeof(AvXmlCallback));
callback.clientData = avColorSchema;
callback.evOpeningElement = loadColorSchemaFromXml_ev;

bool xmlReadSuccess = avXmlRead(xmlFilename, &callback);



The event loadColorSchemaFromXml_ev is called on each opening XML element and includes the logic to fill the AvColorSchema object, which is always passed as reference with the callback-call:

Code:
void loadColorSchemaFromXml_ev(AvString* xmlName, AvPtrArray* xmlAttributes, AvXmlReader* xmlReader, void* clientData)
{
   AvColorSchema* avColorSchema = (AvColorSchema*) clientData;

   // colorschema name
   if (avStrEqualsIgnoreCaseAscii(xmlName, "colorSchema")) {
      AvXmlAttribute* nameAttr = avXmlReaderGetAttributeByName(xmlReader, "name");
      avStrSet(avColorSchema->name, avXmlAttributeValue(nameAttr));
   } else {

      // named color
      if (avStrEqualsIgnoreCaseAscii(xmlName, "namedColor")) {

         // create new color
         AvNamedColor* namedColor = avNamedColorCreate();

         // set name
         AvXmlAttribute* nameAttr = avXmlReaderGetAttributeByName(xmlReader, "name");
         avStrSet(namedColor->name, avXmlAttributeValue(nameAttr));

         // add color
         avColorSchemaAddColor(avColorSchema, namedColor);

      } else {

         // color
         if (avStrEqualsIgnoreCaseAscii(xmlName, "rgbColor")) {

            int r = avXmlReaderGetAttributeValueAsInt(xmlReader, "r");
            int g = avXmlReaderGetAttributeValueAsInt(xmlReader, "g");
            int b = avXmlReaderGetAttributeValueAsInt(xmlReader, "b");

            AvNamedColor* namedColor = avColorSchemaGetLastColor(avColorSchema);
            if (namedColor != null) {
               avRgbColorSetRGB(namedColor->rgbColor, r, g, b);
            }
         }
      }
   }
}



This is pretty straightforward, I think. And it works great! Here is a screenshot of the scheme applied to my test setup:



In addition, I also refactored my whole shading setup and took massive advantage of the HLSL include feature JCL added to the engine in the last update. It is a blast, in total, my shader code is so much smaller, because I was able to split it into several building blocks smile this is so great!

After polishing the code, I will eventually release the code of the XML reader / String library / pointer arraylist soon to the public, if anyone is interested. I call the core library behind my game "Avalanche", just in case you are wondering why there is always an "av" before each type and function wink