How the states system can help you. Read here.

So I see some bias against the state system, and that it’s pointless, that is not the case, here’s why.

-A wiki article posted on Blendernation has shown that the Yo-Frankie developers used states in a big way, if you read the article you’ll see how many states they used which is more then what most game developers here may use for themselves.

-States make toggling on and off when pressing a key real easy, I used this in a mini-golf to make the aiming widget togglable. In fact whole logic systems can be toggled on and off theoretically, which can be easier and cleaner then the old method using properties.

-THIS IS A BIG ONE: Being able to manually set something like a tic. rate for logic for individual objects, or even just a few bricks. You do this by setting a property and when it gets to a certain value switches to another state. The first state is just the property counting up and simple checking to see if it’s at the required value. The second state is where all the logic takes place, puts the property back at 0 and immediately switches to the first state. Using this you can cause decent to sizable speedups by having the computationally expensive logic only be executed once every N number of frames. Say you have a logic system that’s expensive on CPU, if you don’t need it every frame, you can use states to only have it executed once every 10 frames for example. The rest of the time will see it de-activated, so you don’t waste framerate doing it every frame.

So states have uses. Find uses for them, you may be surprised.:slight_smile:

CD you gave me an idea I am going to redo MMPH’s AI tut using states for the different node path ways.

states are really useful for ia and complex behaviors, you can even make a “sleep” state with just a sensor (ray, near, message) and a state actuator to change to the active state(s)

also to have one character “handler” object that can do completely different stuff depending on the states that are enabled. In my case i use states to switch keyboard-mouse, joystick and automatic controls. also to change some stuff when its underwater. and its pretty easy to expand, i just switch states with some python scripts. (for example i put an init script in state 1 to read a config file and activate the corresponding control scheme and other things when the game starts)