New to the forum? Say hello in this topic! Make sure to read the rules.
RULE NR 3 UPDATED: Don't hurt, harass or provoke other forum members or people.

[UPDATED] Artificial Intelligence concept V2

Share questions and tutorials related to the ScriptAPI and give suggestions for new functions you want to see.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

[UPDATED] Artificial Intelligence concept V2

Post by JakSparro98 » Mon Jan 09, 2017 11:18 pm

Hi all Superfighters community,
in this thread you can find all my Artificial intelligence scripts for CPU fighters. Don't be too excited for this, it's only a demostration of what I've made so far and however it will be soon forgotten and replaced by the official one in the next updates.

FEATURES
  • advanced and modular pathfinding ,path nodes can be enabled or disabled based on situation (destructible objects like scaffoldings can influence path result).
  • ability to shoot on sight based on real raycast.
  • ability to pickup primary and secondary weapons on the ground.
  • pretty unfair (but not unbeatable) melee combat system.
MISSING FEATURES:
  • ability to pick up medkits, throwables and melee weapons (planned for the next AI version).
  • ability to recognize weapon crates by type.
  • manual elevator usage (planned for the next AI version).
  • ability to roll under obstacles or when on fire (planned for the next AI version).
  • bazooka riding (code ready but waiting for the next game update to read the state properly).
  • bullets dodging.
Make sure to check this thread periodically, also take a look to the status updates, I will try to keep the latter always filled with the latest news. I'll make at least one new version every time the game is updated and when the API changes significantly for the development of the project.

Download 1.3.4c prototype

VERSION HISTORY:
Download 1.1.1b prototype:[original]  [ 1.3.4c compatible]

WARNING, DO NOT USE THIS FOR FINAL MAP PROJECTS, ONLY FOR TESTING PURPOSE

I know perfectly I'm not the best scripter/programmer and most important thing I cannot solve the memory leak issue with this project but I tried for months, at least I done something useful since the official AI isn't available.
If you are a coder and you feels able (and courageous because the code wasn't supposed to be maintained by thirds, it could be difficult to understand) to mess with the code, I will very happy to see some modifications proposed to enhance this code until something official will come out.

STATUS UPDATES:
► Show Spoiler
Last edited by JakSparro98 on Sun Oct 15, 2017 10:48 pm, edited 18 times in total.
11 x

Dumby Eggy
Superfighter
Superfighter
Posts: 65
Joined: Wed Dec 21, 2016 4:22 am
SFD Account: Huevon NEO
SFD Alias: Huevon SFD
Started SFD: PreAlpha 1.8.8
Location: Honduras
Gender:
Age: 14

Post by Dumby Eggy » Fri Jan 13, 2017 9:16 pm

Oh shit this is quite impressive. I've never seen someone doing a great AI using a simple TutorialA concept. I want to see the Alpha 1.2.0, so you can make it better, keep working dude.
4 x
HINT: You will not surprise me if you are good with snipers and magnums and katanas; but I will give my respect for someone who is a weapon-master. So don't wait any cheer marksmen...8-)

User avatar
Rhodes
Superfighter
Superfighter
Posts: 83
Joined: Wed Sep 21, 2016 12:48 pm
Title: I am Rhodes!
SFD Account: Rhodes
SFD Alias: Rhodes
Started SFD: August 2015
Location: I'm...right beside you bro!!
Gender:
Age: 13

Post by Rhodes » Sun Jan 22, 2017 5:56 am

Isn't there a way to check if the player is in front of the CPU? That way you could set it to fire in that precise direction.(Idk how to implement this, just saying.
Last edited by Rhodes on Tue Feb 07, 2017 2:25 pm, edited 4 times in total.
0 x
IF YOU PLAY SFD I'M COMING AFTER YOU!!

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

Post by JakSparro98 » Sun Jan 22, 2017 3:31 pm

Rhodes wrote:Isn't there a way to check if the player is in front of the CPU? That way you could set it to fire in that precise direction.(Idk how to implement this, just saying.
There's a way to get the distance from the bot to the target and if it is in a specified range you can spawn a fire node in the player position, but what exactly could solve this? since that when a player is enough close to the bot it activates the meele attack.
0 x

User avatar
Rhodes
Superfighter
Superfighter
Posts: 83
Joined: Wed Sep 21, 2016 12:48 pm
Title: I am Rhodes!
SFD Account: Rhodes
SFD Alias: Rhodes
Started SFD: August 2015
Location: I'm...right beside you bro!!
Gender:
Age: 13

Post by Rhodes » Tue Feb 07, 2017 2:16 pm

JakSparro98 wrote: There's a way to get the distance from the bot to the target and if it is in a specified range you can spawn a fire node in the player position, but what exactly could solve this? since that when a player is enough close to the bot it activates the melee attack.
Couldn't you freeze the bot or something? Stop it from walking, or spawn an invisible block affecting ONLY the bot?(Yet again, idk how to implement this)
0 x
IF YOU PLAY SFD I'M COMING AFTER YOU!!

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

Post by JakSparro98 » Tue Feb 07, 2017 3:10 pm

Rhodes wrote:
JakSparro98 wrote: There's a way to get the distance from the bot to the target and if it is in a specified range you can spawn a fire node in the player position, but what exactly could solve this? since that when a player is enough close to the bot it activates the melee attack.
Couldn't you freeze the bot or something? Stop it from walking, or spawn an invisible block affecting ONLY the bot?(Yet again, idk how to implement this)
Let me understand, do you want the npc stops when is enough close to the player? And then do you want it spawns a fire node in the player direction? Or do you want to make the npc shoots fire nodes rather than using his gun?
0 x

User avatar
Rhodes
Superfighter
Superfighter
Posts: 83
Joined: Wed Sep 21, 2016 12:48 pm
Title: I am Rhodes!
SFD Account: Rhodes
SFD Alias: Rhodes
Started SFD: August 2015
Location: I'm...right beside you bro!!
Gender:
Age: 13

Post by Rhodes » Wed Feb 08, 2017 10:13 am

Well, as you posted earlier, if we can stop the CPU from attacking when it is close to the player, THEN spawn a fire node, that would look cool. Also, to use gun, you can use Game.SpawnProjectile(If there were a way to make the CPU pick up stuff, then check what it has picked up, then we could spawn the corresponding projectile, that would be cool.
0 x
IF YOU PLAY SFD I'M COMING AFTER YOU!!

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

Post by JakSparro98 » Wed Feb 08, 2017 11:59 am

Rhodes wrote:Well, as you posted earlier, if we can stop the CPU from attacking when it is close to the player, THEN spawn a fire node, that would look cool. Also, to use gun, you can use Game.SpawnProjectile(If there were a way to make the CPU pick up stuff, then check what it has picked up, then we could spawn the corresponding projectile, that would be cool.
Yes, currently cpu stops near the player and attack him with melee, anyway if you want this specific change from melee attack to fire node attack there's no problem, I will provide you the prototype in a new post soon.

For the pickup system (I said this when I released the cpu concept), I will wait until the next update comes out, it does not make sense make a script that will be repleaced by new API commands the next version ;)
1 x

User avatar
Rhodes
Superfighter
Superfighter
Posts: 83
Joined: Wed Sep 21, 2016 12:48 pm
Title: I am Rhodes!
SFD Account: Rhodes
SFD Alias: Rhodes
Started SFD: August 2015
Location: I'm...right beside you bro!!
Gender:
Age: 13

Post by Rhodes » Thu Feb 09, 2017 5:11 pm

Jak....
I tested out your script...didn't understand it much but when i tested it my mind was...BLOWN :o
VERY impressive work MAN!!!This is amazing!
-Now for the details-
I started the map. The CPU started running after me, assault rifles in their hands! Jak, VERY amazing work getting the rifles to follow them. And you said "line of sight wasn't very accurate". I mean, really? They are awesome! Punching, running, pathfinding!Shooting!
They remind me of medium level CPUs from the Flash SF. Sadly(for us) they seem to have infinite ammo...(might wanna fix that) also they can't pick up stuff, but still...their pathfinding is great! They closed in on me from BOTH sides, thorugh the mesh. Amazing work! Hope the next update helps you make it EVEN better!
-Keep scripting! :) ;)
1 x
IF YOU PLAY SFD I'M COMING AFTER YOU!!

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

Post by JakSparro98 » Sun Feb 12, 2017 7:18 pm

Rhodes wrote:Jak....
I tested out your script...didn't understand it much but when i tested it my mind was...BLOWN :o
VERY impressive work MAN!!!This is amazing!
-Now for the details-
I started the map. The CPU started running after me, assault rifles in their hands! Jak, VERY amazing work getting the rifles to follow them. And you said "line of sight wasn't very accurate". I mean, really? They are awesome! Punching, running, pathfinding!Shooting!
They remind me of medium level CPUs from the Flash SF. Sadly(for us) they seem to have infinite ammo...(might wanna fix that) also they can't pick up stuff, but still...their pathfinding is great! They closed in on me from BOTH sides, thorugh the mesh. Amazing work! Hope the next update helps you make it EVEN better!
-Keep scripting! :) ;)
Thank man, I really appreciated :)
So you didn't tested the concept yet when you asked me to spawn a fire node in front of the NPC? So now, I still have to send the experiment you asked before or not anymore?
0 x

User avatar
Rhodes
Superfighter
Superfighter
Posts: 83
Joined: Wed Sep 21, 2016 12:48 pm
Title: I am Rhodes!
SFD Account: Rhodes
SFD Alias: Rhodes
Started SFD: August 2015
Location: I'm...right beside you bro!!
Gender:
Age: 13

Post by Rhodes » Tue Feb 14, 2017 10:33 am

Send the script i have the map :p I wanna see how mean they are...
and yeah i hadnt..
0 x
IF YOU PLAY SFD I'M COMING AFTER YOU!!

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 256
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 19

Post by JakSparro98 » Sun Oct 15, 2017 10:46 pm

Hi all,
I'm here again to show you the overhauled AI script before the very first bot will come in the next update expected for the end of the Month.

This thread will be recycled and updated to bring new versions untill a mature artificial intelligence will come out officially, all the previous and the current version of the code in the main post.

here an epic two team CPUs fight:
► Show Spoiler
A great thanks goes to ShutDownMan for the collaboration in making the new (real) raycast system!

I'm also going to convert all the official maps to test if my little beast is ready to handle real maps, with chaotic situations and changes in the path morphology (yes I managed to handle also that).

Oh, and Gurt, I hope you will read this, I never wanted to challenge you making an AI when you said me multiple times that scripting isn't intended to be used to create an AI, I was only making you to know how powerful your APIs are, and for this reason they deserves to be fed more and more; APIs aren't a niche feature. ;)

Important note:
This version is more heavy than the previous one, with constant lag spikes due for not so much optimized code (but this doesn't mean I didn't optimized it at all, before the introduction of coroutine in my code, the whole script was run at 10 fps, the script wasn't supposed to run in async and I may made some mistakes in optimization), more code even means more bugs and if you think you've found one let me know (provide me something to replicate the issue in some way).

If the game is too laggy for you, try to lower the number of NPCs by changing the repeat count in both two TimerTrigger above the RandomTriggers.
1 x

User avatar
Billy
Superfighter
Superfighter
Posts: 243
Joined: Fri Apr 22, 2016 3:56 pm
Title: General of Delta Squad
SFD Account: Billy
SFD Alias: [DS5] Billy
Started SFD: October 2015
Location: Austria
Gender:
Age: 16

Post by Billy » Mon Oct 16, 2017 11:48 pm

Dude, I will check dis out, the gif looks amazing!
0 x
Join Delta Squad today, if you mail me now you will get this cool private rank for FREE, but thats not all, you will also get an imaginary Cookie, so better hurry up!

User avatar
Noble
New Moderator
New Moderator
Posts: 322
Joined: Wed Mar 30, 2016 6:46 pm
Title: Sommelier
SFD Alias: |LPH| Nobel
Location: Rio de Janeiro
Gender:
Age: 18

Post by Noble » Tue Oct 17, 2017 2:25 am

You are always doing these amazing stuff with API right before an update. But for sure you proved incredible things and AIs can be done with script, I thought that wasn't even possible.
0 x
♫ Raise your hands for the people that will never let you down ♪

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest