Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Creating Custom AI Question

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating Custom AI Question

    Hi guys,

    So one of our team-mates is attempting to create custom AI for our game, deliverable tomorrow for simple behavior, however he seems to have run into trouble, so Im going to try and help him, but I dont know the first thing on how to create custom AI, I was hoping you guys could point us in the correct direction.

    I watched some of the videos, however I was hoping there was a coding solution to programming the bots, and not a kismet solution.

    Lowest Acceptable Goal:
    Single Bot standing around doing nothing until the player comes within a distance dictated by the player's currently equiped disguise, then attack.

    Medium Acceptable Goal:
    Bot patrolling and if player comes within distance, bot reacts and attacks.

    Hopefully if you guys can help with that, We should be able to run from there. Ill be researching this question till I get it solved for tomorrow.

    Thanks for your help,
    ~David

  • #2
    I would have to code it myself to tell you code, so here comes an explanation!

    well, 1, do you want the AI to fight each other too? if so, just do: foreach AllPawns(){}

    and do a trace to each one, and check if they are in line of sight, then have it react, that is for the lowest acceptable goal

    for higher, check for all "pathnode" objects and do the same thing, and have it move to each, but at the same time, check for all pawns and react if they get within line of site.

    if you want reacting to distance, just do a distance check (VSize())

    if you want them just to attack the player, just check if the pawn is a player before doing anything in the check line of site (trace the pawn first, then check if its a player, then do stuff)

    Hope this helps!

    Comment


    • #3
      Originally posted by xnasorcerer
      Yeah, pretty much just like that. One of my first questions is, which class do I need to inherit from, and how do I get the bot to spawn properly?

      Comment


      • #4
        That's a nice looking AI demo xnasorcerer. Thanks for sharing your AI code.

        Comment


        • #5
          wow this is awesome stuff sorcerer

          Comment


          • #6
            How is your AIController actually finding the Navigation Points in the Map ? I cant see them being referenced anywhere here ? How do you go about making the path in UDK Editor ? are they just of a certain name ? I see this ...

            var () array<NavigationPoint> MyNavigationPoints;

            but when does it get populated ?

            Comment


            • #7
              thankyou so much, you have shed a lot of light on this for me 1 little question, how do you see lines between your pathnodes in editor ? have you turned something on ?

              Comment


              • #8
                How do you add the AI Using the editor ? do you spawn your Enemy through actor factory ? thats what Im currently doing

                Comment


                • #9
                  And sorry not too sure about your question, is your player of type Pawn ?

                  Comment


                  • #10
                    Cant believe I overlooked that, I was even going to try that :/ lol, thanks bro, this is awesome stuff btw, very nice little introduction to AI, feel like I could confidantly build on this now

                    Comment


                    • #11
                      thankyou man, your an absolute legend, I already figured that out after I got the "placeable" bit like but this thread will be so good for others.

                      Good on you

                      Comment


                      • #12
                        I am in no way undermining the work of xnasorcerer which I think in this thread is absolutely fantastic and has saved a lot of us A LOT of time figuring this out for ourselves :P But I have made a few changes here and there and made a few adaptations which I think might be interesting for anyone using this thread in the future and perhaps yourself xnasorcerer

                        First change is where the Controller gets its default properties for the following variables from ...

                        Old ...

                        Code:
                        defaultproperties
                        {
                                attackDistance = 50
                                attackDamage = 10
                                hearingDistance = 1000
                                perceptionDistance = 1000
                                ChegouDestino = false
                        	//AttAcking = false
                        	AnimSetName ="ATTACK"
                        	actual_node = 0
                        	last_node = 0
                        	followingPath = true
                        	noiseHeard =false
                        	IdleInterval = 2.5f
                        	SightRadius = 360
                        }
                        Ive chosen to get them from the actual Enemy Pawn like in your Setpawn function like this ...

                        Code:
                        function SetPawn(GGEnemy_Test NewPawn)
                        {
                        	MyEnemyTestPawn = NewPawn;
                        	Possess(MyEnemyTestPawn, false);
                        	MyNavigationPoints = MyEnemyTestPawn.MyNavigationPoints;
                        	bAggressive = MyEnemyTestPawn.bAggressive;
                        	AttackDamage = MyEnemyTestPawn.AttackDamage;
                        	AttackDistance = MyEnemyTestPawn.AttackDistance;
                        	PerceptionDistance = MyEnemyTestPawn.PerceptionDistance;
                        }
                        the reason for this being that I have declared them in Enemy pawn using the "()" method that means it is displayed in UDK Editor and can be changed by whoever is "level designing" or whatever. The code looks like this ...

                        Code:
                        var () float PerceptionDistance<DisplayName=Perception Distance>;
                        var () float AttackDistance<DisplayName=Attack Distance>;
                        var () int AttackDamage<DisplayName=Attack Damage>;
                        This means when the pawn is placed in the editor and you go to the properties with (f4) instead of only seeing the navigation points you will also get these options ...



                        I think this will be handy for setting different types of pawns etc, also you can see ive added an aggressive boolean to see whether the enemy is aggressive or not which im currently linking into my player Pawns level system. Anyway I hope this is helpfull just thought id stick it up.

                        I am ofcourse sure that you decided against this for a reason xnasorcerer hopefully this doesnt come across as undermining your work.

                        Again thankyou.

                        Regards McTavish

                        Comment


                        • #13
                          Yep i noticed all of this and was thinking about adding some stuff in for it too Ill keep adding to this thread if anything changes and updates.

                          I was thinking of doing a function where the player is making a noise if his velocity is of a certain value or something, so then you can walk without making noise but ill get back to you

                          Comment


                          • #14
                            Ah right, what classes are you extending from ? Mines dont seem to play sounds right now but Im extending from GamePawn unless you have actually written the sound events yourself maybe or am I missing something ?

                            Comment


                            • #15
                              Originally posted by xnasorcerer
                              Well, right now, the walking part, plays the walking sound, but the hearing event doesn't react to this. But if you jump near the AI, the hearing event will fire.
                              the hearing event is linked with MakeNoise(). make sure you feed a high (enough) value.

                              Comment

                              Working...
                              X