One of the goals with pyherc/herculeum has been to build a language that can be used to write a roguelike game. That part of the project has barely begun and most parts are concerned with level generation. While reading about SHRDLU (a really cool program designed as an experiment of understanding natural language) one morning and thinking about languages in general, I started thinking what would happen if the language used in level generation would be an evolving one? Nothing limits this thought experiment to level generation only, but I’m going to tackle one thing at a time.
By evolving one, I mean a language where the exact meaning of words would gradually shift over the time. Same configuration would give different kinds of rooms, depending on what kinds of actions had been done in the playing world. In certain circumstances, a throne room would mean very beautifully adorned, richly decorated room, full of statues and other treasures. Under some other circumstances, a throne room would be dusty, dark and damp place, with nothing valuable in it. I have an idea, that this would make the world more intersting to player, as they would have some power over it and be able to push it to certain direction. Combine this with moral baggage and garnish with emergent story telling elements and the result should be interesting (not sure how playable though, but that’s entirely different thing).
I envision that the system would have to be built from several layers (I don’t want to hardcode several different kinds of throne rooms after all, but just one meta-throne room). At the highest level (or very close to the highest level), would be single rooms: throne room, common room, guard post, bakery, library and so on. At the very lowest level there would be single features like certain type of floor or wall. In between there would be one or more levels that were used to describe things like: furniture – table and chairs or decorative group – a line of statues – marble statue and so on. As each level is built on top of the levels below it, changes done at the lower levels would percolate upwards. These changes could be replacing really beautiful statues with grotesque or broken ones.
At the high level, changes would be about what lower level features are present and how they’re positioned. In one situation every throne room would contain weapon and armour stands that the player can loot, while in another there would be statues instead. Or that every guard post is manned by guards.
What specifically would trigger changes in the language? I don’t like completely random acts, so player’s actions would have to be the driving force. As the game progresses, their actions will shape the language and thus the world too. If, by their actions, a king is restored back to power, all royal rooms would change to more opulent ones. If a faction of mechanical spiders is crushed, number of their forces is greatly diminished (and maybe some other faction rises to fill the void). Mostly the choices that matter are on the meta-level or based on long-term performance, as described in the earlier post about moral baggage.
How would I implement this from the technical point of view? Granted, lots of this is just speculation and idle thoughts, but I have sketched down some ideas. First thing that needs to be done is to defer evaluation of level configuration until a level is being generated. This allows actions done by player chance to have an effect on level being generated. Next step is to add a knowledge repository of some sort to Model class, that can be used to stored current situation in the world at large. Final step is to build a dynamic dispatch system based on the information on the knowledge repository and make it as unobtrusive as possible to the programmer. And all this should be done in a way that keeps the time of code being broken as small as possible.