I have been internally debating whether to blab about this idea for a while, and was considering keeping it under my hat until I had something concrete to show, perhaps a proof of concept or something, but that seems like it would be a long way off, so what the hell, I’m keen on getting some other opinions.
Okay, so most of us have played with, or at least taken a brief look at, Terrarium. I like the paradigm, programming for a game environment, programming as a gaming interface mechanism; it reminds me of an ASCII game I used to play on my first XT aeons ago, where you “programmed” little robots and set them loose in an arena to destroy each other and see whose design would outwit whose. It's not Combots (or any of it's ilk), which was suggested to me, for the life of me I cannot remember what it was called. It's not important, you get the idea.
Anyway, I started thinking along these lines quite a while back, and have been toying with ideas ever since. Second Life has taken the idea to the extreme, where users create the content contained within the online world, right down to the 3D models; it's apparently almost limitless, and that's a little too open-ended for me, I'd like to work within some logical constraints that make sense for a specific genre of game world.
So let's take an example like Terrarium. Now, unlike Terrarium where you unleash your creations into an online world to fend for themselves, effectively free of your direct control, let's create a character for the player and drop that character into a game world, completely under the player's control. What sort of game world? Well, since it's my favourite genre, let's think along the lines of the classic RPG and drop him into a medieval high-fantasy game world. Now there are probably a lot of beasties that want to kill, eat or destroy our character, and possibly even other player's characters who want to kill him and swipe his stuff, so we'll need to give him a means to defend himself as he embarks on his grand adventures within our game world. Swords, arrows, axes – we could do that too, but it's all been done, all rather passé. How about magic? That's also been done, but is always interesting, and neatly fits the genre; but it's usually pretty limited in its application, forcing the character to choose from lists of pre-defined spells. But this would seem to be the perfect place to implement our programmable play paradigm; what if the player could design his own magic spells, much the way you can scribe your own spells with custom effects in pen-and-paper games like D&D? What if we used programming as the mechanism for creating these spells?
This is pretty much where my train of thought has madly careened its way along the tracks of my mind, in peril of de-railing.
So this is what I'm imagining: a multiplayer online role-playing game, where players take on the mantle of a sorcerous character, a mage of some sort. Only, since they're n00bs in the world, their spellbooks are empty. Bursting with magical potential they're effectively hamstrung, and there's only one way for them to begin to exert their will on the game environment: scribe their own spells, or beg spells from other members of the game's community. Of course the more successful mages will be loath to give up their more powerful magicks, so it's unlikely they'll pick up any powerful sorceries right off the bat, and besides, as a n00b your power levels will be limited. The game could, of course, supply some basic template spells for them to get started with. Wait, let's take a step back; we'll need a framework, and probably some rules of a sort as well.
This is where it all starts to get interesting, because you need to define a framework within which spells can be designed - their effects will need to be limited, or at least constrained, in some respects. So we'll start by using .NET as the spell development platform, it's the logical solution since the game engine will be written in C# and .NET has all those nifty mechanisms for safely and dynamically loading and executing code. It also allows .NET developers to leverage their existing knowledge without having to master a game-specific scripting language, and saves me from having to create and implement one. Yes, I know it limits things to .NET developers, but I have to draw a line somewhere, and this experiment is after all of a .NET-related nature, so I’m not going to justify it beyond that.
So as a starting point you could have an ISpell interface, and perhaps a SpellBase base class with a whole lot of built in functions and methods, which of course the spell scribe could override. There wouldn't be levels as such, but perhaps a magical power level for characters, which will increase as they gain experience in the world. So some spells could be written to scale in effect depending on how much power is channelled into them, while others might only work if the caster has sufficient power. Let's use a generic fantasy RPG term for this casting power and call it mana. So a caster has mana, which is expended by casting spells, and replenishes itself over time, thus limiting even the most powerful character's effect on the world.
Spells could of course be of vastly different types, from the good-old-fashioned fireball, to the tried-and-tested summoning spell. So for example, a game character could launch a flaming projectile attack on the evil zombie attacking him, or summon a monster of his very own to do his bidding, battling his enemies, and generally hanging about to protect him.
The latter seems especially interesting: imagine summoning a small, weak, light-producing firefly to cast light around you when you're travelling at night. A creature like that could cost very little in terms of mana to bring into being, and would be useless in combat, but would still provide a very useful service to its summoner. On the other end of the scale a mage might summon a particularly powerful but very short-lived creature (a rabid wombat?) in cases of extreme emergency, like for example when taking a beating from aforementioned zombie and on the brink of death. Summoned creatures’ AI could be completely customizable, from simply using built-in method calls, like Creature.MoveToward(Object object), to completely overriding the AI loop and providing your own path-finding algorithms and suchlike.
But then the former could be fun too: imagine if you could, given a framework to work within, define your own particle effects for something like a fireball? You could even build path-finding algorithms into projectile spells, so that they avoid impact with objects other than their intended target. If you’re a D&D player, think along the lines of Magic Missile; you could get really creative with possibilities like that.
So a character writes some spells, imports them into his spell book, and launches the game client. You could perhaps have an offline test area where the player can test his latest magical creation before unleashing it upon the game world. When he’s ready he connects to the game server and his spellbook imports, streaming the compiled assemblies across to the server in much the same way as Terrarium; now the fledgling mage is ready to take on the world with his newly acquired arsenal of magic.
There are, of course, some things that still need some thought, like skills in the world other than magic, how money is acquired, how trade is handled, and many, many other considerations. Does a mage need certain spell components to cast his spells, like Eye of Newt or something? Where will he acquire these? Can he gain them by adventuring? Can spells be countered by other spells? If so, is there a casting time associated with spells, perhaps relative to their power, which allows others to react? Other than killing monsters, how can a character gain money? Can he chop down trees and sell the wood, or fish for food? Can you trade spells in-game for money? What about having your own house with a lock-box to store goods you can’t carry? What about guilds and factions? As with any multiplayer online game there are countless things to consider, but the focus of this writing was just to examine the potential of using programming as a game paradigm within an online RPG environment, something which I’m quite excited about.
As always, I’m keen to hear people’s thoughts on the subject…