Wishful coding: evolving language

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.

2 thoughts on “Wishful coding: evolving language

  1. Hi, I’m enjoying your “wishful coding” articles. A lot of your ideas resonate with some of my own wishful ideas from my RL projects (abandoned beta “Squirm” and active alpha “LoSt”). I’ve been trying to achieve something similar by using very small pieces of data that can be connected to form greater wholes. Something like a boss hideout could be assembled by plugging together pseudorandom kits designating architecture, building materials, lists for feature/furniture, monsters and loot, etc. Yielding unique results every time, and weighing random selection based on context. I’m still at the point where I’m getting the basics up and going in LoSt, though … Anyway, I haven’t been able to run Herculeum on my Linux machine. I downloaded the zip from github, found the “herculeum” script and moved it to the “src” directory, installed the following dependencies:
    apt-get install python3-hy python3-decorator python3-docopt python3-pip
    pip3 install toolz hymn PyQt4

    I’m now getting the following error:
    File “/home/simen/data/spill/pyherc-master/src/herculeum/ui/gui/surfaceManager.py”, line 27, in
    import herculeum.ui.gui.resources
    ImportError: No module named ‘herculeum.ui.gui.resources’

    This seems to be pointing at a local script, but I can’t find any file named “resources.py” in the sources. Any ideas what I should be trying next?
    As always,

  2. I’m glad to hear that you like reading them. It seems that (at least at the moment) I have more ideas than time and skill to implement these things, so I can at least write them down. Hopefully I’ll be able to work on some of the ideas in the future and actually realize them. Building more complex shapes from simpler elements is interesting concept. I’m currently building my system from small functions that can be combined, and I would be interested learning more of the approach you took with your system.

    Sorry about the sorry state of the herculeum. Docs aren’t really up to date it seems (or are hard to find) and you’re definitely not the only one having trouble with getting it run. herculeum.ui.gui.resources module contains all the resources encoded in base64 (since PyQt mimics Qt even in this sense), so I haven’t included it in the repository. There’s script ./resources/qt/generate that will run pyrcc4 and copy resulting resources.py to correct location. So if you run that, it hopefully will fix the error. http://tuturto.github.io/pyherc/intro.html#installing-the-game has more detailed instructions. Do let me know if you can’t get it running. I really appreciate all the help in testing and pointing out what parts of the documentation need work.

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 )

Connecting to %s