The State of Things!


Untitled-1

I felt like Crap most of last week. I’d have drawn something better to represent it but I couldn’t be bothered, my old graphics tablet doesn’t work, and I haven’t rearranged my work space to incorporate the new one in my office yet. I’m sure there are a couple of you who might be chuckling away say “oh really. I though this one was better than the one from last week“. Well, you people are a shower of bastards, so there.

My point is, progress has been slower than I’d like, but that has mostly affected me actually making recordings of things to show you it working. I can see fine well that this is breaking the first narrative rule of “Show, don’t tell” , but I don’t care ok? I’ve not been well.  What I do care about is what other people (especially coders) think to criticize or comment about the structure of my character controller. Just in case they think I’ve done something horribly and obviously wrong.

It’s a state machine… well really it’s a state machine with a bunch of sub-state machines. For those of you who hate state machines I guess I’ve already lost you but feel free to advocate for your chosen alternative (as long as it isn’t a bunch of if statements because then I’m out). As I said last week, the basic structure mirrors the animator to some degree…

Person01

Ah bollocks. There’s no zoom function. Screw it. I changed it from last week to make the console usingness into simple sub-state machines of the base layer. This diagram kind of represents what is going on with little jimmy the space bloke above.

CharacterStateMachine

Yeah! I probably could have done it more accurately or at least a little prettier with fewer fruit references, but like I said. I’ve been ill ok. Jeez. You, imaginary reader, have absolutely no empathy. That’s all the fun pictures done now.  I’ll see if I have any in progress gifs lying around for the end. I sure broke it enough putting the state machine in properly.

I willing to accept the perfectly reasonable argument that what I’ve created is complete overkill. I’m fine with that. If I don’t scream, delete everything and run away there is always a change I might reuse the code… said every coder ever before rewriting is completely next time they looked through it. As it stands the character can be controlled and pushed around with physics (I need that for later I think) as long as they aren’t locked onto a console. When they do now use a console, they get data from the console and then move into position to use it.

Encapsulation can get a little fuzzy at points like these. The character stores a reference to the console they are attempting to use, and makes movement and animation decisions based on that decision. He has no clue what the console is actually connected to e.g. the thrusters or the turret. Similarly, the character controller know he has a weapon holstered, and that at some times he is allowed to take it into his hand, and pull the trigger. Currently he knows nothing beyond  that because the weapon handles what the weapon does. The. A.I will eventually need a little more feedback than this, but i have a plan for that one the cards so it doesn’t worry me too much. It’s not going to mess up the encapsulation anyway.

Other little bits are handled by messages sent into a state with the current action, such as “put your stupid gun away before trying to sue a computer you idiot”, where information on timing is taken directly from the animation clip. Speaking of clips… Here is a clip of things not working.

CharControllerFail01a

That’s admittedly barely related but it’s the only one I had to hand. I hadn’t yet figured out that the child position, if not locked to the original can up up just wandering clean away from the actual parent object position.  I’ve also made the mistake of not normalizing the direction from the character to the console he’s using so he just wanders over to it really really slowly. That and other things have or will be fixed soon. the important thing is that the structure is in place now, and the details can be added.  If I’m feeling motivated enough to get my crap together hopefully there will be some more visual results next week. Currently I might just be slowly drifting into oblivion.  You can try the social media thing if think it’s worth your time. TwitterFacebook, and Youtube . Yada, yada, yada. This is probably full of spelling mistakes. Bye for now.

 

Comments are closed.