Author Topic: Modularization of AI Code - finished  (Read 4909 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabian

  • AI Code Modulator
    Temporal Mechanic
  • 25
Modularization of AI Code - finished
Hi,

I've just finished the general modularization approach.

So the hard part of wrapping all 267 function calls is done.

This means anyone who wants it can now start changing and improving the AI without breaking compatibility with Retail!

Now we only have to decide how a new AI can be hooked into the existing code.

Lets use a launcherflag ... ;-) (just kidding, I know thats a bad idea).

At the moment I think of a global mission, mod or campaign flag, which does a static:

if (AICode == "new")
{
     aicode_new_setup_hooks();
}

This _new_ AI code could then be extended to again branch into fighter or bomber or ... specific AI based on AI Class for example.

The ai_evade hook could then for example be written like:

if (aip->class == "special")
       ainew::special.evade(params)
else
{
//    do some new stuff
// now call the _old_ code
    aicode_old_ct->ai_evade(params);
}

With that kind of polymorphic approach, one can slowly extend and rewrite the existing AI. (and perhaps finally fix the collision avoidance ;-) )

One thing needed for sure for a new AI is a custom field in aip, where it can store its data, but besides that and the decision where to setup the hooks, its done.

Let me know what you think.

cu

Fabian

PS: Sorry for the delay, but I was very busy.

[attachment deleted by admin]

 

Offline Topgun

  • 210
Re: Modularization of AI Code - finished
I don't understand the code. what's with all the +'s?

 

Offline Shade

  • 211
Re: Modularization of AI Code - finished
It's a diff versus, presumably, the 3.6.9 branch. Each + denotes an added line, each - denotes a removed line. So it can't be read alone, it has to be seen as a patch to already existing code, and merging the two using the rules above will result in the actual final product.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline Topgun

  • 210
Re: Modularization of AI Code - finished
oh. I get it now.

 
Re: Modularization of AI Code - finished
Quote
This means anyone who wants it can now start changing and improving the AI without breaking compatibility with Retail!

Critical hit... Critical hit... Critical hit...

 

Online Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Modularization of AI Code - finished
Excellent! :yes: :yes: :yes:

I will try to merge this over the weekend. :)

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Modularization of AI Code - finished
Cool.  :yes:  Thx, Fabian.

 

Offline IPAndrews

  • Disgruntled Customer
  • 212
  • This site stole my work
Re: Modularization of AI Code - finished
This is quite an achievement.
Be warned: This site's admins stole 100s of hours of my work. They will do it to you.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Modularization of AI Code - finished
Go Fabian!! 




 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Modularization of AI Code - finished
Someone get that guy a medal, or a badge or a pic or something.  Or at least a nice custom title.  I'm pretty sure everyone will love this.  Now maybe fighters can stop running into capital ships :)
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Modularization of AI Code - finished
... and SW X-Wings and TIEs can be modded for optimal high-speed manuevers!  <.<

  

Offline Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
Re: Modularization of AI Code - finished
What he needs to do is help out the BtRL team so that AI fighters don't smash into Scar's asteroid. :P
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Modularization of AI Code - finished
Basically, Fabian solved many of the AI problems?

[size=9]
EXCELLENT JOB MAN!!![/size]
[/glow][/b]
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito

 
Re: Modularization of AI Code - finished
Actually, he allowed many ai problems to be solved.

Can we also fix the problem with your wingmen completely forgetting about fighters on their tails when they have a capship to protect? (That is, when they are beyond their "interception range")

 

Offline akenbosch

  • Pretentious Noob
  • 29
  • doesent care about canon
Re: Modularization of AI Code - finished
and the multipart turrets that shoot through their parent ship?

AND theproblem with wingmen ignoring friendly ships in-between them and their target?

sweet.

Burn the sucker out of the sky!
EAT PHOTONS INFIDEL! MAY THE HEAT OF A THOUSAND SUNS CONSUME YOU! :mad2:


snail gives a debriefing: http://www.hard-light.net/forums/index.php/topic,48825.msg991954.html#msg991954

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
Re: Modularization of AI Code - finished
time to fix the speed barrier!
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 

Offline akenbosch

  • Pretentious Noob
  • 29
  • doesent care about canon
Re: Modularization of AI Code - finished
never heard of the speed barrier. could you please elaborate?

Burn the sucker out of the sky!
EAT PHOTONS INFIDEL! MAY THE HEAT OF A THOUSAND SUNS CONSUME YOU! :mad2:


snail gives a debriefing: http://www.hard-light.net/forums/index.php/topic,48825.msg991954.html#msg991954

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
Re: Modularization of AI Code - finished
the barrier beyond which the AI becomes retarded and starts running into stuff.
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Modularization of AI Code - finished
the barrier beyond which the AI becomes retarded and starts running into stuff.

It's around 350m/s, IIRC.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Modularization of AI Code - finished
I know it is 300 mps.

And thank you for fixing that bug, I have intention of using Joshua's tables :)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito