States and Switches

This week I spent some time learning more about switch systems. I used this time to create a animation system based on switches for a sidescrolling PVP fighting game. The states consisted of walking, jumping, attacking and idling. Each state was used to play certain animations and certain states gave other specific behaviors. However, it took me a long while to get this functioning properly. However, this was mostly due to my inadequate understanding of the animation systems in unity, rather than my inability with the switch system. I will need to use a switch system for my next project. The enemies within this project need to have a simplistic pseudo AI based around a switch system. I plan on having an idle state, an attack state and a state where the enemy runs from the player. However, I am unsure how to determine when to call the ‘flee’ state or what the behaviours of this state should be. I feel there should be something to do with the threat levels of the enemy, so that they run if they are in danger. But determining this seems to be the hard part. I should probably be something to do with health levels but i feel that this would make it difficult to trigger the flee state. I could also check for a player’s ‘kill streak’ so that the enemies will run if the player kills more than a certain amount of enemies at once. This would be easier for the player to notice when the enemies run. But where should the enemies run to? This is something that would be very difficult to define because of the way the navmesh in unity functions. I feel that it should pick a point a certain distance away from the player and then make the enemy go to it. But this would cause the enemy to try and run past the player and could make the enemy want to run outside the map. A better way to do this would be to make the enemies run back to one of the spawn points, keeping the enemies destination within the map but still causing the occasional event where enemies run past the player. Then they could switch back to the attack state after a certain amount of time. This would be a good solution for my pseudo enemy AI, I just hope I have the skill to implement it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s