Monday, 19 August 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!


  1. Combat is good.

    Enemy walking up stairs would be useful.

    Enemy climbing ladders would be a bonus though it gives us the chance to pump some lead into them or drop things on them while they are climbing and they are defenseless....


    Sorry to hear it was a hard few days I bet its very frustrating.

    Thanks for the hard work and the pic of the enemy climbing the ladder looks great.

  2. hmm
    and if you would go the editor route with it?
    it is clear as u stated itself that you are behind your personal schedule
    but wouldnt the editor speed up the whole process in the longrun?
    might be a rethinking worth.

    anyways thanks for the hard work you have put into this
    and lookin forward to the video

  3. Was interesting this past week, I've played a whole bunch of games on console recently, whereas enemies climbed ladders and it was interesting to see how poorly they were done (up close). Almost like they were floating up and not actually placing their hands and feet on each rail.

  4. Yes that's state engine ladders for you, with the artist model and the programmers AI bot being glued together with logic. Starting an editor to replace the state engine now would be another three days to create it, then the same time again to produce a handful of sequences and final integration to the prototype. A week and a half would pass by and we would still be looking at a guy climbing ladders. My plan is to work on combat and animations for those, so we can get a more rounded picture of the whole AI. As Peter states, all this meticulous work is instantly degraded when you simply shoot the defenseless character as he climbs up the ladder after you (which I am sure would go down in reviews as 'worst AI ever').

  5. see thats why we really appreciate
    to be part of the process
    not just being able to whitness Reloaded growing
    more importantly to understand the decissions being made
    and i agree at the end it wouldnt be worth and we would still watch a guy climb a ladder

    after all, we are happy to get a professional Ai
    and as Tyrone stated there are so many games/ engines that dont even have such features
    instead they let the actors just float up/ down
    and their main focus is directed at the visuals

    anyways thx @Lee for the explenation

  6. Hi Lee

    The AI updates looking very good as usual. Lots of likes happening on the YouTube videos now also. FPSCR should be one of the must have apps by the end of the year.

    Will you be working on integrating the prototypes once combat AI is there or is there more modules that need to be done first?

  7. AI is the last module. Once this is done, integration and tweaking begins in earnest.

  8. I really was not complaining or trying to be flippant when I spoke of how defenseless an enemy AI might be when climbing a ladder.

    I never actually expected to have or see AI doing that and if they can then all well and good - its more than I would have expected for Reloaded.

    That would always be useful for many reasons and in many situations even if they are defenseless. Its up to the game designer to use whats available sensibly.

    For example just don't expose them. The benefits anyway would be numerous. e.g. enemy climb ladder when player is not able to target enemy but enemy can still follow player or access same level as player whereas otherwise may not be able to. Nashing, biting, terrifying monster type enemies could chase player up ladder biting at heels so player has no time to stop and shoot anyway. Thus benefits are available. I don't see it has to be seen as the worst AI ever its just to be taken as is and used sensibly if it has limitations which everything does.

    I am not sure what the option to the suggestion then to the worst AI would be? i.e. their inability to attack I guess whilst climbing? Allow them to defend themselves when climbing a ladder and shoot or otherwise attack the player? That's seems like a very difficult thing to achieve to me. Hold on with one hand and shoot with the other, shoot left or right or upwards, downwards. I respect anyone trying to do that kind of level of AI in an Indie engine. Even walking correctly up stairs is quite advanced I guess and shooting too while doing so that much more so.

    Anyway I am quite surprised that climbing ladder enemies were even contemplated as to really make the most of that feature could indeed I appreciate be difficult and very time consuming to get anything like near perfection in professionalism. All really good stuff I know and nice to have as a bonus but expected in Reloaded not really by me anyway. Good to have as a promo for Reloaded perhaps as few engines would have such features at this level. Certainly you were recently looking for a killer feature - there was never any need - AI is it for me at least so the better it is the better Reloaded should be received but not necessarily so.

    The Rounded picture of AI and perhaps other things to date sounds like a good idea to me. Then if all other things allow I guess you can update somewhat later. I would not know if that's sensible or possible.

    Again thanks for the hard work here.

    1. I got to check some games out to see what their AI does when enemies climb up and down ladders while shot at. From what i recall they actually are at their most vulnerable state here during this action. Pretty much like real life.