collapse

Author Topic: How to make AI react to spam attacks  (Read 637 times)

0 Members and 1 Guest are viewing this topic.

Offline mulambo

  • Contributor
  • ****
  • Posts: 345
  • Country: Italy it
  • Last Login:July 01, 2023, 08:06:41 PM
  • Godsent Devil
    • Website
How to make AI react to spam attacks
« on: May 17, 2017, 07:06:36 PM »
I'd like to know how to code a decent AI system that actually reacts to spammers.
Reason  is that I want my game characters to actually recognize the opponent's cheap tricks and avoid them (possibly with a breaking move or something like that). For example: imagine the AI character receiving the same punch or the same move. I want to force the player to change his fighting strategy according to a smarter-reacting CPU.
Any good coding tip to share?



Offline Cyanide

  • MUGEN Content Architect
  • *****
  • Posts: 813
  • Last Login:March 29, 2019, 06:52:34 AM
    • Mugen Obscurity
Re: How to make AI react to spam attacks
« Reply #1 on: May 19, 2017, 01:46:51 AM »
Set aside a helper that checks opponent states when his parent is hit. Use a bunch of vars. Increment values in a different variable each time your parent is hit and the opponent state matches

For eg

type = varset
trigger1 = parent, movetype = H
trigger1 = parent, time = 1
trigger1 = var(0) = 0
v = 0
value = p2stateno

type = varadd
trigger1 = parent, movetype = H
trigger1 = parent, time = 1
trigger1 = p2stateno = var(0)
v = 1
value = 1

Use the helpers values to determine if an attack is being spammed and hitting. You can go smarter and detect whether you were hit crouching or what with more vars. Then use all of that to decide what countermeasures you want to take. Kamekaze does this sort of thing in his AI already, i've never had the patience for it.

If you want to get smarter you can hold all sorts in a single variable with bitwise shifting to determine what you were doing when you were attacked, whether you were in the air, attacking etc etc without using up multiple vars for a single move

I can't explain bitwise shifting, i know the logic, i've just never had a reason to use it. MFG has some threads on it though.

Offline mulambo

  • Contributor
  • ****
  • Posts: 345
  • Country: Italy it
  • Last Login:July 01, 2023, 08:06:41 PM
  • Godsent Devil
    • Website
Re: How to make AI react to spam attacks
« Reply #2 on: May 23, 2017, 04:58:10 PM »
hmmm I feared there was the need to study variables.
one day, maybe, one day. still a bit too complex stuff for me.

Tags:
 


* IMT Facebook

Help us by Donating!

IMT Discord

Join us at our Discord! Click the image below!

* IMT Shoutbox

Sorry, this shoutbox does not exist.

* Recent Posts

SPIDER-VERSE THE AMAZING MUGENSTORY©EPISODE 10 "THE OTHERVERSE" 1080P BY REB3LTV by Rage
[March 27, 2024, 02:44:21 PM]


D2TD VS Showcase Thread by D2TD
[March 24, 2024, 11:09:37 AM]


Tree Of Erebus Stage 1.1 & 1.0 by MatreroG
[March 22, 2024, 08:13:48 AM]


.Batzarro's. Sprite Edits by MatreroG
[March 20, 2024, 07:58:08 AM]


World Heroes 2 Shura Stage by Vegaz by LightFlare
[March 19, 2024, 12:44:28 PM]


MOVED: Prepare your ****! ***** Soldier gets his **** ready in MUGEN! by Rage
[March 18, 2024, 11:08:23 AM]


[WIP] Pocket Dimensional Clash 2 by O Ilusionista
[March 14, 2024, 01:34:08 PM]


R.I.P. Akira Toriyama "Dragonball Legend" by Rage
[March 12, 2024, 03:01:39 PM]


DBFZ Rocky Field (noon) by jafar
[March 10, 2024, 11:59:23 PM]


World Heroes 2 Neo Geegus Stage by Vegaz by LightFlare
[March 09, 2024, 11:04:56 AM]

* IMT Calendar

March 2024
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 [29] 30
31

SimplePortal 2.3.5 © 2008-2012, SimplePortal