Thursday, May 3, 2012

tactic logics

I've been doing no training, had a long spell with no one to fight with, haven't even done much thinking about tactics. Which is all bad for me. However, I have been learning some game programming, which is nice because I've been able to use some of the mathematics and physics from my supernerd background. I used a transformation matrix to solve an actual problem! woo!

and but then, I learned some things that sort of apply. so here we go.

I've played a lot of computer games, and I like them, but almost all games handle melee combat in a way that doesn't reflect any of complications and tactics I know. At best, you can hit, block, grab, and move, and those options tend to function in a rock-paper-scissors kind of way. Hit slow or fast, strong or weak, etc etc. It can represent tactics on a sort of metaphor level, but it never really feels right to my sensibilities.

Part of this is due to the definite nature of computers. but it's also do the modelling of controls, which can get very complicated. at the basic level, you have this

READY
HIT

as in, you're standing there, or you're hitting. Something, or nothing. So the first improvement I learned about is a finite state engine.

READY [transition> HIT

You're still just ready or hitting, but there's a instant phase of logic and calculations that determine if you can hit, how you hit, if other things happen. Better! but still not right. I want at least a preparation phase.

READY -transition-> PREPARATION -transition-> HIT

so that's a bit better- allows for the possibility of counterattacks and reaction time, but... it still doesn't feel right. I could add more states, but that would just turn into complication, and it'd feel like I was making places where there weren't really places, if that makes sense. and from a game programming standpoint, it becomes totally unmanageable.

enter fuzzy logic. I discounted fuzzy logic for a long time, because logic is binary, and you can never get it to be actually fuzzy. and... I still think that. "fuzzy logic" is a lousy name for a useful way of thinking. so before, if we were looking our fighter, it would be like
FIGHTER STATE: ready or FIGHTER STATE: preparation. The fighter could only be one thing at a time in terms of the responses and possibilities, 0 or 1. What fuzzy logic is about is assigning values from zero to one to various conditions and then assessing the state in response.
so now:



the blue indicates READY, the red PREPARATION. so there's a ready state, but then there's a mixed zone that you can assess. you're .8 ready, and .2 preparing. This starts to make sense to me- interpreted as mentally preparing an attack, but not having compromised any physical readiness. The opponent can maybe see it as a change of expression, or a slight change in tension, or any of the other tiny clues. Then it moves on into pure preparation- definitely reconfiguring to attack, but not there yet. And then gradations of attack- the overlap would be where the attack has started and is going to happen, but there is still an opportunity to change targets, or attempt to prepare to stop the attack short, or to make it longer. And then another gradation after that, where the attack has mostly finished, and recovery is starting. etc etc.

and the values never have to go away entirely. for example:
attacking= .8
retreating=.2

if you assess their state, you can say "yep, they're definitely attacking. but they're also shying away and trying to avoid getting hit." which is definitely something you see a lot of.and it doesn't have to be limited to two values, there can be many, and you can set whatever cutoff levels you'd like to determine what is going on, and still assess to one current state, but have references and degrees of many others.