Less Methods than Anticipated   Leave a comment

So I’ve got my properties declared and my getters and setters set up; most of them are kind of superfluous but I figure it’s better to have them and not need them than to need them and not have them.

I still have to formally decide on my standard methods and such, though, don’t I? What things must every Thing be able to do? Well, figuring that out was the point of the post two posts ago, so let’s look at that and see.

The formatting and such will be done by the TextWorld object. It’ll take the data from the Thing and use it to assemble the description. So, I don’t need any fancy formatting methods.

Hmm… Actually it seems like most of the action comes in Thing’s children. There’s not much for it to do but be a storehouse of information, so the getters and setters should be pretty much ‘enough’. Even with the context menu, the TextWorld class will just say ‘Hey what’s your ContextMenu?’ and it’ll be there, no need for methods.

Even the behavior is only checked every moment, and the TextWorld will put all the things into a queue in order of action, a ‘who goes next’ sort of thing. Anything without a Behavior goes to the back of the list, untill something acts on it and it gets a Behavior.

This is weird, I was sure that the Thing would have a bunch of methods but it seems like I was wrong. I guess I’ll move on to making the Space class. I know that’ll have a lot of methods, ’cause it’s got to determine if this or that thing will fit inside of it or not.

*work work work* It’s tough to decide when to do data checking. With a Space which has both outside and inside dimensions, what happens if the inside won’t fit into the outside? I intend to put the data checking in the function that actually modifies them. Ultimately it doesn’t REALLY matter, since nothing should be broken programatically if something is bigger on the inside. It might even be neccesary for a high fantasy game, or a Dr. Who rip.

One thing I’ve been thinking about is using a simplified cheat for figuring out if something can fit into an object. To start with, I’ll see if there’s enough room based on volume compared to the volume of the space minus the volume of the objects already in the space. If there is, then I’ll check if it would fit in any orientation. If it would, then I’ll let it fit into the space. This would mean that potentially there could be two things in the same space that could only fit if they intersected. It’d be a lot easier to code, though. I haven’t decided for sure though. The good thing is that if I decided to upgrade it later that should be possible. I already don’t plan on having the simulation do anything weird if a user puts a Thing in a Space that couldn’t fit; it just won’t be able to move into that space from outside. If it’s already a part of that space, it’ll be okay. I think that’s important since there will likely be Things that are in a room like the walls and windows that are embedded into the edges of the space and thus be bigger than them.

Well it looks like I’m out of time; it’s getting kind of uncomfortable in the cafe with the lights dimmed and the coffee table off the floor so they can clean under it. I figure they’ll close in under 20 minutes.

Posted March 24, 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.