Ive been working on this A.I that behaves like a human and is hyperintellegent.
When spotting an enemy it calls its squad and gets the THREE closest ally’s to come over to it and help take the enemy down.
It will strafe and move around when fighting the enemy and will when handling melee weapons keep a distance.
Once it reaches its position it goes to patrol.
It has a a huge brick in the center of it that’s invisible that when touched causes it to go into attack mode and attack the person that hit it, it also does raycasting to check if they see the enemy.
It also plays voicelines.
At the end of every firefight the ai system gets
The person who got the most health taken away during battle
The guy who did the last shot to finish him off
The guy who contibuted the least
and assign a voiceline based on a huge table of lines
It also plays lines for spotting enemys as well and also general lines and comedic ones.
Does anyone have any suggestions on how I can make my A.I more realistic and behave like a human.
The best part is that this is all done by ONE SCRIPT. These ai do not follow a straight pattern where every one of them goes to one position and just camps. they split up, they fight seperatly and they play voice lines based on their separate situations
definitely when I need a use for gender tailored voice lines(When I get a female voice actor). The reason they dance like that when they reach their objective is because I just made them strafe around once they reached their goal, it was a placeholder system.
Yeah I need to make a muzzle flash I orginally just made the soldiers weapons as aftertoughts as I was mainly focusued on the AI. They are shooting,
The problem with having the AI face you is that rotating the HumanoidRootPart causes the Moveto and pathfinding to stop and they just stand still. So I use a bodygyro which has a afterproblem of them not exactly facing YOU exactly. But they are still semi facing you
For the orientation problem, disable AutoRotate, that’s the reason your characters aren’t properly facing the correct direction you want using BodyGyro.
Ill be honest I have extremely high standards that push me to impossible goals sometimes. I think I will consider the AI acceptable when I add more behaviors to make it behave like a human.
Ill add a invisiable part to the charcter facing backwards from him thats attached to his HumanoidRootPart. When this part gets touched and the player is not crouching or uses his weapons that make a sound(Will rewrite the sound functions of every weapon) he will make a animation were he snaps back and turns around, plays a little spotted animation where he will point which will be less than a second and go to attacking the player alerting his squadmates
When the game reaches a MAX ai limit that I will determine through testing it will switch the ai from raycasting which is extremely expensive to a les expensive but less accurate system. Itll place a part in the HumanoidRootPart of every AI that will be extremely long and be facing forwards. The AI will then detect and scan for touches, and on a touch it will get the position of the object and if its a humanoid do a SINGLE raycast to see if it can see it can spot them from where they are looking to prevent the ai discovering the player if there behind cover and then alert its squadmates and fire. acutally I might just use that in general.
Add what im calling behavior emotions(name pending). Basically these are events or animations that happen based on events. For example if a Soldier kills a enemy and no other enemy is around it might go up and shoot its dead body a few times and say a voice line to make them more human. When low on health they might bring there arms up in a animation saying “ILL TAKE YOU ALL ON”(Of course ill have more than 1 line that could play because im a perfectionist at the expense of my own self sanity) and bezerk the player. Or if there is only one left they might flee in terror. Or if your staring at them for to long and are on there team they might say something funny “I know im good looking but we got a battle to win” or get angry at you.
When shot at figure out who made the shot call 3 of its closest allys and strafe around and kill them
When moving in LARGE groups and there is a ALOT of ais don’t move independandtly move as a group for performance reasons. this does not apply in combat however
Detect teamnames for allys and the ability for ai to be on teams via the attribute TEAM
just for giggles I went and added a bunch of ai of them and put them on different teams to see JUST how many AI it would take for it to start lagging(I even removed the cleanup function so on death the ai would not be removed just to see if I could lag it and it stood its ground.) there were 23 ai although to be honest I think it could handle A LOT MORE ai than that before starting to lag(I also REALLY need to add new voicelines)
Its funny because when you get rid of the cleanup function they still talk despite being dead. it was funny at first but now its starting to become annoying those voicelines.
(Yes. one of them is saying “Mommy Mommy I have a tummy ache” and “Im wounded I need a lego star wars bandaid from target RIGHT NOW”)
Reaction based animations. when spotting a enemy they may play a point animation or a bruce lee like “Come over here” move. When damaged they might do a roll to evade and turn around
Handling of melee and ranged weapons
Updating the damage updating system and how they work as a group
Enemy taunting on death.
already have the basic models for the different enemy types.