TextWorld’s Basic Logic Pt 1   Leave a comment

It’s SO HOT! How hot is it? It’s so hot I forgot my glasses at home when I came out to the cafe!

Well, I can still see without my glasses, but I got them primarily because without them it’s hard to tell the difference between = and -, which is pretty important for a coder. I wasn’t planning on doing any coding today though, because after writing up some of the properties of the Thing class it occured to me that I still hadn’t figured out the logic of the communication between the player and the TextWorld, which might change the shape of the classes.

In order to figure all of that out, I’m going to start by figuring out the shape and logic of the TextWorld object itself, and how it’s displayed, and then I’ll make three different possible data sets for it to display, so I can figure out what it needs to carry over. This is pretty essential, because if I’m going to make this text well formed I need to format a lot of data. I want it to be a neat and concise description of an area, not a list of things.

The three data sets will be as follows; a re-do of the Roaring Turkey Inn’s Pub, the outdoor area containing the Roaring Turkey Inn, and the interior of a tunnel, containing an aggressive goblin. I think it’s important to figure out how interactions between mobiles will work, since even if you don’t have combat, you’re gonna want to talk to people or shake their hand. So, there’ll be interactions like that in each scenario.

Oh for goodness sake, I forgot my headphones too. I was not well prepared when I came down to the cafe today. But, I guess I was pretty darn hungry, hot and bothered. Still, no need for headphones for a text game, and it’s not particularly noisy at the cafe today. Its pretty empty ’cause everyone’s going to the bars or McDonald’s for St. Patrick’s Day. Of course, there are a lot of bars downtown, so there’s a lot of people walking by all decked out in green. Quite the show.

Anyways back to work.

The TextWorld Class will be a sprite with four ScrollBar objects on it’s stage, and each of those ScrollBar objects will have a TextField on it. Those four textfields will be the primary interface between the player and the world, as displayed previously.

The upper left corner will contain the description of the largest space you’re able to see from your location, which will of course include the short descriptions of the spaces inside of it. There’ll also be a formatted list of the Exits, Things and Mobiles in the Space and Subspaces, and where the player is located. Looking at my earlier rough, I formatted the location/object differently. First it said the location, behind the bar, then the mobile Hank, then what Hank was doing. Then the next sentence had the thing, a fire, and the location, inside the fireplace. I’m not sure if that’s considered good writing or not, but it’s a good idea, I think, to code it in to interchange the descriptions, so that sometimes it’s Thing/Location and sometimes it’s Location/Thing. It’ll shake things up and make it look less like a list despite being a list.

The lower left TextField will contain a list of actions. It’ll contain the player’s actions and the actions of any Mobiles the player can observe. So, when Hank stops polishing mugs and starts decanting a mug of lager, it’ll say that in the action bar. When the Goblin attacks the player, it’ll go in the action bar. I’m calling it a bar, it’s not really a bar, it’s an area. Part of the reason for this is to allow the player reactions. It might pop up “The Goblin swings his Sword at you!” and you click on Sword and the context menu has an option “Parry” added to it. Part of the reason I’m writing out the logic like this is I still haven’t completely figured out how the action/time system will work.

The way I’m figuring it, every action will take a certain amount of time. From the player’s perspective, when they do an action that has a really short amount of time, like walking across a room, probably not much will happen. Maybe someone else will enter the room or walk across it at the same time. On the other hand, if they were to do something that takes a while, like mowing a lawn, there would be a lot more actions going on that they see during the course of that time period, because the internal time keeps ticking along. It all happens instantly from the player’s perspective though. It might say, “While you mowed the lawn, an hour passed. During that time, three people walked by.” and if you click on people, it’ll give you a context menu that lets you see in detail who walked by. On the other hand, something might interrupt you, like this: “You mowed the lawn for ten minutes, but then a rampaging Orc appeared!” and you can click on rampaging Orc and it gives you the option to ignore the orc, which would probably be followed by another interruption as he attacked you, or you could go straight into fighting yourself.

I’m not sure what would be a sensible limit for the textfield in the lower left but I figure there’ll have to be one, or it’ll just keep getting longer and longer. I might let it grow as long as it can, and include a clear button so the player can clear it themselves when it becomes a problem. It occurs to me that I’ll probably have to work something up with the ScrollBar so that it scrolls along with the text being added, since new text will be added bottom first. I want it to read like a book. Heh, maybe one day I’ll try a version with the area on the left and the actions on the right, like the pages of a book. That could be neat.

The upper right TextField will contain a list of sensory data and status ailments. Anything I want to be REALLY CLEAR to the player. I expect players will skim over the location text and I don’t want to have data repeating mindlessly in the action text. All of the action text should be new information. But yeah, stuff like sensory data, if there’s a strange smell in the room I want it to be obvious in a seperate area from the room description, so players don’t skim over it thinking the room is the same. If the player is poisoned or injured, that should be clear as well. Primarily this window will show you the smell, ambient sounds, temperature and humidity, your hunger and thirst, and the time of day.

The lower right TextField window will contain the Menu, which will allow you to open your Inventory or Status screens for detailed information, or perform standard actions not related to the area you’re in, like eating and resting. It’ll also let you save your game, and access options like text font and colour, if I ever get around to implementing that.

I’m not sure yet how I’ll handle the Inventory and Status screens. I’ve got a few different ideas. Since I already have pop-ups in the form of the context menus, I might add pop-up dialogs for the Inventory and Status. Another option would be to put the information all in the Action menu, like any other action. The third option would be to take over the Location and Action windows and turn them into the Status and Inventory screens when the player chooses those options. I think that could either be neat or jarring. I’ll probably start with the first option, and try the others in the future as I get more experimental.

So, with that defined, the next thing is how it’ll progress logically. So, let’s start with the beginning; that’s a logical point.

When you first start, there’ll probably be a main menu I haven’t implemented yet. That’ll have the option of loading a save game or starting a new one. If you click new, you’ll be asked to select a world, ’cause I’m going to make worlds drawn from files. Probably XML files, so people including myself can relatively easily start making TextWorlds before I make a world editor. So, there’ll be a load world function that assembles the objects internally. That’s kind of key, right there.

Hmm… It’s getting hard to think straight now, a couple of old men came in and are having a clear discussion, and it’s interrupting my train of thought like a herd of cattle on the tracks. There’s not much I can do, I don’t think it would even help going to the other side of the cafe. It’s my own fault for not bringing my headphones. Maybe I’ll work more on this later, but for now I’m going to pack up and go home.

Posted March 17, 2012 by Arthur Payne in TextWorld

Tagged with ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.