Instances! Kind of

So instances aren’t as hard as you might imagine, but nor are they trivial. We now have two instances in the game, and I think we’ll leave it at that for now. The beginning area is an instance because it wouldn’t work if more than one person started a character around the same time. The other is the mansion quest that comes with the stock Dead Souls mud lib, mainly so I could test the instance-related code.

I was able to retrieve the area I had created a few years ago and work it into the current game. The boot drive had failed, but the data drive was intact. I created an Ubuntu CD and copied the old code off the drive to safety.

Now, if you start a new character, you find yourself in a padded cell that you have to escape. After getting out of that room, you’ll find yourself in a floor of a hospital. The staff are dead and you have to find your way out. The normal exits are blocked off since your floor is under quarantine. Once you find your way out, you’re out of the starting instance and in the game proper.

This wouldn’t work if two players started in the padded cell together, or if a second player started before the room had reset. The needed items wouldn’t be there. Instances mean that I don’t have to worry about that.

There’s a story telling reason for starting in the hospital. You’re sociopathic. You don’t see the world the same way the other characters in the game see it, so you have been committed. This explains why the world in the game feels different than the world you inhabit as the player outside the game. Since you provide the brains behind your character, the other characters in the game see you as a bit crazy.

How did I make instances work? In Dead Souls, there are a few points where I had to add some logic to get it right, so far. They deal with player movement and doors.

When a player or NPC moves, it uses code in /lib/props/move.c to manage moving to the destination room. There, I can check if the destination is an instance and, if it is, get the instance clone of the room. Then I go to the clone. There’s a daemon that tracks which clone is for which player or party. I also added some code to /lib/std/room.c to manage creating the clone so the player/NPC could just query the master room object for the appropriate clone and get it. When an NPC moves from one room to the next in an instance, it makes sure it gets the next room in the same instance as the room it’s in.

Doors need to be instanced as well because their state is specific to the path between two instanced rooms (this would be true for any objects that act like doors from a data management perspective). This is handled in /lib/exits.c with clone tracking provided by the same daemon as for rooms. In instanced rooms, you have to go through the GetDoor() method to get the right instance door.

The code for setting up the room in the create() function doesn’t change. Exits still reference the master copy, as do the door configurations. This makes it easy to make a room instanced or revert to the original non-instanced version.

I modified the update command to let me update the room and reclone the instance I was in. The hospital daemon also needed a slight modification (less than 20 LOC, I think) to handle NPCs that needed to be unique within an instance. The hospital code is based on the Discworld mud lib, not Dead Souls.

Future changes could allow multiple laser tag games on the same range, something still to be finished. I’m still thinking through what else might work with instances. I don’t want it to be a way to be lazy about content. I want there to be good reasons for doing them.

Posted in Development | Tagged | Leave a comment

Quick Update

I’ve been quiet for a while, but not because I’ve stopped working on Second Contract. I’ve not gotten as much done over the last few weeks as I would like, but there’s a reason. I was sick, on vacation, and then sick again. Three weeks right there. It’s amazing how much my critical thinking doesn’t work when I’m not feeling well.

I’ve continued going through the help documents and editing them to use the NROFF daemon. I think the result is well worth the effort. Besides, I need to review all of the documentation to make it fit Second Contract, so I might as well kill two birds with one stone, or something like that.

I’m also starting to work on instances. Based on how I’m doing this, we’ll be able to have instanced areas or virtual areas, but not both at the same time for the same room.

On a disk that I don’t have access to at the moment (motherboard may need replacing again), I have a beginning area that I want to bring into the current game. The problem is that it really is a single-person area. You start in a padded cell in an asylum and have to break out. As a player, you’re “crazy” because you don’t see the world the same way the inhabitants do. I want to make this the intro to the game, but it doesn’t make sense to have two people in the same padded cell having to figure out how to get out. Or have one person get out and another start as a new character in a room that doesn’t have the required stuff in it for them to solve the puzzle.

I’m doing instances so I can make the area work as an intro to the game.

The way I’m doing this is to let rooms be one of three types: non-instanced, single player instances, and group instances. If a room is instanced, then I don’t let anyone make the master object their environment. Only clones can be environments. I have a daemon tracking which clones belong to which players. The room tracks which player owns it. Only arches can enter rooms that don’t belong to them (so they can teleport to a player having trouble).

In the code that manages player movement, we check to see if a room is instanced. If so, we ask the room for the instance belonging to the player and then try to move the player to the instance.

A couple things are left unresolved for now (besides testing): unique NPCs need to be unique to an instance (this can be handled in the hospital that populates an area), and we need a way to unload and reload instances when we update the master object (probably handled by the update or reload commands). I’m sure more things will pop up.

Posted in Development | Leave a comment

IC vs. OOC

I’ve been working on the help system and a new version of nroff. The goal is to have a common layout for all command/verb help while also cluing the command/verb object into some important information about how it is used. I’m working now and then on a new parser based on the Discworld parser.

Dead Souls divides commands (in the sense of “things you type to control the game”) into two major types: commands and verbs. There are also soul commands and a few other things thrown in, but commands and verbs are the two major types. Verbs have syntax that is used by the parser to determine what is being acted upon. Commands do all of their own parsing.

This division of things into commands and verbs had me considering some of the different ways we experience interacting with games. Every game can be divided into two realms: in character (IC) actions and out of character (OOC) actions. It doesn’t matter if you’re playing a board game, a LARP, or a MUD, there are things you do that are IC (e.g., buy a hotel in Monopoly) and things that are OOC (e.g., role the dice in Monopoly). IC actions are part of the narrative of the game while OOC actions are outside the narrative, even if they impact the narrative.

Another way to think of this is that OOC actions make you aware of the interface to the game, whether that’s a command line, a mouse, or talking about the game to other people. In a LARP, if you do rock, paper, scissors, such as was done in the old World of Darkness, you’re doing something outside the narrative because vampires aren’t really standing around seeing if paper beats rock. They’re running around shooting each other. The IC action is fighting, but it’s accomplished by an OOC mechanic.

On the other hand, social interactions in a LARP tend to be IC: the conversation is experienced as the players intend it to occur in the story.
Continue reading

Posted in Commentary | Leave a comment

NPC-Centered Stories

If you’ve played MMOs much of any flavor, you’ve probably run into quests. Basically, these are goals that have some complication that require effort on your part to overcome. Maybe you need to kill X monsters. The complication is finding them and being powerful enough to beat them. Taking a package to NPC Y has the complication of finding them and navigating the game.

These are all simple. The more sophisticated games chain them together to provide a story arc for you and the thousand other players seeing the same content. Second Contract has systems enough to provide these kinds of quests and puzzles. We even have a system that is almost complete that can spread them among NPCs similar to gossip. Instead of the same NPC having the same mission or quest every time you visit them, the missions on offer may be pulled from a pool of missions available to a number of NPCs and based on reputation, morality, level, or other criteria. For example, we might have an NPC in the Sword training area with jobs that are expected to be violent and need the special skills of a Sword.

The pattern that’s at work here is that the NPCs in the game are trying to provide a story that revolves around you, the player.

I want to invert that pattern. I want players to be able to interact with an NPC in a story line that revolves around the NPC.

Imagine encountering an NPC that needs to get home in another city because her grandfather is dying from cancer. She doesn’t have enough to get the train fare, but with a little help she’d be on her way. Could you help her get a train ticket? How do you do this when cash is only useful on the black market?

Once she has her ticket, she can get on the train. Will there be further complications? In a novel, there better be or the story will be over pretty quickly.

Better yet, if her goal is to visit her grandmother, are there other ways to help her reach that goal other than the one she proposes? Can the game recognize that you’ve helped her reach her goal if you don’t do the obvious thing of getting a ticket for her? If she asks for cash or credit to cover the ticket, will getting the ticket or even giving her a ride on your motorcycle work as solutions even though she (and the game) didn’t explicitly propose them as solutions?

This means that we need a system that has a long-term goal for the NPC, but manages intermediate goals as well based on the situation the NPC is in and the known possible ways forward towards the other goals.

Let’s leave games for a bit and look at how plots work.  The flow for a character lags the reader a bit. Usually, the reader knows ahead of time that there’s a problem. It’s easy to see this if we divide a novel into a prologue and three acts.

The prologue opens with the character knowing where they are and how their world works, but the reader doesn’t share this knowledge. The prologue catches the reader up to where the character is, or at least enough that the reader can figure out what’s going on enough to enjoy the story. But once the prologue is over, the reader knows something is happening, because that’s when the complicating factor occurs that moves the character away from the stable situation they were in.

The first act then opens with the disturbance and traces the character discovering that there’s a problem. At the end of the first act, the character knows what the problem is and must find the solution. At that point, the reader has a good idea of what the solution should be, but perhaps not what the solution will be.

The second act carries the character from knowing what the problem is to knowing what the solution is. By the end of the second act, the character is poised to act on their knowledge and start implementing the proposed solution. This is the act that brings the character and reader back in sync, because at the end of this act, the reader may not know any more than the character does if the solution will work.

The final act is the character working through the solution.

That’s the broad plot outline of a novel. Of course, there are complications along the way. Every time a character goes to do something, they run into a problem that they have to solve before they can get back to what they were doing. Each smaller piece follows the same pattern as the entire novel: run into a problem -> find a solution -> implement the solution. Every time a new complication arises, the former goal goes onto a stack of goals that builds during the first part of the story and shrink towards the end.

That’s an oversimplified view of novel construction, but it’s useful enough for a text mud trying to automate plot complication and resolution.

What we end up with is a series of plots within plots. As we climb the stack of plots, we get to increasingly smaller areas of interest. The fundamental plot arc might be to get to another city, but the smaller plot arc is getting the ticket that will let us get to the other city. Getting the ticket is a smaller problem and is higher up the stack of plots.

In programming, this is like a function realizing it doesn’t have everything it needs to calculate the answer, so it sets everything aside for a bit and calls out to another function to do some task. When that other function returns, it picks up what it set aside earlier and continues.

We end up with a stack of plots, each nested in the ones below it.

The player should be able to satisfy any of the goals in the stack and result in (1) unwinding the stack to the point where the goal was satisfied, and (2) get rewards commensurate with the work done. The closer the satisfied goal is to the fundamental goal, the greater the reward (or perhaps the greater the difference between the top of the stack and the goal satisfied).

I’m not anywhere near having this implemented, but I have started a page on the wiki where I’d like to collect some example plots with complications. You’ll need to use your character name and password to log in to the wiki. Having examples helps when trying to figure out where the divisions between responsibilities should go.

Here are some articles from Skotos that touch on plotting and games to get you started exploring: Storytelling Strategies: Some Observations from the Mortalis Victus Alpha Test, The Elements of Good Mythtelling, Part Three: Singular Plot in Practice, Dirty Words, Part 1: Plot. Feel free to use the comments to point to other articles you find.

Quick update on some things in the game (full list in the Changelog - no login required):

  • Weather gets you wet now, and umbrellas are trying to figure out how to keep you dry.
  • A new mission to run around and collect beads has been added to encourage you to explore the shops.
  • The map has been updated. It doesn’t have all of the shops labeled yet.
Posted in Development | Leave a comment

More Missions!

It’s not too late to create an account on Second Contract and have access during the alpha period! Once we go to a closed alpha, new accounts will require an invitation code from someone already in the game.

We have a notion of missions, tasks, and quests that follow fairly closely the traditional way quests work: you accept the mission from an NPC, do the required tasks, and get the reward. The same NPC has the same mission/task/quest all of the time. The mission/task/quest is always available.

That doesn’t lead to a very dynamic world. It’s good as a starting point. The mission to solve the murder of the Museum manager was useful in seeing what kind of information I needed to track, but I’d rather the manager not remain an unsolved murder forever.

I added a gossip handler yesterday. Lars and Ben in the Old Seadog have a few gossip chats now, and if they hear players say things, those things might make their way into the general gossip.

I’m starting to play around now with a mission handler that acts like the gossip handler: NPCs can query for a relevant mission to offer to a player, and NPCs (or other game pieces) can contribute new missions that are then passed along. We can add missions in response to player actions. We can have a sequence of missions that become available as you progress in a reputation or as you do a series of quests.

I’m also playing around with reputation and morality. I’ve never been happy with the single axis that comes with the typical mud lib. Drakkos has a good blog post about morality in Epitaph, and the basic idea works with Second Contract. What I’m implementing isn’t the same, of course, and how morality plays into the game isn’t the same as in Epitaph, but it’s more nuanced than a simple, single number. I used the associated TED talk in a creative writing course last year to help students understand how to create liberal or conservative characters.

For now, I’m treating morality as a five dimensional space (Caring, Justice, Loyalty, Order, Violence). When comparing two living things, I look at the vector running between their moralities: are they greater or lesser in magnitude and to what degree are they in the same direction or opposite? It boils down comparisons of two individuals to a pair of numbers that depend on how they are related. Essentially, it’s the magnitude of the difference (the size of the vector pointing from one to the other) and the angle between them (assuming a plane containing both vectors).

So missions can become available based on morality as well. If you are a caring player, then you might get missions to help refugees from the wilds. If you are violent and care about order, you might get missions to suppress an uprising, which might lead to missions for caring players to deal with the refugees from the fighting.

I’m also working on redrawing the Old Town map. Since the one on the website was published, I’ve worked out the geography and virtual spaces.

Posted in Development | Leave a comment

Entering Alpha Testing

I’ve opened the game to let anyone create a character and see what’s around. Please remember that there are bugs. Things are broken or incomplete. I’ve focused on getting a few core systems working instead of trying to build a lot of content. That said, there’s a lot that does work. I’m building on the Dead Souls mud lib, after all, and not starting completely from scratch.

Here’s a list of what I consider working well enough that you can expect some measure of fun from trying them out:

  • The task provided by Gruel in the Old Seadog kitchen
  • The mission provided by the primary inspector in the Alien Tech Museum (this needs some editing in the dialogue, but the mechanic of the mission should work)
  • The sword and rocket classes (both have trainers in the game – the Cross trainer is around, but will be moving)
  • The Orcslayer quest (though some areas need editing)
  • The Old Mansion quest
  • The Old Polytechnic Well quest (still needs a bit of editing of descriptions)
  • Partying
  • Gangs
  • Yo-yos

There are enough quests, missions, and tasks to get to level 5 or 6 while killing only one NPC. However, there are enough NPCs around that you can hack-n-slash your way to level 10 if you really want to.

So drop on by and stick around for a while. You’ll get a nice THATCampGames t-shirt (in the game) and access to the game wiki.

Posted in Development | Leave a comment

Goals and end games

Over the last week, I read through A Theory of Fun for Game Design by Raph Koster. Next up is Gamification by Design by Gabe Zichermann. The former has a lot more to do with Second Contract than the latter. Gamification is going to impact my digital humanities work a lot more than my game design.

A Theory of Fun made me think about the underlying point of Second Contract, which I had done some already, but without as much focus. It’s easy to create a game with a particular win condition, but that’s not how art works. Art is open ended enough that you can come to your own conclusion. Art also says something about the world.

Both things should be possible with Second Contract.
Continue reading

Posted in Commentary | Leave a comment

Classes

For those not familiar with the term, classes are ways of chunking character abilities based on stereotypes. A warrior might be a good fighter but not a good magic user. A mage might be a good magic user but a weak fighter. Different classes cater to different play styles by allowing or disallowing abilities, weapons, armor, or other things in the game. Some games allow multi-classing whereby you get to select more than one class for your character.

Somewhat orthogonal to the idea of classes is the idea of skills. Some games have them while other games don’t, at least in a way that is seen by players. Skills measure how well your character can do a particular type of task. A weapon skill might determine how well your character can use a sword. Another skill might determine how well you can heal someone.

In games that have skills and classes, the classes tend to determine the set of skills the character can have or be good at. Instead of having particular limitations coded based on the class, they are brought about by making skills available (or not) for a class. The limitations in the game then come from the presence or lack of particular skills.
Continue reading

Posted in Commentary | Leave a comment

Starting the New Year

Today is the last day of vacation before returning to work. I think I got a lot done over the last few weeks. I’m increasingly cleaning things up and making sure a few things are working well for the end of the month. The MUD is still alpha, but I want it to be somewhat interesting for anyone who may want to be an alpha tester.

I’m starting to feel a change in my development. Up until now, I’ve been focused on systems. There’s still a lot of system work to do, but it’s getting easier to spend time on content. The system stuff there is to do is mainly fleshing things out so I can get on with more content.
Continue reading

Posted in Development | 2 Comments

Virtual Areas Fleshed Out

As part of finishing the lake, I’ve worked on the virtual areas: the sky to allow flying, the lake to allow swimming and diving, the lake bottom where crabs and other things can be found, and a forest with deer, bears, and assorted other creatures.

The most difficult part is stitching these together with the non-virtual rooms and making sure everything is consistent. Flying works, swimming works, the forest works, and they all work together in a fairly seamless manner. I’m still looking for bugs, but the hard part is done.
Continue reading

Posted in Development | Leave a comment