GoldMonkey now support tagged values

If you don’t remember what is GoldMonkey, click here: GoldMonkey is... well, gold!

Some work has been done. Now the values can be loaded also from JSON, and I’ve added a “tagged values” feature, which I will explain with this example:

I have to load a value enemy_life. However, this value changes with the difficulty settings. On easy is 5, on normal is 10 and on hard is 15. The JSON contains all the values:

{
    "id": "enemy_life easy",
    "value": 5
  },
{
    "id": "enemy_life normal",
    "value": 10
  },

{
    "id": "enemy_life hard",
    "value": 15
  },

Then on the game you retrieve the appropriate value with GM.loadInt("enemy_life", GAMEDIFF)
If later on you decide that the value should not change between levels, you can modify the JSON like this:

{
    "id": "enemy_life *",
    "value": 15
  },

…of course without changing the source code. :slight_smile:
Thoughts? Did I reinvent the wheel? :stuck_out_tongue:

The tag can be any string. The example is for difficulty settings because it is the most likely use case, but you can come up with other tags.

4 Likes

props for adding JSON, XML is a giant pile of ass for a format, keep up the good work =)

Could you explain, just briefly, what the difference between the two JSON’s that have the intended effect, is? Is it the * or is it that you only have one line or ?

The first JSON has different values for each difficulty: enemy life on easy difficulty is 5, on normal is 10 and on hard is 15.

The second JSON has the same value (15) for all difficulties (*).

The advantage here is that the programming is decoupled from the balancing.

Ah, so the * is wildcard :smile: I’m not very familiar with JSON, but that seems like a great implementation!