Tag Archives: textworld

Back to Work

Back to work after a while.

The task list I added previously is helping a lot. I was able to quickly get back to work with only the briefest refresher. I just polished up the generateLocationText function to wrap the text in a font tag to give it a nice format.

Next I’m going to work on the input method for the textworld class that recieves the textEvents from the interface and handles them.

*work work work* Okey dokey, it recieves input and handles it. I’ve got it sending flash traces whenever I click on one of the menu links.

Next I’ve got to make some exit objects and link them to spaces, so that I’ll be able to move my player around the little world I’ve created so far.

I haven’t figured out just how I’ll link a text line with a specific object. I’ve been thinking of using hash tables for each of the item types and including the hash in the text though. Already have a hash table for the spaces so that the exits can find them before making a more solid reference.

Alright, I’ve already got some exits I made before and forgot about.

I’m also considering making it so that in order to create game objects, I have to use methods in the TextWorld object, which will add them to the proper lists when they’re created.

Hmm… It occurs to me that having a single switch statement for all of the possible input just isn’t sensible. I’d have to put in a case for every possible object. I’ll have to use it as a sort of code.


exit51, menuOption, action3

Maybe something like that. For the actions, when you click on an object in the Location text, it’ll put your options for interacting with that object in the action text area. The actions might have to be big compound things, since it needs to include what type of action it is, as well as what the action is happening to.

Well, I’ve made some progress but it looks like it’s starting to rain, and there might be something more serious rolling in. So, I’m going to pack up and head home. I wish I had a better idea where I was headed with this program, I’m usually a lot more clear on how everything will work.

Tagged , , ,

Lots of Lists

I’ve been working for a while but hadn’t written anything in my open text editor for the blog. Didn’t have anything to say, I guess. Now I do.

I’m not sure how I want to handle the list of a space’s contents. I was going to have it be a list of things, but then I realized that thing children would loose their special properties; it would store them all as things, even mobiles, exits, and other spaces.

There’s two ways I could handle this. The first way would be a list with the Dynamic type, which can have members of any type but isn’t perfect across different platforms in HaXe. Or I could have seperate lists for each of the possible child types. That would mean a list of all the contained things, a list of all the contained mobiles, a list of all the contained spaces and a list of all the contained exits. The downside would be that I would have to handle all the lists seperately. That might be good though too. I think I’ll do it that way.

Alright that’s pretty much it. Not much to say this time, I did a bunch of stuff but I’m so sleepy it’s hard to say what. I will say that I added a couple of text files to the project to help keep things organized. One describes the game’s intended logic, and one is a list of tasks for me to do, so I know what I’m working on and what to do next.

Now it’s time for sleep, probably.

Tagged , , ,

TextWorld Coming Along

So the essential game loop of my initial TextWorld will be something like this:

Respond to Player Input by performing the task associated with the link that was clicked.

Run down the list of active mobiles, updating each one

Check if the player’s location has changed, and update the Location text accordingly

Check if the player’s status has changed, and update the Status text accordingly

Add action text based on the player’s input and mobile actions, and bring the action area to the bottom of the scrollbar

Wait for Input

I’m bringing back the timing factor. Each action the player takes will take a certain amount of time, potentially zero if the action doesn’t do anything but open up another menu. Or long enough that an active mobile would be able to interrupt them. There’ll be a list of mobiles to see who goes next based on the time it takes to complete their next action. If they interact with the player, the player is given the option of a response. Likewise for mobile to mobile interactions and player to mobile interactions.

Each of the Update stages will require complex coding, especially for getting the text right. That’ll be the hard part.

I think my first task will be to set up the world tree, the list of space objects and their interconnections, and load that.

Then I’ll have to make the player object, and put it into the space.

Third I’ll have to develop the functions that assemble what the player sees, based on the location of the player object.

Fourth I’ll have to deal with the interaction between the player and the text links, to allow the player to move between spaces and perform actions.

After that I can start making mobs, widgets, and actually making the whole thing a game. But first things first; the world tree.

I’ll need to make a function that loads the world tree, to begin with. Eventually I’d like to have it loaded from an XML file, but for now I’ll do it all in code.

Hmm… I forget so soon, I was going to use a list of spaces rather than a tree of linked spaces. Load all of the spaces into an array or a hashtable, then have the exits lead to particular space numbers, since I couldn’t use direct references.

For now I’m going to make the description for the room all myself, but later I want it to be procedurally generated based on the room contents.

Okay it’s almost time for DnD, time to go be nerdy in a different fashion. Glayven.

Tagged , , ,

Let’s Get These Kids Talking to Eachother

So now that I’ve gotten over that bump from earlier, I still need to actually get this thing working. Right now I’ve got a basic interface set up with feeder text, but in order to have it interface with the TextWorld simulation, I’ve got to handle the link TextEvents it sends.

I’m also somewhat worried that I will be unable to make links appear correctly; that they’ll switch to default style and be unchangable by the font tag.

*tests it* Oh that’s a relief! It’s not underlined, and it’s the right colour. I will be able to carry on.

Right. So, I’ll make an event handler for link events next.

*work work work*

Okay I did a lot of stuff there. I set up a whole system of event transfers between the main object and its two children, the interface and the textworld. The main object carries the information across.

I’ve run into a strange bug though. When I set the location text, it appears where the action text should be, and when I try to set the action text, it says it hasn’t been defined. … ahh, here’s the problem; I didn’t change the names when I copied the code for the location and action texts. It’s a wonder I didn’t have this problem earlier.

*tinker tinker* There we go, now it’s working properly. The basic interface is set up, the rest of the work should be getting the TextWorld object to do its thing. That’ll be for next time though; it’s late and I have a family thing tomorrow, and I need to get some sleep.

Tagged , , ,

Big Problem with NME, Jumping Platforms Again

So, despite going on about my l33tness, there’s some things I can’t or shouldn’t do. It turns out I’ve run into a very severe roadblock with HaXe+NME. Well, HaXe is great, the problem is with NME or specifically nme.text.TextField because you see, it doesn’t mimic all the functionality of flash.text.TextField and specifically it doesn’t have the Stylesheet parameter or any other way to change the colour of individual sections of text within a particular textfield. In otherwords, NME simply won’t work for what I’m doing, and I’m back to square one.

Well, before I was thinking of doing it with JavaScript, and I realized that not everyone has JavaScript, or is JavaScript capable. But everyone can view a PHP page! So, this’ll be the forth platform I’ve jumped to on this project. It’s starting to get a bit ridiculous, but such is life. If PHP doesn’t work out I’ll fall back to JavaScript; it’s an important part of the internet and an important part of advanced HTML5 content, so if you’re blocking it by default you’re going to miss out on a lot anyways.

*work work work* I’m just trying to figure out this neat Aptana IDE I downloaded. It can be an extension of Eclipse, but I downloaded the standalone. It’s interesting. I think I’ve got it just about figured out. I’ve gotta say though, it’s weird when I’m trying to figure out a program and all of the screenshots in the manual are from a mac and I’m running it on a PC. XD

*work work work* Okay I’m feeling comfortable with Aptana now, and the PHP makes sense after reviewing the PHP tutorial at w3schools. Love that site.

Notable problem; PHP has no Objects. I’m used to OOP. I could probably make it all work by using a database to store the data I would normally put in objects.

Frankly I’m still indecisive about everything else. Like Flash. I’m great for coding with AS3; I don’t need to lay about for hours reviewing the syntax and all that. Yeah, it limits the places my textgame can go, but there’s also the fact that they may add the StyleSheet to NME. I already requested it on their forum, and asked for advice in their programming area. No idea if I’ll get any hits there, but it’s something.

Right now I’ve got nothing up, and this is supposed to be my first ‘Give Me Money Plz!’ thing, where I make something you want and you give me money to make more. So, I’m not makin’ any money untill I get something playable. I need to stop screwing around and just MAKE the darn thing.

So, that’s that. Next time, back to Flash, untill NME gets what I need. Then I can translate it all to HaXe like I did with the scrollbars.

Not sure if I’ll keep using the scrollbars; they have issues. We’ll see.

Hungry now, and almost midnight. Break time.

Tagged , , , , , ,

There are Four TextBoxes!

Last time on ElectricSquirrel Z! I converted the scrollbar class from Flash to HaXe, which I can do because I am an elite hacker! Or an l33t haxxor, I guess. Well that might be an exaggeration, but considering how balls crazy this scrollbar system is, I think I have the right to be proud of converting it.

Next step is making four of them in preparation for the display.

*work work work* Well it’s taken a lot but I’ve got a second one up there. Rather than using hard coded positions I thought I’d try percentages, so that things would scale if the resolution was changed. But, I had a lot of issues getting it right.

Still not quite right, though. I’m not terribly satisfied with these scrollbars. Now that I’m actually using them to scroll content, I realize they don’t respond to keyboard input. I can probably add that myself later, but it’s a bit disappointing. The scroll bar itself changes width based on the shape of the area scrolled, also. That’s kind of awkward. I don’t know how easy it’ll be to change that.

Anyways it looks satisfactory for now, so I’ll add the other two.

*work work* Okey dokey that was pretty easy.

Next I want to put some feeder text in there and test how the formatting and event raising works, so I can be sure how to recieve and translate events between the TextWorld system and the interface.

I’ll do that next time, though. I’ve gotten some stuff done, and the weather is getting interesting. I left the windows open at home, so if it starts to rain I want to be there to close everything.

Tagged , ,

New TextWorld Work

It’s been quite a while since I’ve been able to do any work on my projects, and not for lack of trying! I’ve either been caught up in the Unitarian site (which is done and up at http://unitarian.sarnia.com/ ) or preoccupied with something else. Games have been distracting; SWTOR and Anno2070 have been big contenders for my attention. I finally had a big area of time to work yesterday but between the difficulties with Mystery Bunnygirl X and a big argument that left me unable to think of anything else, I didn’t get a thing done.

I’m still reeling from some of that today, but hopefully I’ll be able to get something done.

*work work* Hum… nme.Lib isn’t in the API documentation. Oh wait, here it is! It’s just not given its own section. I thought it was a package, but it’s just a class.

*work work work* I was just thinking, why don’t I make the graphical interface, so I can be sure of what I’ll have to work with when the user clicks on something?

And I started doing that. Then I realized that since I switched to HaXe, I’ll have to re-do the scrolling text area thing I did for Flash!

Well, HaXeNME and Flash work together pretty well, so it shouldn’t be difficult to modify the existing code to HaXe. But, well, just wanted to say that.

*work work work*

Now the internet is down and the sun has reached a position where it’s all up in my screen. Plus I have really bad heartburn, so I’m going to head home before continuing.

*work work work work work*

*work work work work work*

Well that was a heck of a lot of work, but I’ve got the scrollbar working in HaXe now. Quite the illustration on what’s different between the languages!

Anyways now that I’ve got that done, it’s getting close to midnight and I’m pretty drained. It was nice to accomplish something tangible for a change.

Tagged , , ,

TextWorld Progress

Cheese and crackers!

Before I started working earlier tonight, I cleaned up the desktop on my laptop. I’ve been doing stuff all night and now when I turn it on again and see the mostly empty desktop, it’s like a stark white barren plane!

Anyways I’ve settled down from my anxiety and I’m going to take another crack at TextWorld tonight.

*work work work read read read work work work* Alright, I’ve determined that HaXe has a way of refering to functions with variables. It’s just that you have to define the arguments and return type of the function reference when you declare it. As such, all of the action functions will have to take the same parameters.

*work work*

Okay so let’s see… When you click on some highlighted text, how does it determine what goes in the context menu? I was thinking about having the context menus be a property of a thing, but what if some of the options don’t make sense in the context you’re clicking on the thing in?

I’m thinking it’ll run a generate context menu function instead. It’ll look at the situation and give you options of what to do with the thing.

Ohhh… I just had an idea.

What if instead of using context menus, when you click on something in the location text, it puts the description of the thing in the action text, along with options of what you could do. And if you click those and they need more choices, more options could be added to the action text!

It might go something like this:

You are within a deep forest. You see a ball.

Click on ball.

It looks like a blue rubber ball, about twelve centimeters in diameter.
Would you like to do something with the ball?

Click on do something with the ball.

Get the Ball? Touch the Ball? Strike the Ball?

Click on get the ball.

You pick up the ball, and hold it in your hands.

That’s more organic than having dialogs popping up all over, I think. ^.^

Alright. Let’s go over the game loop.

The game has begun, and the world has loaded. The player thing is in the starting space.

Assemble the location text, by checking the player’s position and sight range, and the connecting regions.

Assemble the status text, checking the player’s status and senses and revealing them.

Assemble the action text, appending new entries and if neccesary, removing old entries from the top of the pile.

Wait for player to click a link.

Respond to a link by running the action assigned to it.


That’s basically it, I think. The rest is developing the data classes and breaking down those major tasks into individual steps.

Hmm… The List class doesn’t do direct access. I’ll have to use an Array instead.

Okay, so the first thing I’m going to do is make a class that generates a world. In order to do that I need to flesh out the data classes thing, space, exit, and mobile.

I’ll give a thing properties for length, width, and height, which can be compared to, in order to determine if a given thing is bigger or smaller than the player.

Hmm… The more I do the more there is to do. I’m starting to seriously reconsider my plans for this. While I’d like to do some world simulation, the goal of this project turned away from simulating worlds and towards making money by creating a sort of interactive fiction.

I think maybe I should branch off and make the IF project completely different from the TextWorld project, and make it a much simpler format.

I think I need to take a break and think about that.

Tagged , ,

NME TextWorld

So I haven’t worked on my TextWorld project for a while, but after a week of doing web development for a local unitarian congregation, I dropped the beat on the A-Life and decided to pick up the Text again.

From what I learned in the A-Life project, NME seems like the ideal target for my Text Game too. I can pump it out for Flash, HTML5, and a bunch of other platforms. Of course, that’s just the front end. First I’ve gotta make the backend.

I brought over the data classes I made before and put them into a new NME project. Now that I’m using NME I don’t have to keep the interface and logic seperate, though I’m wondering if I should.

The plan before was to have the TextWorld object reveal certain properties which would contain the text for the four regions of the game board. Then I started thinking about how to do the context menus. I could probably reveal a list of strings with the context menu htmlformatted triggers inside. Then the interface would format those into floating boxes of links. When the links are pressed, they release a text event, which the interface passes back to the textworld, to find out what to do.

I still haven’t perfected the actions system. I’m thinking I’ll make a class that’s nothing but action functions. If you wanted to get a pie that was sitting on the floor, you’d click on the pie link in the room text, that would tell the textworld you clicked on the pie, and the textworld would generate a context menu for the pie. The links would be tied to either further context menus or actions. If you click the get action, the get function will take the getter and the object as arguments and attempt to move the pie to the player’s inventory.

*work work work* Hang on, what’s this? There’s no function class in HaXe? Hmm… Looks like there is a way to do it, using dynamic functions, but the syntax is different. Hmm… I’m not sure what to do with this. I suppose instead of using a direct function reference, I could call the function from a switch based on input. Kind of a funny way to do it.

Anyways all of this is spiking my anxiety, so I’m going to take a break. I swear, the more I work on this the more I think I should just drop all the pretenses and make a basic TextGame, and build up from that.

Tagged , , ,

Giving HaXe a Try

So, now that I’ve decided to give HaXe a go, I’m going to start out targeting Flash. I’m familiar with Flash and comfortable with it. I’ll keep anything platform-specific seperate from the workings of the game in general. Then, I can write interfaces on top of the inner workings.

One thing that’ll be difficult is handling the input. When someone clicks on coloured text, a context menu should pop up. So, I’ll have to have the interface send what the user clicks on, and the game underneath come up with data to populate the context menus.

*work work work* Huh, for some reason I can’t compile a project that is in a package. No matter if I do it from FlashDevelop or by command line. I wonder why? It says I’ve got an invalid name, but that seems to only matter when it’s the package.class format. It’s like, no you can’t put package. in there! That’s invalid! That’s the way FlashDevelop tries to do it by default, though, and it seems to be the right way, so it’s perplexing as to why it’s not working.

Oh, finally, in someplace unrelated to the Object Oriented documentation, it says that package names should start with lower case letters. *test* Ahh yeah that did it. Geez.

*reads the entire HaXe Language Reference* Okay I think I’m ready to actually program something with this.

Now I’m getting kind of frustrated by trying to reach out in so many directions and not actually producing something I can play, so I’m going to start by making something a lot simpler. I’ll make something more like a classic room-based text game. Each room will have a description, plus a list of things in the room, and a list of exits. The exits will have a transparency flag; if they’re transparent then the player can see the next room without going there. I’ll just make it one level deep so I don’t have to worry about line of sight across several rooms/exits.

*hours pass* Well hours passed where I was hanging with friends online and I forgot to post my progress, and since it’s effectively still the same day I’m going to continue with this same blog entry.

Right now I’m wondering what’s the difference between an array and a list in HaXe. It seems to suggest that the list type is a linked list, while the array is a classic array, but it’s not clear. A linked list would probably be best for abstract objects like the rooms.

*work work work* Okay I made a few data classes and some function prototypes. I’m too tired to do any more now though, so I’m going to call it a night. Maybe I’ll work some more tomorrow.

Tagged , ,