Tag Archives: nme

The Sandbox

Okay work time is time for work.

Gonna make the background into a bunch of 16×16 squares instead of 32×32, and give them simple colours…

Huh, interesting, I had thought that shrinking them wouldn’t make a big difference since the graphics are simpler and it’s just re-using two bitmap stamps over and over, but the FPS with nothing in the scene has dropped by five. Well, that’s partly ’cause my laptop isn’t very good, but I also realized that the grid is also being used for collision tests, so there is more overhead than I had thought at first.

I’ll leave it like this for now, though there shouldn’t be many collisions with the tilemap outside of the border, so maybe I’ll switch it with something else later.

Now, I’m going to add in arrow key control for the viewpoint, since I can only see part of the scene right now.

*work work work* Okay, now I can move my viewpoint about the scene as I please.

Now for the logic of life, I think.

The plants will spawn at a very small size and slowly be scaled up as their food value increases, simulating photosynthesis. At this stage, they’ll be static things. I’ll sprinkle them in randomly, and they’ll grow slowly over time.

The animals will just be herbivores for now. I’m not sure if I should code in senses at this stage; should they be omnicient and automatically head towards the best plant, or use senses to try to find a plant that is big enough to eat while wandering around pseudo-randomly?

Now that I think about it, I don’t really know much about how microbes do their stuff. Do they have senses? Do they just squiggle around pseudo-randomly untill they blunder into success or failure? Let’s look it up…

*looks it up*

Huh, well it looks like microbes are like bears; they can smell you from SO FAR AWAY!!!! Or at least, relative to scale. They have incredibly powerful senses and can detect something like a sugar molecule from pretty far away, if I’m understanding this article right. http://biosingularity.com/2006/06/04/how-bacteria-sense-their-environments/

So for my simulation it might actually make sense to have the little animals be omnicient at this stage. Of course, I’m not coding this to simulate microbes, so maybe I should just knuckle down and do the senses now.

For now I’m thinking that they’ll drop an invisible ‘area of effect’ entity that will pass its collisions back to the parent. If it detects a food source, it’ll head towards it and chow down. Otherwise it’ll wiggle around pseudo-randomly. Eventually I’d like to use different AoEs for sight, sound, and smell. Hopefully it won’t bog down the simulation too much, but figuring out stuff like that is part of why I’m doing this.

It’s noon now, so I think I’m done for the day. Next time I’ll have to try and code the plants.

Tagged , , ,

Plants and Animals

So here I am, at the cafe again. It’s been a while; this last month has been terrible for me overall.

I’ve decided to push the textworld project to the back burner. I kept changing my goals on that project and ultimately realized I wasn’t working towards any of them anymore. Instead I’m going to focus on my artificial life experiments for a while, in preparation for my return to college this fall.

As before, I intend to do these a-life experiments using HaXe and HaxePunk, but those various libraries were updated even while I was using them, so I’m going to have to start by updating all my libraries.

*work work work* Well that took an hour. Ahh well life goes on, and now my libraries are all updatified.

Hmm… Now that I’ve opened all the references, I’m feeling really anxious and somewhat disturbed. I think I’ll have to take it slowly and refresh myself on the workings of HaxePunk.

*work work work* Okay after some difficulty I am successfully back where I left off before, and prepared to make a HaxePunk app thingy.

The first thing I’ll do is the most basic sort of a-life. I’ll make little green circles to be ‘plants’ and have them grow slowly, and little blue triangles to be ‘herbivores’ that will seek out the plants for food. I’ll make the herbivores reproduce asexually for now, when they have enough food, and die if they starve. I might have them die of old age later.

First things first. Gotta set up the ‘world’. This’ll be a bordered box for the critters to live in.

Anxiety is peaking really hard right now. Really want to run home and hide, but such is life. I’m staying.

Made a world, working on Plant and Animal entities to populate it…

Okay I’ve got some of the basics set up. But, I still need to make a bounded space in the World, right now I think it goes on forever.

*work work work* Alright I’ve put in a temporary field for my sandbox, it’s basically the box I made for my last HaxePunk experiment, with the zelda style tiles. I’ll probably switch it out with just a black outline later, and make it bigger. For now, I’m out of time. I have work to do today, and it’s finally almost 9:30.

Tagged , , ,

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 , , ,

HaXe+NME is Back On!

Finally got a reply on the NME forums; someone suggested I might be able to use the font tag to do what I wanted. I’m so used to CSS, it hadn’t occured to me that the font tag could be used that way. I’m going to give it a try right now.

*try try try* I hit a bit of an issue but I managed to fix it; I didn’t realize I was setting the colour of the text after writing to the text property, overwriting the colours changed by the font tag. It looks like HaXe+NME is back on!

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 , , , , , ,

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 , ,