Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fabian on August 23, 2007, 10:19:08 am
-
Hi,
I've just finished the general modularization approach (http://www.hard-light.net/forums/index.php/topic,47447.0.html).
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]
-
I don't understand the code. what's with all the +'s?
-
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.
-
oh. I get it now.
-
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...
-
Excellent! :yes: :yes: :yes:
I will try to merge this over the weekend. :)
-
Cool. :yes: Thx, Fabian.
-
This is quite an achievement.
-
Go Fabian!! (http://images.devshed.com/fdh/smilies/beerchug.gif)
(http://images.devshed.com/fdh/smilies/honorhim.gif)
-
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 :)
-
... and SW X-Wings and TIEs can be modded for optimal high-speed manuevers! <.<
-
What he needs to do is help out the BtRL team so that AI fighters don't smash into Scar's asteroid. :P
-
Basically, Fabian solved many of the AI problems?
[size=9]
EXCELLENT JOB MAN!!![/size][/glow][/b]
-
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")
-
and the multipart turrets that shoot through their parent ship?
AND theproblem with wingmen ignoring friendly ships in-between them and their target?
sweet.
-
time to fix the speed barrier!
-
never heard of the speed barrier. could you please elaborate?
-
the barrier beyond which the AI becomes retarded and starts running into stuff.
-
the barrier beyond which the AI becomes retarded and starts running into stuff.
It's around 350m/s, IIRC.
-
I know it is 300 mps.
And thank you for fixing that bug, I have intention of using Joshua's tables :)
-
And thank you for fixing that bug
Ok, I'm going to clear this up right now. Many of you (not all) seem to be under the impression that Fabian has made some sort of end-user-visible change to the AI code. That's wrong. If he did his job right, the AI should act exactly the same as it did before. The only difference is that the AI code will be running behind an extra layer of abstraction that will let us, in the future, easily change the AI code without breaking retail.
He has not solved any of the AI-related problems mentioned in this thread, he has only made it possible for them to be fixed.
Understand?
-
It remains an achievement. So:
And thank you for helping the SCP with[7b] that bug
;)
-
What he needs to do is help out the BtRL team
Who do you think signed him up in the first place? ;)
-
****, we really need to get better at nabbing FotG-minded coders.
-
FotG?
-
Fate of the Galaxy. (In my sig)
-
damn it btrl, stop stealing all the coders :D
im kidding of course.
-
We're not stealing them. We're bringing in more from outside sources. That's the exact opposite of stealing them. :p
-
you didnt read the fine print :D
-
I did. It was just funnier to pretend I hadn't.