What’s an Action, Anyways?

So it’s been a while since I worked on the TextWorld project; I got tied up in other things for a bit. Last time I put together a sort of solution for the room filling problem. The other night it occured to me that when I started this, my intention was to experiment, including some experiments combining visual elements with my text. In particular, something like roguelike tiles. If I did that, then the dynamics of space would change quite dramatically. Well, that’s something to deal with in the future; to start with I want to get this version of TextWorld actually operating.

One thing that’s been bothering me as I go about this is that Thing and it’s children are basically data classes, and the TextWorld object will be doing the work. So I’m not sure how much data checking to put into the data classes. Like the issue with the size; should that be determined by the Space or should it be up to the TextWorld how to deal with the space, while the space object only defines the properties? One thing I didn’t do when I did the volume checking solution was check if the space’s dimensions should modify, if it’s deformable. Again, should that be done by the data class, or by the functional object?

Ahh, that reminds me, another thing I intended to do after my Tile Matching Game was finished was to study Object Oriented Design Patterns. I’ve just been coding haphazardly.

Huh, there’s a convenient page all about them right here. http://www.oodesign.com/

*think think think think think*

Yeah, the more I think about it, the more I realize that while data format checking is okay, like my percentage and degree checkers, the Space class itself should not be determining if something can be added to its contents. I’ll remove that check from the class and just let any Thing add itself to the contents.

Hmm… That said, nothing should be in two places at once, so I’ll keep the code that removes a thing from it’s previous space.

Hmm… I wonder if I should do it that way…

I could have an interface class, which displays the actual data, a TextWorld class, which assembles and manipulates the data, and a series of data classes. That sounds like a good way to do it. Internally, the ContextMenus will just be a list of links to actions. How the Context Menus are actually displayed will be determined by the interface.

*read read read* Oh I like where it calls something I made up on my own the “Expert Solution”.

Anyways I’m not sure this is helping that much, since it seems to expect a certain level of familiarity to begin with.

So getting back to actually doing something, since I’m just making these into data classes, I’ll run through the other two relatively quick, but I’ll have a lot of other stuff to roll over.

Actually it might be a good idea to take a moment and go over what I need again.

MainInterface – The Visual Interface, with its four quarters and context menus
TextWorld – The world simulation, which contains the space tree and manages the interaction of the objects therein.
Thing – A physical thing in the world
->Space – A bounded region of space in the world, which may contain Things, and is itself a Thing
->Mobile – A Thing which potentially moves under its own power and has a statline and inventory
->Exit – A Thing which joins two Spaces
ContextMenu – A list of Actions which can be taken with regard to a Thing
Behavior – A collection of functions which are called when a Thing’s turn comes up, determining it’s next Action

I’m thinking about doing an Actions class which defines all the possible actions in the world. Actions like Get, Drop, Approach, Attack, that sort of thing. A ContextMenu would be a list of links to Actions. Both the user, and other entities in the world, would interact via Actions. The tricky thing is custom actions.

I want people to be able to extend the world without changing the code, including myself. So, I need to be able to load actions the same way I’ll load objects and spaces when I’m loading a world.

Hang on, I’ve been at this for like two and a half hours. I’d better take a break. Normally I’d pack up and head to the library, but they’re closed for good friday. I’d kind of like to switch to one of the cushy chairs for a while, but I’m afraid I’d miss out on my plug. Maybe if I moved to the far end where those guys aren’t sitting… I’ll give it a go.

*takes a break*

Heh, I wonder how much of a break it is if I have my headphones on the whole time, my ears need a break too. ^.^;;

Alright so before I continue to make these classes I think I should figure out how I want the actions to work. How can I define an action in a way that they can do whatever the writer wants without having to make new code? I suppose it would be a script made up of built in possible actions.

So, there will be standard actions and user defined actions which are made up of a set of simple actions performed together to make more actions.

Hmm… I could make an Action class which represents a specific action, and BaseActions which contains all of the possible things an action can do. An Action would be a combination of those things.

Hmm… That break didn’t seem to help much. I’m feeling kind of hyper and yet reluctant to move. I kind of want to have lunch, and I kind of want to have Grilled Cheese sandwiches, but for that I’d have to go home, and I’m not sure I could come back afterwards.

Hmm… I think I’ll do it. I’ll go home and make Grilled Cheese sandwiches, and if I don’t come back here, I’ll at least try to write out some ideas for actions. Once I have a better idea how they’ll work, it’ll be easier to put together the Mobile class.

Tagged , , ,

Leave a Reply

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