Saturday, July 5, 2008

The Scripting Continues

Building a PW is a lot of work, I'm finding. I've spent hundreds of hours scripting the systems for Shadows & Silver, and I'm beginning to feel rather worn out. The XP system and reputation system Casa and I are sharing are still in beta. I keep running into brick walls with them, and the frustration has been mounting for quite a while. One of my problems, I think, is that I refuse to incorporate anything into my world unless I know exactly what it does, how it does it, and why. This means breaking open every script and reading through it line by line. What's more, I'm making everything conform to my own scripting standards and making it easily customizable, which means rewriting pretty much every script from the ground up. This is what I did with Knat's XP system and with Vendalus's PRR. They're totally redesigned, rewritten, and expanded. That's a lot of work, but I hope the gain of being able to customize the settings and understand things enough to change them at will makes it worth it.

I while back I published the list of things I was wanting to script. Here they are again plus a bit more, reorganized by priority:

  • A custom XP system with class-based rewards
  • Persistent reputations with NPCs and factions
  • Persistent quests and journal entries
  • A custom spawn system
  • A crafting system
  • A whole new magic system (yes, you heard that right)
  • A D&D 4th Edition-style resting system
  • A D&D 4th Edition-style bleeding and death system
  • An inn room rental system
  • Persistent chests and banking
  • A cut scene system
  • And a whole lot more

The first three are in beta (though I'm about certain the quest and journal system works flawlessly, I'd like to add a feature or two before I call it final). I had an old working version of persistent chests before I lost the mod in a hard drive crash, and I've got a tweaked version of Gestalt's Cut Scene System in alpha. Both of these are rather low on my to-do list, though, since there's few places I intend to use them. I've not even begun my crafting, death, magic, resting, or inn systems yet, and I want to have all these in place before I open the server up for beta testing.

*sighs*

Well, let's at least start getting a working prototype of these systems in place. Getting things started is half the battle with me (the other half is getting them finished).

As I've said previously, the difficulty with scripting is that you've got to know what you're trying to accomplish before you ever open the script editor. If you sit down and just start scripting with no predefined direction, you're going to be lost in a sea of tangled code. So I'm going to begin with the spawn system, listing the requirements of the script:

  1. It must conform to HCR2 coding standards. This means the code should be broken up into short, manageable functions, and it should be self-documenting, requiring few, if any, comments to explain how things work. There should be no inline strings used in the code (e.g., int nNum = GetLocalInt (oPC, “somevariable”);); strings should be defined as constants elsewhere to cut down on errors. Lastly, anything the user may need to change should be placed in a separate configuration file so the user need not wade through large amounts of code.
  2. It must be able to spawn NPCs, monsters, items, and placeables. Preferably, the same code would be used to handle all of these spawns.
  3. It must be able to spawn on a timer or when a PC enters a trigger.
  4. It must be able to spawn multiple creatures or items of the same or varying types at one waypoint.
  5. It should be able to vary spawns based on time of day, the level of the character triggering the spawn, etc.
  6. It should allow a DM to quickly place spawns for on-the-fly encounter design.
  7. I should be simple for non-scripters to use. The easiest way I see to accomplish this is by making the system be based on waypoints and triggers, which can easily be added to the palette.
  8. It must require a minimum number of scripts to operate. I would find 10 or less scripts acceptable.

This is a good list, and it gives me a bit to start with. But one thing that is lacking is user configuration. One of the things that made my XP system so flexible was its massive list of customizable variables. What sorts of things would a user want to be able to modify that would need to be set in a customization script as opposed to on individual waypoints? The first thing that jumps out to me is default settings, which was what the bulk of my XP customization was. As for what things in a spawn system to have defaults set for, though, I have no idea. Anyone?

No comments: