Tag Archives: as3

What is a Thing?

And now I begin to actually make the base classes I described in the last post.


Hmm, it’s an interesting point that, being objects composed of text rather than images, it doesn’t make sense to make room and thing as inheritors of sprite. Rather, I suppose I’ll make them inheritors of object. I suppose I could make them inheritors of string, though. I wonder what the string class looks like inside. I’ll look that up now…

Hmm, no, the objects will contain strings, but they aren’t strings or some kind of super-string with new features. They’ll probably have many strings, too, so it’s not sensible to make them inheritors of String. I’ll just make them inheritors of Object. String is an inheritor of object…

Of course, thing is an inheritor of object. Honestly I wonder if I shouldn’t make room an inheritor of thing. Thing is the base class of my little universe. A room contains things, but it could itself be a thing, with a location inside a greater thing. Though, I had intended to have exits be locations that bridge rooms. Of course, I already intended things to be able to contain things. In my little screen test, I had a fire mobile in a fireplace location.

Hmm… Speaking from the perspective of practicality, an exit from the interior of a room and an exit into a room will have different descriptions, and there may be more than one exit from an exterior space into a smaller interior space, like a building with a front door and a back door.

But the idea of a room as a thing has caught me. In this way, the great outdoors room can contain rooms that represent individual regions of the world which contain rooms that represent tiny portions of the world which represent buildings which contain individual rooms which contain containers like boxes and tables which contain containers like jars and sacks which contain things!

A maybe instead of room I should call it space. XD

So there’ll be the thing object, which represents static objects in the world, and is also the base class of everything in the world. It’ll have a link to the space it’s inside, it’s dimensions, position, orientation, material, and mass. I won’t be doing real time physics so I can leave out velocity and acceleration.

So what does every object need, at the very least? Well, it’ll need a quick description for when it’s listed in the description of a room, and a detailed description for when you look at it closely. It’ll need a context menu, since everything is going to have a context menu. Which reminds me, I’ll have to make a context menu class. Add that to the list above.

I don’t think a thing will need a list of its contents; I’ll make it so that only a space can contain other things. A container like a bag will be a very small space, and you can’t enter it because you’re too big.

I do think a thing will need a behavior object. Or a link to one anyways, there doesn’t have to actually be one. The behavior will determine how you can interact with it. That kind of makes a lot of fuzziness between a Thing and a Mobile though. Mobiles can move on their own, but that’s just their behavior. Anyways the idea is that each turn, all the objects (or at least, all of the significant and local objects) will run their behavior script, and act as it requires. This allows me to divorce behavior from the physical definition of the object. A thing could be a tool, and when you use the tool it does things. That kind of interaction is sent from the contextMenu to the behavior object. Well, the behavior object will probably be a function object. I’ll probably have a whole mess of functions inside of one big behavior class, and when I assign a behavior I’ll link to one of the functions of the behavior class.

I guess the biggest difference between a thing and a mobile will be the intent, and the colour of the name as it appears on your screen. A thing will be blue, and a mobile either red or yellow, depending on if it’s dangerous or not. Hmm, traps could be dangerous, but they’re definately not mobile. Shoot. This is getting difficult. Maybe I should just make all the things mobiles. Oh! I know. Mobiles have an inventory, which is somewhat different than containing objects, since you’re merely carrying/wearing them. Also mobiles have stats, which aren’t covered by behaviors. Like strength, and agility. A tool or weapon wouldn’t have stats, it has physical properties. I can use a weapon’s mass and a character’s strength to determine the damage. But, they will need additional physical properties. Durability to quantify how intact something is. As well as flags like Sharp and Pointy. I’ll have to come up with the flags as I do development. For now it’ll just have to suffice that there will be flags.

So far:

inside – A link to the space it’s inside
location – a link to the location it’s nearest to
dimensions – l,w,h
position – x,y,z
orientation – xa,ya,za
material – refernce to material enumeration, like wood, stone, plastic
mass – the mass in grams
durability – intactness/health
properties – reference to property enumeration, like sharp, pointy, dull, rusty
shortdesc – short description of the thing for use in the basic space description
longdesc – detailed description including properties of the object
behavior – a link to a behavior function run every turn

Alright! I think that will sufficiently define a thing for my text world. I’ll have to encode that later, it’s getting late and I’m a bit worn out. I should probably set up the interface first anyways, I still need to make the textArea class with its scroll bar. Once I get the thing done, I’ll have to figure out what the subclasses will need in addition to those properties.

Things are starting to get interesting. <3

Tagged , , ,

The Continuing Experiment

Text Format 1

This is the first format I put together. It has three paragraphs in the main text area to the left, and some text based command buttons on the right. I figure it would replace the whole three paragraphs each time the player did something, so each turn it would be fresh text with no history. The trouble there is that little changes might be easy to miss. I expect that’ll be a problem for all the formats though.

This format would be particularly good for long storylike actions with little player input. Then it would be more like a choose your own adventure rather than a world represented in text. I like this format but I don’t think it’s the right one for this project.

Text Format 2

This is the second text format I’ve tried. It’s a lot more complex than the previous one. I did it up in Flash. It’s made of four textField objects. The two on the left are wider than the ones on the right. In the upper right you’ve got your location, and the static objects. In the upper left you’ve got your senses, feelings, and condition, as well as the time of day. The bottom right has the command menu.

The bottom left is where the action is. It tells you the active elements of the area, and what they’re doing, and where they are. I populated it with a bunch of actions, but I don’t like the way it looks repeating the list of the active elements like that. Also it’s apparent that I’ll have to implement my own scrollbar. I’m kind of surprised that it isn’t built in, but if it was it would probably be ugly anyways. I’m thinking I’ll put the list of active elements back in the upper left area, but then it’ll have to do something to let the player know it’s changed, since their focus will be on the lower left portion of the screen.

A couple of ideas I’ve got are having a box ‘explode’ away from the text as an eyecatch when it changes, and having it erase and slowly re-write, making it clear something is happening by animation. The latter one would be like an old RPG’s text boxes, slowly populating with text as it happens. I’m thinking of doing that with the action area too, to make it feel more like it’s happening as it happens, rather than having the player read over it at their leisure. Then I can work in bold text and special effects, like WHAM! and POW!

I had considered putting lines in to seperate the different sections of the description, but I kind of like it this way. Without the clear boundaries, everything sort of flows together like it’s all part of the same document. One of my biggest problems with some interactive fiction I’ve tried is how intrusive and ugly the sectioning is, seperating elements harshly. Here they’re all together, seperated only by a little blank space.

One more thing I’m considering is giving every mobile it’s own colour for its name. I’m not sure that’s a good idea, though. Right now I’ve got red for dangerous mobiles and objects and yellow for other mobiles, blue for objects and green for locations. Maybe I should stick with that. If mobiles each have their own colour, it might be good for identifying them without reading, but it would be confusing what they’re about. Of course, the text should always say if they’re being aggressive, but some things like that fire are dangerous without being aggressive.

Also, I only coloured a few instances of the names of objects here, but I’m thinking of doing it every time an object is referenced, and having every reference be usable for the context menu. I’ve even considered putting the basic commands menu under the context for You. That would mean I could really minimize the interface and, with that first one, just have the three paragraphs. But, I don’t want to have to re-do text constantly. In text games the most common command is look, just so you don’t have to scroll up to find the room description again. Plus, it could get really annoying having to click on “You” every time you want to use a common command.

Text Format 03

In this version I moved the local active objects to the top portion, which really cleans up the action area, but it only shows your current awareness, like Hank’s name.

I like it so far. I’d like to do a comparison with titles for the different sections, but I’m getting awfully tired, so I’m going to log off and take a nap. Tell me what you think so far!

Tagged , , ,

Formatting Examples

I’m working on some formatting examples right now. I chose and interesting palette for my tests and after some consideration I decided to do the tests in Flash itself, instead of an image editor.

It seemed like the easiest thing to do would be to use Flash’s built in HTML and CSS to do the text formatting, but to my surprise the HTML and CSS implementations in Flash are very basic and feature light. Well, I’m going to try it anyways.

*work work work work work*

Well I’ve done a lot of work and I have some interesting results. But I’m also having an interesting bug. I’ve got two TextField objects in a Sprite on the Stage, and the second TextField object refuses to use the stylesheet. Even when I stop the first TextField from using the stylesheet and asign it directly to the second TextField, it won’t use it. I don’t know what’s up with that. o.o;;

Huh, it works if I put the second one all in a paragraph tag.

Oh well anyways I’m out of time. I’d like to put up a screenshot of what I’ve got so far but the library is closing. I’ll try to have something to show next time.

Tagged , , ,

Formatting the Text Layout

Alright, so the idea is to make a text-based world. What is that? What does it require?

I suppose first I need to decide what it’ll look like. One option would be to make it like this…

You are within a deep forest. There are thick walls of trees to the east and west. There is a blue ball here. A trail leads north and south.


That’s kind of traditional, isn’t it? You type in a command. It wouldn’t be difficult to make the coloured text into links. Hell, since I’m doing this in flash it wouldn’t be difficult to encode the whole thing in html. For that matter I could probably do it all as JavaScript, but I’ll save stuff like that for the future.

One problem with the traditional format is that it doesn’t give you all your options clearly. You’d usually have to use the help command to figure out what all the commands are. I’d like to have options like that clearly displayed on the screen, ready to be clicked. Perhaps you could click or type, at your preference. I want things to be convenient. It’s common to use just one character to operate a command, and annoying when you enter a room and a command is overridden by a local object, or a local object is unexpectedly overwritten by a command you forget about. It’d be nice to incorporate auto-complete, so you know what command you’re putting in like that.

I’m already having a bit of scope creep though, thinking about autocomplete. I should start out with the basics. Rendering a few connected rooms, inside a building, which is insides a closed outside area. Maybe a country Inn. That’s always a great setting.

Another thing I’ve considered using is context menus. When you click on the Blue Ball in my earlier example, what do you do with it? Do you pick it up? Do you kick it? Do you place it on the altar of Grendaline?

When I consider that, I wonder if I should even include the text entry. After all, there’s little to do with it besides guessing at things you can do and having the game say ‘I’m sorry, I don’t know what you mean.’

I want the player to be interacting primarily with the text they’re supposed to be reading, so clicking on it could be a good way of doing that, and using context menus can be good for that. I’ve seen interactive fiction that uses context menus before but it’s been rather horrendously styled, in basic Windows format boxes. Very coarse. One of the things about reading, as with writing, is that you want a very plain interface for the reader to project their imagination on. You don’t want them focused on a dozen widgets and gadgets. I remember some time back, a group of my friends were all excited about a handy web app for writing with no distractions, and a minimum of features. Imagination can be hindered by too much visual noise.

Another thing I’m considering is breaking up the information into seperate sections. This might go against what I was just saying, but I think it’s worth consideration. This would take the D&D approach of having character sheets and reference manuals in front of you; you still have great imagination in that situation.

I’m thinking maybe I could have one area with a text description of the location you’re in, and one with sensual data like smells, moisture, gut feelings, that sort of thing, and another with significant objects and mobiles in the room, along with their positions. I’m not entirely sure how I want to do that.

One way to display the sections would be to put them in seperate quarters of the screen, and filling the extra quarter with hard data and interface stuff like common actions.

Another way I’m thinking of would put the interface and common actions in a thin collumn on the right, with the different text segments rendered into seperate paragraphs. That way it would be clear the first paragraph describes your location, and the second your senses, and the third what is important. It might be good to combine the second and third paragraphs. That’s a thought.

In addition to positioning the information, I wonder about scrolling. Some text games have only one information set on screen at a time, explaining what’s going on at that exact moment. Others will re-write everything as you perform actions, keeping a record of all your actions and everything that happened since you started the game. They both have their flaws and features. I have a personal preference for keeping the information from scrolling. For one thing, it’s easy to lose your place reading when the text scrolls up. On the other hand, if the text disappears when you act again it’s easy to miss something when you push the wrong button. One thing I’ve considered is combining the two, in the multi-pane format. The location only shows you where you are, and not where you’ve been. But at the bottom of the screen there is a record of your actions and interactions, with the important features of the space.

There’s a lot of options for how to format the text display of a world. I would like to experiment with several, to see what works out the best.

I have an appointment in a half hour, but after that I’m thinking of going to the library and putting together some graphical ideas for formatting the text output. Look forward to it!

Tagged , , ,

Tile Matching Game

For the last two years I’ve been working on a simple Tile Matching Game in Flash and ActionScript 3. At present the game is functionally complete, and I am only waiting for the comissioned art and sound resources to be completed so that I can integrate them into the finished product.

I started this project with one primary goal, to create a finished and polished game, and not work on any other projects untill it’s finished. Starting out, the projet seemed simple. Looking back, it still seems simple. I don’t understand how it’s taken me two years to create. I have learned quite a lot though. Perhaps if I were to do it all again, it would go much faster.

As soon as I get the new resources, I’ll integrate them into the game and start the final phases of testing, to make sure everything is still working. I look forward to sharing my finished work with you all.

Tagged , ,