Alot of BYOND games have the usual old crappy AI, some a lil more advanced than others, but really just basic old if you attack me I chase and kill you, if i'm hurt I run and hide or attack from long distance kind of thing. Though i've been thinking up some ideas on advanced squad based AI.
Everyone wants a challenge from AI, and usually never get one, so what I was thinking is having a squad system, with formations leaders, and plans on how to play. Lets take a simple squad, Leader - Mid range, Medic, Long Range, and Heavy Cover -Mid-Close. Say there fighting another squad of the same build. Here are some commands they could complete to have order and a sense of battle.
When starting out they assume position, this is done by having the leader go where he needs to go, then the formation is set up like this l = leader, h = heavy, s = sniper, m = medic <>v^= direction.
l
s h
m
As you can see its in a four direction system of importance. The back has already been covered, so the medic stays back there so he doesn't get hurt, right and left need to be covered so the heavy and sniper class go there so they can cover the sides. Constantly they will make this formation when not in battle, this could easily be done with a Formation() command which moves the team members to that position or as close as they can go. Also for movement I would suggest using a PathFinding demo so they know exactly where to go.
Now, they havn't spoted an enemy, and they don't know where they are, so they setup a snipers position.
^
^
m
Now here they let the sniper get ready to look out past there vision limit to find the enemy, while the leader and heavy units protect him close by, and the medic is in the back waiting for orders. With this done you can then do a vision check by using a 'cone' dynamic to see if any visible enemy is in that range and he would be found if he is. If not then they would move around in formation stopping randomly to check for enemies.
When found they will find the nearest way to the enemy and get into a fighting position: c=cover e=enemy
e
c
^^^
lsh
^
m
See, if they were over an elasped area, they would set up a sniper to try to take them out, though, if spotted they would go to a close quarters position like this, though so far everything would be done by simply moving people to correct positions.
e
v
^ ^
h l
c c
s m
This is done a little bit differently, the leader and heavy unit will engage at once, while the sniper and medic wait back behind cover, they would do this by checking for the nearest cover in range that is facing that is the general oposite direction of the enemy if you check(As in use a get_dir() proc that gets 4 exact cardinal directions, and compare if its get_dir()=turn(180) of the enemies, so its the exact oposite meaning you can hide behind it and be safe.)
Now, the squad can attack, but wait! They get overpowered by 3 more enemies and are forced back, what shall they do!
e
e e
e
c
c c ^ c
l<m h s
This is a simple and flexible formation, everyone will walk_away until they find cover, while under cover the heavy unit will fire upon the enemy when he can, while the medic runs to the most injured squad member down till the least injured. Until they have a general high HP, then they will strike back.
Everything will be the same even if a member dies. Except if a sniper dies they cant do both sniping formations, or if a medic dies then when they fall back they will strike when they find cover.
There could be more things added like during battles the medic can go through members in formation healing injured ones, and while in formation if one gets hurt badly he will run to cover while the others hold formation. Also the sniper might have a small formation where he goes 'solo' only if the leader gives the command to(Like if they are stuck down in cover and need backup the sniper will decrease in position a few tiles till hes in a safe spot then fire upon the enemy).
If you implement a thing like this then you could use it for most AI, and have them follow formations or orders, even in large war games you could have bigger formations or have multiple squads. There could be more advanced AI things to do with this like when raiding a building the heavy unit can open a door while the leader unit is one space back and throws a flash grenade. But really all this should be done through datums of the leader of the group and through checks to see what proc should be done at which time. Have a single proc that checks every second to see what to do, have multiple if()s and switch()s to check if you should Open a door, or go in different formations, and have ever command as a seperate proc that is called by these datums in the squad tree. So this datum would be handled as a 'brain' for the squad.
If anyone feels like making a demo or playable version of something along the lines of this, use these ideas in anyway, or if this helps you out please tell me so I can see it first-hand ^^. And if you have any ideas for this you can say so here.
Thanks for reading!(Now that I think about it this should have been a blog, or maybe even a Dream Maker post?!?!? eh nvm its not organized or ready for Dream Maker, maybe some day i'll post there though xD)
ID:151903
Oct 23 2008, 3:32 pm (Edited on Dec 8 2012, 5:25 am)
|
|
Oct 23 2008, 3:37 pm
|
|
Pretty good idea, the amount of possibilities for formations are nearly endless, though! You would probably need fuzzy logic to make this work good.
|
In response to Jeff8500
|
|
<the amount of possibilities for formations are nearly endless
Thats what is really good about this. The more formations or commands you make the more advanced they would get, so soon you could have AI being better than the actual players! Which is a good goal, cause if you have diffaculties you could dumb them up by not having them do some commands, or do some formations/commands at wrong times, which is smart for making people be dumb xD |
In response to Bakasensei
|
|
The problem with super smart super reactive AI is, though, that they're too difficult to play against. In my game, I STILL have to dumb down the AI more (it's already 0.3 seconds slower than players when it comes to movement and attacks), but it has such good reflexes that it just owns. I just inadvertently gave myself the answer to my problem though; dumb its reflexes down.
|
In response to Jeff8500
|
|
Yeah, cause AI no exactly where and how to move, and where to shoot, and if something is shot at them, so they usually will be better, but the have no strategy or game plan which makes them fail in my eyes, but yeah, making them walk slower, or react slower kinda dumbs them down, but you also could dumb them down by not know exactly which direction to shoot in, just a general one(Like instead of using an advanced direction proc for 8 directions, use one for 4 or 6 directions) or instead of them moving in 8 directions have them move in 4, or instead of having them know exactly where to move and the fastest way to get there just use a simple/dumb walk_to. There are infinite possibilities. Which is awesome.
|
In response to Bakasensei
|
|
Yeah, I thinking that I'll invert their paths of movement occasionally (see diagram below) and slow down the speed at which they turn and attack (they can, quite literally, turn and attack in the blink of an eye).
L L L L|\ L P|_\ ENEMY Where P = player, lines stand for an obstacle or two or five, and, well ENEMY is the enemy. |
Aggro: If you've played Army of Two then you know what i'm talking about. Its mainly the concentration of enemy fire upon a friendly(or yourself!). So the more aggro you have, that means the more enemies will be firing at you. What you can do with this is the ai will first target the strongest, or most deadliest person in that situation first. Ex:
if h is firing his gun(Which is the most powerful) and l is firing, while s and m are hiding behind cover. The AI will mostly shoot at h since he has the most power-fullest gun. But, if they are all hiding behind cover, while m is healing m is the biggest threat. Or if they are shooting, while s is behind sniping, s is the biggest threat. Also AI could sort of flank the enemy, while having h s and m fire upon and enemy, while l runs around and attacks from behind(This would be hard to figure out how to do). |
The reason most people don't do that is because it's too much. You just thought up a bunch of very specific scenarios, and you would have to write separate code for every scenario and sub-scenario, and each would have to take many things into account. It would be a massively bloated system to keep track of things that way.
I'm not saying it can't, or even shouldn't, be done, just that it's more effort than most people are willing to put into it. In most games the PC-player's superior knowledge and reaction speed is sufficient to make them overpower the players. |
In response to Loduwijk
|
|
No, what I was suggesting was ways to handle multiple scenarios, I bassicly described everything, and that was only about 6 of them. Thats not that many, and it only gets as massive as the programmer wants it to be. But in almoist all the games on BYOND all the AI does is chase and attack, no real strategy, but for an action game this would be very cool to add, and it would make players play even when noone else is on, cause facing a crappy AI is lame, but when the challenge you like this its better cause it more resembles a player.
than most people are willing to put into it < -- Those are the people with games that don't need AI, or don't really care. I'm talking about for Action games where this would be needed and make gameplay better, but you are right there. |
I had to leave a while after starting this post, so there are a bunch of places that have pseudocode instead of real code. You should get the idea though.
/** And now I have to go. If I have time later, I might come back and continue this. For now though, that should at least start you in the right direction. |
In response to Loduwijk
|
|
This isn't developers how-to I know how to make this AI, I was suggesting this to other players/trying to get this idea better, its not a help wanted type of post xD its sorta like a Dream Makers post, just not as much win.
Edit: Though what I did lack in my post was actual code, so yours sort of helps out anyone really thinking about the idea, so thanks for posting that still. |