Corgi Engine Tutorial AI

hello and welcome to this cogbi engine tutorial I am Renault and today I'm gonna talk to you about AI and how you can create computer-controlled characters in the Kogi engine to act as enemies or maybe followers will see what components are already in the engine in the engine and that you can use out of the box and how you can create new right so our scripts are already kind of like abilities that you can add to your character for example if I select that that red dude here as you can see it has hernia walk script right now it's set on patrol it requires a character always on total movement script it will you your character of course to walk you can specify whether you want it to patrol on the one side let's keep that to patrol you can change the walk speed on its ability its character always on to modern script so for example if I put 50 here you'll see that if I press play right now my character walks well super fast let's put it back to four I can also have it avoid falling stuff right some point if I put it here you will see that if I press play it will try not to fall but if I put it here and uncheck missing it won't avoid falling and well focused just like a regular character that keeps going on you can also have it change direction on wall that's that was its previous behavior the right now you can see that it just doesn't change direction now a bunch of other things you can set like the move on site distance if you put your cursor in one side you will be able to set the raycast that and how your curtain is detected so for example if I put this character here said it will be easier to move on side I'm gonna set its own site layer to player so that way it text detects the player and obstacles layer I'll say platforms if I pressed play you'll see that we now have I'm just gonna my other screen I'm gonna moving into the area so as you can see we have this ray cast here the gray one and if I cross the raycast the gutter will move in my direction I could decide that I want the rake has to be cast a bit higher or a bit lower or may be offset on the X or Y axis to accommodate for the size of my character but that's basically all you need to know about Dai wok script another interesting one is the a I shoot on sight script I'm gonna move to the lava demo scene so here I am and here we have these blue robots so if I press play you'll see that all they do is kind of Patrol and if I cross the line of sight they should see they should at my little cut here and I get hurt so how does it work if i if i just select my blue robot you will see that it has an AI walk script i said two patrols basically what we've seen so far and on top of that it has an AI shootin side-street this one will have a short distance and raycast offset that's basically the same thing as the walk on site thing and what it does is if it finds an enemy in its sight it will activate the character and the weapon component and make it shoot so this blue robot it has a character on the weapon it has a robot weapon which is defined here and in which we will define what kind of projectile we have so it's a robot weapon prototype that's the sort of orange thing that it shoots that's also where you'll define the time between uses so for example if I put point 1 and try to get in range of my robot again you can see I get I get shot quite a few times so yeah that's that's more or less everything you need to know about these to pee components and of course you can you can create new ones I'm working on a bunch of AI scripts that I wanted to add to the game for a long time so far I've been working on more complex stuff more cost cool stuff because I think AI is quite simple to setup once you've done all the the other stuff but if you look at the a I work script you'll see that there's nothing complicated to it what it does is update it will for example check for a target check for walls and check for holes and then it applies the direction that has been you know selected at at some point and really just just look at the code if you want to create your own maybe jumping one etc it's just a matter of determining if and when to call all the abilities that are already included in the engine so maybe if you have a ray cast that it takes a wall maybe you want to jump three as simple as that and it's just a matter of calling the various abilities make mobility soon and maybe another tutorial at that point I hope you've learned some new stuff today and I hope I'll see you next time bye

Loading