Thứ Hai, 19 tháng 8, 2013

Monday More Ladders

And Some Stairs!

Actually it's pretty much the same ladder, but it's a little better now.  Our little guy can pretty much walk around after the player no matter where I try to hide now. He currently cannot dive through windows, leaping off platforms, quick-slide down ladders, ab-sail, dive-attack, shimmy or any other wild ideas you might have for getting from one level to another, but the mechanism for using a state machine to get from UP to DOWN to UP are now in.


Amazing amount of time spent on seemingly very little as I had a character climbing and descending a ladder three days ago.  If I did this again, I would write an editor which choreographed a sequence which allows an object frame, rotation and position to be exactly controlled throughout a process of getting from A to B. At the moment the system uses a hard code state engine to get the job done. The benefit of an editor for the sequence is that once it's done, the main AI only had to get the object to A, hand over to the sequence player, then return at B to resume the AI.  Sure, it would also have taken three days, but right now I would have the tool to create staircase walking, riding lifts, grabbing a lamp-post, swinging around 90 degrees and diving through a window and all manner of cool sequences.

That said, at least the ladder climbing code is smooth enough now and transitions well from the two test ladders I have. I don't have any stair climbing animation so could not anything with the staircase transition state engine, even though it's ready and waiting, except to re-use the walking animation and slide the guy up to the next floor.  Hopefully Mark will read this and add a nice 'walk up stairs' animation in the style of the ladder animation sequence.

Over The Weekend

As you can guess, I was also battling with this over half the weekend too, tweaking the animation and motions and slowly realizing the process of tweak, run, get game to exact state, see if it works, go back to editor, tweak, rinse and repeat was massively time consuming.  Not least was testing the 'walk down ladder' which of course involved coaxing the enemy to the roof before bringing him back down again.  Another lesson is that if you anticipate a lot of tweaks in speed, motion, rotation, animation or transition then set-up your principals at their ideal starting positions. Ten minutes spent here saves hours later on!

The Last Four Hours

Of all the frustrations, the latest one which hit me around 10 PM was the sudden switching of the entity AI from container one (first floor) to container zero (ground floor), for seemingly no good reason. The container logic on the roof and the outdoor platform was fine, but my interior staircase seemed to have a large hole, be it in DarkAI or my code.  I eventually had to create a game loop within a game loop at the exact moment the AI would do this crime and start chopping out code to see what caused it. I eventually discovered none of my code caused it (as I had deleted it all by then), and it was quite true that DarkAI decided through automatic mode to switch the entity back to container AI (I guess because it was more interesting than container one).

Rather than waste any more time, the smart move was to send the whole shooting match to Paul to investigate this odd behavior while I resort to simpler implementations such as ducking, running, shooting. The easy stuff.

Signing Off

It's coming up to 3 AM now and although I have a need to move this prototype along quickly, I don't think I should do more coding with tonight's brain. Tuesday I will abandon containers for a day and focus on combat (now that our guy can chase the player).  It's fair to say I am now behind my own personal schedule as I had hoped to have all the basic AI states in place by now, but a bit more focus and few extra hours per day should see things right.  
Hopefully I can bring you a nice video in a few days once I've got the enemy putting up a good fight.  Right now he just follows me around like a puppy!

Không có nhận xét nào:

Đăng nhận xét