Standard variables...

Miscellaneous Forums/General Discussion/Standard variables...

Well, as I mentioned in another post, I'm writing a modular behavior system. The basic idea is that you code behaviors separate from the objects that contain them, and then simply attach a behavior or behaviors to said object and the behaviors then affect that object.

What I need is a list of common variables that sprites, backgrounds, and other various game entities might contain. I'd like to standardize their names so that when I release this system, others writing behaviors can use the same names which will make the code essentially "copy + paste" and it'll work in your own project.

So, here's a starter list. You don't need to list the type of the variable, as the system is flexible enough to handle any variable type, although when the variable should be a specific type that may not be clear by it's name alone, please list it (as I have done for the Children variable below, for example, stating that it would be a list of children.)

Parent
Children - (a list of children)
Behaviors - (a list of all behaviors owned by the object)
XPos
YPos
ZPos
XVel - velocities, should Pixels per second be standard?
YVel
ZVel
Alpha
ColorRed
ColorGreen
ColorBlue
Midhandle - boolean
ImageHandleX
ImageHandleY -
ScaleX
ScaleY
Rotation
Layer - the current layer of the object
CollisionLayers - a list of collision layers
BlendMode
DefaultChildSpawnX - the X location relative to the upper left corner of the image where a child will be created, if no other position is specified
DefaultChildSpawnY - as above, but Y position

please, toss out any ideas for variables that you could see being useful for sprites or any other game entities. Note that due to the way this system is being coded, not every object will need to have all of the variables listed above or the variables suggested. Each object will only have the variables it needs, and yet, due to the way this will work (which I can't fully disclose yet) you will still be able to "plug and play" with the different behaviors.

Anyways, suggestions please. Anything you can think of at this point. Just consider this a brainstorming session.

Odor. Yes, it matters.

I tend to have a status variable which can be one of a few states (e.g. sleeping/awake/dying/dead). Like objects are sleeping until the player nears them (e.g. in a platform game when the object is just off screen). Once close enough they are awake and behave as normal. If the player moves too far away they revert to sleeping. I found this helpful for keeping enemies in the right place at the right time (as well as saving on processing time)

Also animation direction/frame/timer/interval variables

Thanks for the suggestions Chris.

Well, I'll post more as I get them, and as the system takes more shape. I really hope this system gains some ground amongst blitzers as the modularity of it, and the truly plug'n'play nature of the modules would make all of our jobs easier. Right now there is a small performance and memory sacrifice for each LogicObject in the system, but I don't think it will be enough to affect any but the most demanding of games - i.e. casual games shouldn't suffer at all.