More thoughts on tagging
I did some more thinking after yesterday's blog post on tagging, and had an interesting discussion with Mike Cook and Chris Martens about how they approach similar problems. So here are some more thoughts on the subject.
Namespaces might be interesting for tags. Right now tags are global, and that means a tag defined in one place for one context could interfere with content somewhere else. I've already briefly hit situations where I had to rename tags to avoid that. This is another thing that works in small projects but will cause trouble when you scale up. A very similar problem exists with CSS in large scale web projects, and CSS is similar to tagging.
If instead of "give me something with tags 'corridor' and 'spooky'" you could say "give me something from the namespace 'spaceship' with tags 'corridor' and 'spooky'", you can avoid getting your spooky castle corridors into your spaceship. Setting a namespace could be done both explicitly ("this scene has the 'spaceship' namespace") as well as implicitly ("everything read from the castle folder has the 'castle' namespace"). I kind of did this with the Diablo-like I mentioned by having an implicit setting tag, although that's not quite the same as a namespace, perhaps. Or is it?
Is a namespace like a meta-tag? Is a namespace like a normal tag? Could the desired namespace be a variable? Could you have a hierarchy of namespaces? Is that the same as just having a bunch of tags? Does madness lie this way? Perhaps.
Tag types could also be interesting. Instead of saying 'castle' or 'spaceship', you could say 'location:castle'. That's already possible now, because 'location:castle' is a valid tag. So by imposing a scheme on yourself you can make your life easier and avoid the problems of tags being global. (This is a solution that people use for in CSS, e.g. BEM, a naming scheme for HTML elements.)
The difference between a naming convention and something stricter is that if the computer understands things like tag types or namespaces, it can give you better feedback and do better analysis. Putting knowledge into the computer is almost always a good idea.
Take it one step further and you could say "location = castle". And then you have a conditional expression, which can query any state variable. And, with a bit of work, any attribute of any entity, object, location in your world model. Mainframe allows you to use 'PC_job' to refer to the job title of the player character (which is randomly picked from a list, based on the story act). But a nicer version is to say 'PC.job', because then you can easily extend it to other attributes.
So then you could say "give me a scene that matches the current setting and mood," and the engine will find scenes with setting = castle and mood = spooky, say. Or you could just say "give me a scene", and it's the scene that knows which attributes it applies to. Is that confusing, not being able to explicitly specify what you want when you want it? Perhaps, but with good tools that shouldn't be a problem, and you'd need that anyway to scale this up. There's also the question of loss of flexibility when you move from a super-simple tag system to something more complex.
In any case, continue along this route and perhaps you'll approach what Mike and Chris are doing, which is to use predicates and formal logic. I could understand the example Mike gave on Twitter from one of his jam projects. Chris has taken this to dizzying heights: her work on Ceptre makes me regret having dropped out of computer science.
Conclusion: I don't know yet. The thing I want to do now that I have some more results from working with tags is to look at it from multiple points of view and look for "if you look at this as [rules/variable names/logic] then things become simpler and/or more powerful" insights. This is why I'm interested in programming languages all of a sudden. More on that in a future blog post.