Good Behaviour

Yesterday I had a few hours and started ironing the AI system. So I fixed an enemy range issue, so now the enemy will run up to a place where it can actually hit you, as opposed to acting all myopic and swinging wildly while just out of range. I also got most of the regular stupidity worked out. So it doesn’t just stare at you when it forgets what it was doing and now it doesn’t fall off of steps, forever. The problem both seemed to stem from the same basic issue – the backing up function and variables wasn’t being passed correctly and made the system forget what was happening. So that’s better now.

-What is this “Passed” nonsense? In code, most of it is made up of Variables and Functions. Individually, functions are made up of instructions and variables and you can send them. Say, the player placement variable for example. It is used by lots of different functions, like the jumping, running and falling functions. All of those will modify the player placement variable when they run, then the player placement variable is picked up by the next functions. This is called ‘Passing the Variable.’
If the code isn’t built correctly, the functions that are supposed to do something to that variable may not run. For example, if the Falling Function is told to only run if the player has 1000 hit points, it will never run, because the engine cannot give 1000 hit points. So, any variables that the Falling Function is supposed to alter won’t be. They will not be passed.
You can actually pass a function too, but the means are a little different. When you look at lots of code, it easier to break it into smaller pieces. The AI system is like that. The problem that I was having was the Back Up Function and how it wasn’t being passed correctly between chunks of the code. Basically, if an Enemy is close the AI for being close is run and it then tells the system to run a big chunk of AI code. When it decides to Back Up it ran the Back Up Function listed in the being close code. However, when the enemy backed up far enough to no longer be considered close, the chunk of AI code for being far away didn’t know what to do with the variables it had because there was no code to deal with the Backing Up ability. In other words, the Function wasn’t passed correctly.

– Also halfway into the new wall hop ability. Yesterday I got the Jump divided into 2 different types, a straight jump and a running jump. The straight jump has slightly more height (maybe 3-4 pixels worth) and less lateral mobility. The running jump is the same as it’s ever been. The next bit is the wall hop itself and for that, I need to check collision and I don’t want to. I can either modify the current code and get it to return a variable or I can do a different check like I do for enemies. Either way, I need to figure out if there is a wall directly in front of the player at a certain part of the jump and do something. I’m thinking that moding the original code may be easier and certainly smoother. As I think about it, I can probably add something like:

If Jump = 2 And xJump = 10
Jump = 3 (the wall hop)

I think I didn’t think of that before because I wrote the rest of the code after midnight. Hmm, my work day seems easier now.

-In gameplay news (hooray!) after playing it a little, I’ve noticed that the combat is a little hard. Actually, quite hard. Enemies are fast, furious and slightly spastic. To help myself test the collision I built a little thing that tells me what button to press and I find myself staring at it when I play. Having built a similar system before, I know that the colors will serve the same purpose, but it really helps. After doing it enough times I can block and dodge like a pro because I have the patterns memorized. That also helps.
So yes, it’s a little tricky but I’m not worried yet. My test basically has the difficulty cranked way up. Every attack string has the full compliment of 4 attacks and each string requires all 3 kinds of blocks. No enemy in the game (even the last boss) will be that crazy to fight. So if I can beat it consistently on the highest settings without getting ruined, then I feel good that regular people that didn’t design the bloody thing could do the same on the regular settings.
It reminds me of something I read once. It was a design rule and said, “Your Game Is Too Hard.” No matter what you do, your game is too hard by default. Since the designers and level people and AI people play the game every day, they are Master’s of their Universe. The One of their particular Matrix. So they tend to always think the game is too easy. It isn’t. To wit, when Bungie was making one of their Marathon games (it’s like pre-Halo) they told the designers and testers to only play on the hardest settings and then only play with the melee weapons. If they could still beat it, the difficulty was right.

Leave a Reply

Your email address will not be published. Required fields are marked *