Tales of the Rampant Coyote

Adventures in Indie Gaming!

Frayed Knights: There Was An Old Lady Who Swallowed a Fly…

Posted by Rampant Coyote on June 24, 2010

It’s time for another post about Frayed Knights!

When I first got started in game development, I was told of the “80/20” rule. That is, 80% of the work takes 20% of the time… and the remaining 20% of the work takes 80% of the time.  I’ve also come across the expression, “The first 90% of the work takes 90% of the time, and the remaining 10% of the work takes the other 90% of the time.” It’s very true. Those of you nodding while wincing in pain, I see you guys are professional developers of one stripe or another.

For the rest of you, I want to invite you to ride virtual shotgun with me through a somewhat recent experience (from a month ago) in building out part of the game. I’m going to change the name of a few things to avoid too much spoilerific territory, but when you play through Act 1, you’ll undoubtedly recognize this part if you still remember this article. But all we’re going to do is script up a single room in a dungeon. Of many rooms.

Here’s the basic design of the room, in wonderful text-style prose suitable for a D&D module or one of my lame design documents:

The High Transmogrification Room:

After opening the door and fighting the room’s guards, the party finds two strange, ancient devices. One artifact hanging on the wall (we’ll call it the Wall Artifact) has three slots for Keys By Any Other Name (K-BAONs, we’ll call ’em).  Once three K-BAONs are inserted into the Wall Artifact, the second ancient device, we’ll call it the Amazing Transmogrification Pad (ATP), gets activated. The party can then use it to… [do whatever the the transmogrification pad is supposed to do].


OKAY! I’m really excited about this room, because we’re nearly 80% done before we’ve even started. It’s mostly re-used assets, plus a little bit of scripting, a couple (surely no more than that!) of dialogs, and a couple of text descriptions. Our biggest problem will be the Wall Artifact, which doesn’t exist yet, and creating the K-BAON objects, but those should be simple.

(How, oh how, can I be so naive after so much time, huh?)

The room has already been built. Painstakingly. By someone else. Man, I love my job.

The door? Pfah! Trivial. Maybe two minutes to put it into position, set up it’s scripting. It’s mainly cut-and-paste by this point. The combat encounter? Ditto. I’m re-using monsters that have appeared several times in this level already. The ATP? I’ve already done that before, too. I just have to make some minor modifications to make it so it can be inactive. And – oh, yeah, a little pop-up description of how it seems to be nonfunctional right now, and needs to be activated somehow. So the player isn’t left in the dark. There’s a little extra wiring-up I need to do, and that part’s done. I’ve spent maybe fifteen minutes on this room, and I’m 80% complete. Awesome.

Making An Artifact

Sweet. Now just to deal with the Wall Artifact, and I’m done.  Now, I have a default stand-in object that looks like a big stone question mark that I use as an obvious placeholder.  But I’m on fire tonight, one somewhat complicated room almost done in only about fifteen minutes or so, so I’m gonna actually devote some time to making the art myself. I fire up Blender, create the model, slap a generic brassy texture over it, and export it. I bring it into the game, and hang it on the wall…

And it looks like one of those big circular life preservers. The kind you see at the poolside or on cruise ships.

Okay, a few more tweaks, and it looks much better. Less life-preservery*. Now I need to texture it, so I spend some time mucking around with the UVs, and take a first pass at a texture… which looks terrible.

And so I punt. I message my brother, Brian, and ask him how long it would take for him to create a cool texture for this thing. He’ll have it done and sent back to me before the night’s over, for sure.  And he does. About two hours later, I’m BACK to messing around with the UVs to match the differences between my UV map and his much more refined changes. That ends up taking about twenty more minutes, and the thing looks pretty decent!

Though I still have to make some additional geometry changes to further reduce the life preserver effect.

But hey, that model is done! Woot! But in the meantime, I’ve been writing. And coding…

Decisions, Decisions…

Now comes the fun part. Scripting it up!

So the party encounters the artifact! What happens?

Well, the first time it’s encountered, I have them discuss what the heck it is. That’s easy. And that moves the artifact into state 2.

There’s another state for when it’s already been activated. That’s easy too. A little descriptive text, and … done.

Uh, what happens if the party already has all three K-BAONs when they first encounter the artifact?

Do they manually have to insert the K-BAONs into the artifact through some kind of interface, or does the game just make it happen automatically?

What happens if they keep coming back to the artifact without any of the K-BAONs? Should I have their dialog give them a hint about what they are looking for?

What happens if they only have one or two K-BAONs? Do they insert them one at a time, or should it be an all-or-nothing thing? Contextually, it makes sense that they wouldn’t leave a job half-done for some monster to come by after them and undo it (and re-hide the K-BAONs) – not that I would bother making that happen in the game from a meta-gaming perspective, but in the fiction of the game, it’s a possibility. Since it’s easier for me to do it all-or-nothing, I choose that. But now I need to have a new dialog for what happens when they have an insufficient quantity of K-BAONs.

Detour #1 – Craft Time!

Oh, hey, I need to actually make the K-BOAN object. No problem. Oh, I don’t have an icon for it. I coulda sworn I had one already. Ah, well, no problem. I fire up the Gimp… la-la… a few minutes later, I have the icon. And the object. Alright, now I’m 90% done now! Maybe 95%! That was a little more effort than anticipated, but not too bad. But…

Detour #2: Code Rewrite

Oh. Problem. I have code to check if anybody in the party has an instance of a particular item in their inventory.  Nothing in there to check to see if I have at least so many of a particular item. I haven’t needed that functionality in previous quests and mechanics. Oops!

Time for a code re-write. Uh, actually, new code. I’m afraid of breaking the old code. So now I have a check-for-n items clause. I have to keep searching through the party inventory and different player’s inventory until I’ve counted an least n items of a type, because there’s no guarantee the player is going to stack them all together in one slot.

Oh. Another problem. Similar to the last one. I have to remove n items from the player inventories. My existing code only finds the first instance of an item and removes it. The new code has to search through the party and player inventories (in what order?) and keep removing all instances of the given item until it has removed so many. And then stop.

Decision Time, Again…

Okay, so now I have code that can remove a particular amount of an item. But… hey, this gives me an idea. Should I have MORE than 3 K-BAONs in the area? Like maybe four? The player never has to find the fourth?  This gives them the option of skipping one encounter…

Detour #3: Where Was I, Again?

Oh, now I have to place the K-BAONs in the dungeon. One here, one here, one… oh, wait. I am supposed to place one with the level boss. So now I make that encounter.

I consult my design notes on this boss, and note that he’s got a couple of special abilities that I haven’t implemented yet.  Well, I’ll skip those, for now. Oh, and he has a spear. With another un-implemented special ability. No problem. I’ll give him a generic spear. What? I haven’t made any spears for the game yet? Sheesh, how’d that happen? There’s a whole feat that’s been useless this whole time. So I make a spear.

That also means making another spear item icon. And 3D model. Well, we’ll skip the model, use a stand-in. Gah. Make note of this so I don’t forget.**

Where was I? Oh, yeah, the boss. I finish the boss encounter. With his attendants. Oh, there’s some special code that needs to go there, too.

Done. Okay, I have a functional (but far from complete) boss encounter, and all the placements of the K-BAONs in the game. Cool.

Where was I? Strangely, the children’s song, “There Was An Old Lady Who Swallowed a Fly” starts going through my head.

And Back to the Artifact.

Okay, now we’re back to the artifact. I’m testing. Finding bugs. Testing again. Repeat. I’m trying a variety of approaches, trying to do things things in a different order each time.

Finally, the room seems to be complete, matching the description above.

I thought I was about 80% complete after 15 minutes of working on this room. And now, five hours later, including a couple hours of Brian’s time to make a texture, I’m finally done!

80-20 my foot. That last 20% took forever! ***

Oh, wait, why are those stupid K-BAONs still in my inventory after I activated the Amazing Transmogrifier Pad? Crap. I thought that code was working…

* I still have the characters speculate on it’s life-preservery appearance in their dialog. Just ‘cuz. Dunno if it will still be in the final version, but it amuses me now.
** Granted, the spear wasn’t strictly necessary, either. Nor was going around the dungeon adding it to a couple of loot spots. Maybe I’m too ADD for game design…
***Okay – I’m gonna acknowledge the whole “80% complete” estimate is totally off, as the amount of time that it took for Brian to create the dungeon in the first place was significant. Or for me to write all the original code and create / script the existing objects I’m re-using. And I got a big chunk of another encounter done in the process. Estimations are a totally flawed science. That, or I just suck at it. Mostly me sucking at it, I guess.

Filed Under: Frayed Knights - Comments: 11 Comments to Read

  • Corwin said,

    Question-If you can skip one encounter, cause there’s 4 keys, what happens if you skip the Boss encounter? What would you do with the spare key if you have it? Do you realise people will complain if they can’t find something to use that extra key on? See, you still might not be finished!! 🙂

  • Rampant Coyote said,



    You are quite right.

    I guess that’s why I post these things here for folks to see.

    Yeah, skipping the boss encounter was an option. I thought, “You know, I might be okay with this. The player is likely to come back and fight the boss later anyway.” But the having-an-extra… uh, we’ll call it a key (but it’s not) – yeah. That’ll annoy some players. It’s a meta-game thing, but it’s still the way things are.

  • Kimari said,

    So, either you need to create a new dialog for when the player finds a fourth key (something along the lines of “we already have three, we’ll leave this one for the next adventurer that comes across this place”), which seems like not that much extra work …. or you could create a new way to “spend” this extra key, with appropriate dialog for the following situations:
    – Spending one key while having less than 4 keys at the time
    – Spending it before using the other three keys.
    – Spending it after using the other three.

    …. yeah.

  • Rampant Coyote said,

    … Or I leave it at 3 keys.

    I’m gonna have to think about it. Most of my cool ideas keep becoming a load of extra work, though. 😉

  • Wavinator said,

    I sincerely wish that all of this headache could be conveyed to the player. I think people have a hard time respecting the amount of work that goes into a game simply because they never see this kind of stuff.

    And yeah, I agree… 80/20 my eye! 😀

  • Maklak said,

    From a gameworld perspective inhabitants of that building would only need 3 keys to activate the device, so why have 4? Maybe in case one key gets stolen or lost? This could be an idea for a dialog among Frayed Knights.

    As for having less than 3 keys when activating the device, maybe go for inserting them, displaying a message, and then putting them back in inventory (“Let’s keep this thing and come back later”).

    One key: You hear a low hum, but nothing else happens.
    Two keys: You hear a humming sound, and see a few sparkles.
    Three keys: Activation.

    It would get even more complex if each key was different and putting them in that ring on the wall would have different effects.

    On unrelated note:
    I think in one of Your previous posts You mentioned replacing some people in the party. I think this is a bad idea, because it would be even more work with dialogues.

    There is too much text on the screen. I assume everyone gets the same amount of XP (maybe barring XP buffing items), so “Everyone gains 110 COMBAT XP” would suffice.

  • Calibrator said,

    Adding redundant keys introduces more trouble than it’s worth, IMHO.

    First of all: We do talk about ancient artifacts, right? Normally these are *unique*, aren’t they? Even if you need three all three should be unique and there shouldn’t be functional and optical clones of them.

    Adding clones also confuses the player much more than it may satisfy the clever designer (“The satisfaction of the many outweigh the satisfaction of the one.” – Old Klingon Proverb).

    Possible questions:
    – “What is the fourth one for?” (obviously)
    – “Why do I have only two copies of key 1 – where are the copies for key 2 and 3? I can’t operate a possible second Transmogrification Pad until I’ve found them and as I’ve found the other four in this area I must search it more thoroughly!”…

    Yes, it’s possible to add dialog to defuse such a situation to some extent but is it really logical? (How logical is your game?)
    Player: “Oh he made a second set of keys to make it easier for me… doh!”
    -> You could of course add a dialogue like suggested above where the party laments about this (“Do they think we are incompetent?”).

    Finally, if one must absolutely go with the “Let’s drop the key for other adventurers”-line then add “- without the others they are stumped anyway – ha ha!”.

    Defusing the situations with appropriate actions can be a solution but they often produce more questions, too.
    If you let one key crumble in the lock (to build up tension) the players may still ask themselves if they would have needed the key in another situation.
    This could also lead to another dialogue (“Thank god we had another one!”).

    Another possible route would be checking the party inventory if all three keys are already present. In this case give the player a special item like a good weapon or some unique loot to compensate him for his efforts.

  • (name here) said,

    You should totally have made each of them a distinct object and just searched for each one in the inventory.

  • Uskok said,

    I can see how the code for finding an item cannot be easily used to count an arbitrary amount of those items, but why cannot the code for deleting an item be called n times to delete the first such item n times?

  • Rampant Coyote said,

    That’s mostly what the new code does. The old code was just (in retrospect) sloppy and – if I used it that way – buggy. It’ll be retired and deleted soon.

  • Walk before you run « No Time To Play said,

    […] is to make a MMORPG (hint: it’s really difficult). Or even an apparently simple game. Or just a single encounter. And they’d be right. But that misses the […]