Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Bryan See on March 23, 2015, 05:02:01 am
-
While working on high-maneuverability mods such as Shattered Stars (http://www.hard-light.net/forums/index.php?topic=88909.0), I noticed that the fighters and bombers tend to crash into larger ships while escorting smaller ships that are docked on them. Also, larger ships tend to pass into each other while attacking. These show that the FreeSpace AI needs to be overhauled, refactored and improved, along with the capship AI system, into not only one which is flexible and computationally efficient as Star Citizen's, but also a parallel game AI system.
I believe that OpenCL (https://www.khronos.org/opencl) is the solution that solves the problems aforementioned above. This not only solves performance problems on modern systems, but also opens up a whole opportunity for SCP programmers to improve the game.
While I express an intent of implementing OpenCL and overhauling the FreeSpace AI, others may be interested in doing so. So, I'm putting this up here as I am very sure this will end up - whether it should be implemented in future releases.
-
mkay.
OpenCL would cover the multi-threading aspect, but that alone won't make FSO's AI instantly better, and probably isn't necessary for most FSO mods and campaigns. Take a look at Star Fox: Event Horizon to see an example that pushes the AI to the edge in terms of entity volume.
With that aside, what are your suggestions for the AI system itself?
-
Bryan See, AI has been the subject of several lengthy discussions among the SCP both internally and publically with the result ultimately coming down to the fact that any overhaul is going to be a massive undertaking which will need a or several coder(s) willing to be dedicated to the project for a lengthy time frame to make it happen. Beyond that you then have the question of what form the new AI code will take.
-
OpenCL does not solve AI problems. OpenCL is absolute magic in terms of doing lots of small, parallel jobs, and AI isn't one of those. I'm not saying it can't be done, just that doing so on the severely limited budget we have in terms of personnel isn't going to work out well.
Now, there are areas where the AI could use improvement. Collision avoidance, for instance. But I believe that looking at that particular aspect of it and fixing it is much more likely to result in success than a complete rewrite.
-
To clarify my earlier post, collision avoidance is the thing that I would like to fix. Ships tend to collide it in high-speed, resulting in them exploding.
-
There was a recent mantis issue resolved concerning AI attackers vs. stationary targets. Try a nightly build (http://www.hard-light.net/forums/index.php?board=173.0) after March 18th and see if that resolves it.
-
OpenCL is not a good solution for a problem like this. The AI relies heavily on ray casting against mesh triangles. You're going to get killed by how small GPU caches are relative to CPU caches when traversing the BSP data structure.
-
also, last I checked, which was admittedly a few years ago so this might have been solved (please correct me if I'm now wrong on this as I'd love to play with OCL but this has always stopped me), openCL has different binarys depending on which hardware you have, so if you have a nvidia card, you will need to compile a different executable than if you have an ATI card, than if you have intel, than if you have something else like phyx or something, and you can't really mix and match hardwarde.
-
I tried a nightly build, but fighters/bombers still collide with larger ships while possessing high-maneuverability characteristics. I think collision avoidance needs to be improved.
-
I tried a nightly build, but fighters/bombers still collide with larger ships while possessing high-maneuverability characteristics. I think collision avoidance needs to be improved.
Oh well, it was worth a try.
Would you mind attaching an example of your ship.tbl? "High maneuverability" is too vague, and it would be nice if we had a clear idea of just how fast/agile your craft are. An example of a fighter, a bomber, and a capital ship should be sufficient. :)
-
I tried a nightly build, but fighters/bombers still collide with larger ships while possessing high-maneuverability characteristics. I think collision avoidance needs to be improved.
did you mess around with ship ai classes? If so, you might'be broken it that way too.
-
Eh, FSO is probably completely broken for high speed ships, I've seen too many hardcoded values in the AI behaviour from the little looks I've had at it. Things like "distance to start avoidance" is X metres, not "current speed * desired time to start avoidance". As has already been said, it'll require a lot of effort to implement changes like this including creating the flags to ensure that this behaviour is not on by default (see SCP rule #0). And with anything open source, the best way to get something done that requires a lot of effort is to do it yourself :D
-
(see SCP rule #0)
'Tis part of the sacred array of SCP.
-
Put it in the table and have the table set to retail, and the engine use the retail value if the table value is missing. Then mods can change it as they see fit.
-
Put it in the table and have the table set to retail, and the engine use the retail value if the table value is missing. Then mods can change it as they see fit.
I suppose you'll be the one to convert each hard-coded value to a table reference, to add code to the parser for a new table and its new flags, and to make sure the table is orderly and makes sense to modders as well? Oh and test and document all your changes? Should be simple, right?
-
There's absolutely no need to be so rude about that, unless of course you're just trying to vindictively scare him off rather than actually encourage him to contribute.
-
Ok, you guys completely lost me. :confused:
-
There's absolutely no need to be so rude about that, unless of course you're just trying to vindictively scare him off rather than actually encourage him to contribute.
That's pretty gold, coming from you.
-
We wouldn't make a new table, we'd add options to the existing AI tables (which, I'm pretty sure, is what jr2 meant). At its simplest, it could just be a single boolean flag: "uses speed scaling" or some such. Adding fields for every hardcoded value in the AI code would increase the amount of parsing boilerplate to write, but simplify the AI code changes.
-
Yes, that's what I meant. And, if every value is configurable in the existing AI table, to simplify, as I said, let the engine basically treat hard coded values as if they were "in the VP" so to speak, in other words, unless overridden by a value in the table, they remain at default, which keeps the required values in the AI table down to a minimum, making it easy to navigate (unless your mod needs to change that many of them, of course -- perhaps have the hard coded value overrides in the last section of the table?).
And, no, I can't program, my apologies. It's probably going to be at least 4-5 years (2 for my wife to get her RN degree while I continue working, then possibly a year to get into better financial situation, then I go to school, I'm guessing another 2 years before I can sort of contribute something code-wise, assuming I actually have any spare time).
-
Here's the ships table that explains high-maneuverability from my mod, Shattered Stars. Fighters and bombers fly at 500 m/s, while capital ships move at 350 m/s, as seen in MetalDestroyer77's FreeSpace 2 SCP videos on Youtube, in addition to its semi-newtonian physics. I did not try to mess around my AI profiles; I merely improve them.
$Name: GRF Caranayodhin
$Short name: Kato
$Species: GRW
+Length: 19 m
+Gun Mounts: 6
+Missile Banks: 2 (10, 10)
$POF file: KatoNew.pof
$Detail distance: (0, 800, 1900, 3000)
$Damage Lightning Type: None
$Debris:
+Lightning Arc Percent: 0.0
$Density: 2
$Damp: 1.0
$Rotdamp: 0.30
$Max Velocity: 240.0, 240.0, 480.0
$Rotation time: 2.4, 1.9, 2.4
$Rear Velocity: 480.0
$Forward accel: 1.35
$Forward decel: 0.75
$Slide accel: 1.0
$Slide decel: 1.0
$Glide: YES
+Dynamic Glide Cap: YES
$Use Newtonian Dampening: YES
$Autoaim FOV: 30
+Converging Autoaim
+Minimum Distance: 250.0
$Convergence:
+Automatic
$Warpin Type: Hyperspace
$Warpout Type: Hyperspace
$Expl inner rad: 25.0
$Expl outer rad: 55.0
$Expl damage: 15.0
$Expl blast: 1000.0
$Expl Propagates: NO
$Shockwave Speed: 0.0
$Allowed PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" ) ( "SMC-90 Gadha" "ACW-115 Parashuh" "EHW-104 Karavaala" "HW-221 Bhushundi Mk. 7" )
$Allowed Dogfight PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" )
$Default PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" )
$Allowed SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" ) ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" )
$Allowed Dogfight SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" ) ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" )
$Default SBanks: ( "Astra IX" "Nirbhay" )
$SBank Capacity: ( 20, 20 )
$Shields: 180
$Shield Color: 255 255 75
$Power Output: 2.0
$Max Oclk Speed: 890.0
$Max Weapon Eng: 60.0
$Hitpoints: 700
$Armor Type: Light Armor 100
$Flags: ( "player_ship" "default_player_ship" "fighter" "generate icon" "in tech database" "in tech database multi" )
$AI Class: Captain
$Afterburner: YES
+Aburn Max Vel: 0.0, 0.0, 1400.0
+Aburn For accel: 0.7
+Aburn Fuel: 300.0
+Aburn Burn Rate: 50.0
+Aburn Rec Rate: 25.0
$Trails:
+Bitmap: ABtrail
+Width: 1.0
+Alpha: 1.0
+Life: 2
$Countermeasures: 25
$Scan time: 2000
$EngineSnd: 129
$Closeup_pos: 0.0, 0.0, -22
$Closeup_zoom: 0.5
$Ship_icon: none
$Ship_overhead: none
$Score: 8
$Trail:
+Offset: -6.91 -1.18 -6.73
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: 6.91 -1.18 -6.73
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: -5.28 1.53 -6.36
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: 5.28 1.53 -6.36
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: 0.0 0.1 -10.5
+Start Width: 0.3
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Subsystem: communication, 10, 0
$Subsystem: navigation, 10, 0
$Subsystem: weapons, 20, 0
$Subsystem: sensors, 10, 0
$Subsystem: engine01, 15, 0
$Subsystem: engine02, 15, 0
$Name: GRF Jayamalla
$Short name: Phylaki
$Species: GRW
+Length: 17 m
+Gun Mounts: 10
+Missile Banks: 1
$POF file: Phylaki.pof
$Detail distance: ( 0, 800, 1400, 2600 )
$Damage Lightning Type: None
$Debris:
+Lightning Arc Percent: 0.0
$Density: 2
$Damp: 1.0
$Rotdamp: 0.30
$Max Velocity: 0.0, 0.0, 470.0
$Rotation time: 2.5, 2.0, 2.5
$Rear Velocity: 0.0
$Forward accel: 1.1
$Forward decel: 0.5
$Slide accel: 0.5
$Slide decel: 0.5
$Glide: YES
+Dynamic Glide Cap: YES
$Use Newtonian Dampening: YES
$Autoaim FOV: 30
+Converging Autoaim
+Minimum Distance: 250.0
$Convergence:
+Automatic
$Expl inner rad: 25.0
$Expl outer rad: 55.0
$Expl damage: 15.0
$Expl blast: 1000.0
$Expl Propagates: NO
$Shockwave Speed: 0.0
$Allowed PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" "HW-221 Bhushundi Mk. 7" )
$Allowed Dogfight PBanks: ( "SMC-90 Gadha" )
$Default PBanks: ( "SMC-90 Gadha" "SMC-90 Gadha" )
$Allowed SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" )
$Allowed Dogfight SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" )
$Default SBanks: ( "Astra IX" )
$SBank Capacity: ( 100 )
$Shields: 300
$Shield Color: 255 255 75
$Power Output: 3.0
$Max Oclk Speed: 895.0
$Max Weapon Eng: 60.0
$Hitpoints: 800
$Armor Type: Light Armor 100
$Flags: ( "player_ship" "default_player_ship" "fighter" "generate icon" "in tech database" "in tech database multi" )
$AI Class: Captain
$Afterburner: YES
+Aburn Max Vel: 0.0, 0.0, 1400.0
+Aburn For accel: 0.7
+Aburn Fuel: 300.0
+Aburn Burn Rate: 50.0
+Aburn Rec Rate: 25.0
$Trails:
+Bitmap: ABtrail
+Width: 1.0
+Alpha: 1.0
+Life: 2
$Countermeasures: 35
$Scan time: 2000
$EngineSnd: 129
$Closeup_pos: 0.0, 0.0, -30
$Closeup_zoom: 0.5
$Ship_icon: none
$Ship_overhead: none
$Score: 10
$Trail:
+Offset: 0.00 -8.40 -7.60
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: 0.00 10.15 -7.90
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: 8.50 3.20 -6.35
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Trail:
+Offset: -8.50 3.20 -6.35
+Start Width: 0.1
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 2.0
+Spew Time: 60
+Bitmap: Contrail01
$Subsystem: communications, 10, 0
$Subsystem: navigation, 10, 0
$Subsystem: weapons, 20, 0
$Subsystem: sensors, 10, 0
$Subsystem: engine, 15, 0
$Name: GRB Shuuro
$Short name: Attis
$Species: GRW
+Length: 47 m
+Gun Mounts: 8
+Missile Banks: 3
$POF file: Attis.pof
$Detail distance: (0, 1000, 2000, 5000)
$Damage Lightning Type: None
$Debris:
+Lightning Arc Percent: 0.0
$Density: 1
$Damp: 2.5
$Rotdamp: 0.55
$Max Velocity: 0.0, 0.0, 475.0
$Rotation time: 5.0, 5.0, 4.0
$Rear Velocity: 0.0
$Forward accel: 4.0
$Forward decel: 2.0
$Slide accel: 0.0
$Slide decel: 0.0
$Glide: YES
+Dynamic Glide Cap: YES
$Use Newtonian Dampening: YES
$Autoaim FOV: 30
+Converging Autoaim
+Minimum Distance: 250.0
$Convergence:
+Automatic
$Warpin Type: Hyperspace
$Warpout Type: Hyperspace
$Expl inner rad: 75.0
$Expl outer rad: 150.0
$Expl damage: 30.0
$Expl blast: 1500.0
$Expl Propagates: NO
$Shockwave Speed: 0.0
$Allowed PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" "HW-221 Bhushundi Mk. 7" )
$Allowed Dogfight PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" "HW-221 Bhushundi Mk. 7" )
$Default PBanks: ( "SMC-90 Gadha" "ACW-115 Parashuh" )
$Allowed SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" "Kshaya" )
$Allowed Dogfight SBanks: ( "Astra IX" "Krodha VI" "Chaya" "Nirbhay" "Bhajayati" "Kshaya" )
$Default SBanks: ( "Kshaya" "Kshaya" "Krodha VI" )
$SBank Capacity: ( 85, 85, 70 )
$Shields: 430
$Shield Color: 255 255 100
$Power Output: 4.5
$Max Oclk Speed: 890.0
$Max Weapon Eng: 250.0
$Hitpoints: 1000
$Armor Type: Light Armor 100
$Flags: ( "player_ship" "default_player_ship" "bomber" "generate icon" "in tech database" "in tech database multi" )
$AI Class: Captain
$Afterburner: YES
+Aburn Max Vel: 0.0, 0.0, 1440.0
+Aburn For accel: 0.7
+Aburn Fuel: 200.0
+Aburn Burn Rate: 80.0
+Aburn Rec Rate: 25.0
$Trails:
+Bitmap: ABtrail
+Width: 1.0
+Alpha: 1.0
+Life: 2
$Countermeasures: 30
$Scan time: 2000
$EngineSnd: 129
$Closeup_pos: 0.0, 0.0, -50
$Closeup_zoom: 0.5
$Score: 10
$Trail:
+Offset: 8.8 1.0 -4.0
+Start Width: 0.25
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 5.0
+Spew Time: 120
+Bitmap: Contrail01
$Trail:
+Offset: -8.8 1.0 -4.0
+Start Width: 0.25
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 5.0
+Spew Time: 120
+Bitmap: Contrail01
$Trail:
+Offset: 0.0 -0.4 -23.0
+Start Width: 0.25
+End Width: 0.05
+Start Alpha: 1.0
+End Alpha: 0.0
+Max Life: 5.0
+Spew Time: 120
+Bitmap: Contrail01
$Subsystem: communication, 10, 0.0
$Subsystem: navigation, 10, 0.0
$Subsystem: weapons, 20, 0.0
$Subsystem: sensors, 10, 0.0
$Subsystem: engine01, 20, 0.0
$Subsystem: engine02, 20, 0.0
$Subsystem: turret01a,1,1.0
$Default PBanks: ( "SMC-90 Gadha" )
-
Fighters and bombers fly at 500 m/s, while capital ships move at 350 m/s
I have found your problem.