Author Topic: AI improvements and OpenCL implementation  (Read 6760 times)

0 Members and 1 Guest are viewing this topic.

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
AI improvements and OpenCL implementation
While working on high-maneuverability mods such as Shattered Stars, 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 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.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: AI improvements and OpenCL implementation
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?
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Minecraft
    • Skype
    • Twitter
    • Headdie on Deviant Art
Re: AI improvements and OpenCL implementation
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.
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: AI improvements and OpenCL implementation
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.
« Last Edit: March 23, 2015, 07:35:19 am by The E »
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
Re: AI improvements and OpenCL implementation
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.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: AI improvements and OpenCL implementation
There was a recent mantis issue resolved concerning AI attackers vs. stationary targets. Try a nightly build after March 18th and see if that resolves it.
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: AI improvements and OpenCL implementation
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.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: AI improvements and OpenCL implementation
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.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
Re: AI improvements and OpenCL implementation
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.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: AI improvements and OpenCL implementation
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.  :)
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: AI improvements and OpenCL implementation
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.
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: AI improvements and OpenCL implementation
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
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: AI improvements and OpenCL implementation
(see SCP rule #0)

'Tis part of the sacred array of SCP.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: AI improvements and OpenCL implementation
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.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: AI improvements and OpenCL implementation
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?
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 
Re: AI improvements and OpenCL implementation
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.
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: AI improvements and OpenCL implementation
Ok, you guys completely lost me.  :confused:
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: AI improvements and OpenCL implementation
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.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: AI improvements and OpenCL implementation
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.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: AI improvements and OpenCL implementation
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).