2 ms·
I don't completely understand this technique, so maybe I'm off in my interpretation of it. But it seems like something, flexibility-wise, between hard coding t
by bcrosby95 7y ago
I don't completely understand this technique, so maybe I'm off in my interpretation of it. But it seems like something, flexibility-wise, between hard coding things and embedding a scripting language.
Back in high school I liked to work on MUDs (multiplayer text roleplaying games). It feels like this is sort of thing we resorted to a lot. Content creators that couldn't code could use a text UI to build up spells, skills, etc that the code would use to apply the specified effects. We had basic things (such as "fire damage") and more generic modifiers (such as "make the next thing apply to everyone close to you rather than just 1 person").
And every step of the way other subsystems could intervene and modify the outcome, so someone could e.g. create a monster that nullified all fire damage someone tried to deal to anyone nearby.
For people that did know how to code, we had a basic scripting language for more flexibility. But these scripts still plugged into the above system.
- habitue 7y agoYeah, it's very similar conceptually to adding a scripting language. But the point isn't to add user extensibility to the system, it's to have an introspectable description of the program. So in the scripting analogy, what you'd do is take the program you wrote in C++ or whatever, and write a little mini-language that allows you to express all of the functionality needed to write the game in. So for example, C++ features like template metaprogramming aren't necessarily something you need to write games, but "spawn an NPC" is a very common task, for example. You reduce this language to just whats needed to write the game with. The difference from a scripting language is that instead of the game being written in C++, with a little interpreter for the scripting language, instead the C++ is just a compiler for the scripting language. You take the script description of the game, and compile it down to the final game. That little level of indirection allows you to do things like optimization, but also lets you do things like easily swap out how the program is evaluated. For example, in a graphical game, you could skip rendering to the screen, or advance time in jumps instead of needing to wait for timers, etc.