Superior AI without actually writing AI

Talk about anything not related to Transcendence.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

https://www.youtube.com/watch?v=u2t77mQmJiY

Simulated neural nets and Darwinian algorithms might be a way forward for the Transcendence AI.
Literally is the new Figuratively
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

Doesn't look easy, if you ask me. Learning programs are not too hard, but effective learning programs might be. Perhaps you can set up a separate simulation, let it run for a few hundred generations, and copy the algorithm generated to be used in the game. Do that many times and you get varying fighting styles. Letting in-game ships try to learn could be problematic. Most would probably die before they can develop a good algorithm, and if I'm not wrong, these learning would involve risk of decreasing their effectiveness, for some changes.

But perhaps we could have a faction similar to the Luminous, which learns as a race to fight better as they meet more enemies? The first few of them the player meets would be fairly normal, being given standard algorithm. But the longer you take to fight them, the stronger the next ones will become. There could be a system where you need to take out a lot of them before you can go on, and this system would be harder and harder the more you have farmed this race in the past. And each time you play the epic battle in this system wouldn't be the same. IF real-time changes is even possible.
Yes, look at my avatar, I have a wyvera type ship.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

sun1404 wrote:Doesn't look easy, if you ask me. Learning programs are not too hard, but effective learning programs might be. Perhaps you can set up a separate simulation, let it run for a few hundred generations, and copy the algorithm generated to be used in the game. Do that many times and you get varying fighting styles. Letting in-game ships try to learn could be problematic. Most would probably die before they can develop a good algorithm, and if I'm not wrong, these learning would involve risk of decreasing their effectiveness, for some changes.
Weights, not algorithm, but yes I didn't mean that in-game enemies should start out that stupid.

I'd suggest an AI for each design paradigm. The work of making an AI this way doesn't scale with the number of AIs. If you get a good AI in under 50 generations running overnight every night for the typical space between releases would be adequate to give every ship class its own custom AI, but being somewhat more generic than that would probably make future development easier since evolving a new AI would put an additional delay in the ship development cycle.

There would be a few groups based on speed, size, maneuverability, and primary weapon arrangement. A capital ship running an AI developed to gunship size and maneuverability will probably evade too much, which may not matter if it's a broadside design like the the Worldship, but can matter a great deal if it's a spinal weapon design like the Earth Slaver or Phobos.
Literally is the new Figuratively
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Runtime neural nets (like an actual proper implementation) are insanely expensive computationally. I know from experience (work with them at work)
Pre-baked neural nets are computationally cheap (just load it up and use what its already been taught), but it will have trouble when it comes to things that have been modded in since its a static pre-trained model.

I already have plans for some dynamic learning systems for TAI (learning on a per-faction/TAI-controller-entity), though they are specifically tailored to transcendence, and are a much more constrained learning model, thus not overly complex or heavy to run at run-time.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

TAI?

Also, how would we 'teach' this AI? We could certainly get an AI that is optimal against some other given ship class that has a preset AI(or even evolve them against each other), but getting it to effectively fight players with a variety of tactics and builds seems difficult. I suppose you could check for a human's ship build around some point in the game and use that, or use human volunteers, but it still seems like something that would be ineffective in a scenario with as many variables as this one has.

For a perfect setup, we'd also need to give different ship classes multiple AIs for different missions. A ship escorting a freighter should behave differently from a ship hunting down another target.

I think our best shot for this, at least initially, might be having a singular AI that takes the speed, maneuverability, weapon range, weapon omnidirectionality, and weapon DPS(the latter 3 for all weapons installed, we can probably get away with generating 1 - 2 weapons per ship, one max of either a forward firing gun, a missile launcher, or a turret, as virtually every setup in the game is effectively available within this configuration) of itself and its target into account for its behavior and pit it against other instances of itself with random stats on both sides(within a reasonable range) to get our final set of weights). This would give us a good chance of an AI that works for every ship, can survive minor modding changes(anything that doesn't alter the fundamentals), and doesn't use too much CPU power.

If taking into account one's own ship stats is too taxing, each ship class could be given its own instance of the AI which runs using its stats alone. If running based on randomized enemies would take more time to develop a formidable AI than is available, then they could be developed against enemy factions' ships that are likely to appear in the same systems, though this would be a less hardy system.

Also, did anyone check out the dogfight mod? It appears to create an AI capable of killing any player that doesn't run away and snipe it just by modifying a few of the currently available variables. That's a useful stopgap measure, at least.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Wolfy wrote:Runtime neural nets (like an actual proper implementation) are insanely expensive computationally. I know from experience (work with them at work)
Pre-baked neural nets are computationally cheap (just load it up and use what its already been taught), but it will have trouble when it comes to things that have been modded in since its a static pre-trained model.
I think this is always prebaked. Learning only happens between generations using genetic algorithms. That means that while the net can't learn in game it can learn in a screensaver.
JohnBWatson wrote:Also, how would we 'teach' this AI? We could certainly get an AI that is optimal against some other given ship class that has a preset AI(or even evolve them against each other), but getting it to effectively fight players with a variety of tactics and builds seems difficult. I suppose you could check for a human's ship build around some point in the game and use that, or use human volunteers, but it still seems like something that would be ineffective in a scenario with as many variables as this one has.
I want you to watch the current AI for a while. Do we really need an AI for every ship or every mission to be orders of magnitude better than what we have now? The current AI was iffy when Frontier came out. It has obvious issues with bias, crowding, and never pointing its gun at the target. The AI is easily the weakest game element. Worse even than the red brick Sotho model or clipped explosions that were recently replaced.
Literally is the new Figuratively
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

Atarlost wrote: I want you to watch the current AI for a while. Do we really need an AI for every ship or every mission to be orders of magnitude better than what we have now? The current AI was iffy when Frontier came out. It has obvious issues with bias, crowding, and never pointing its gun at the target. The AI is easily the weakest game element. Worse even than the red brick Sotho model or clipped explosions that were recently replaced.
That may not have been my best organized post, but I think it's clear that I went on to say that it was best to focus at first on making a basic setup that would be hardy and versatile rather than going into the advanced tactical problems we'd encounter later on.
Jay2Jay
Militia Commander
Militia Commander
Posts: 283
Joined: Fri Jan 11, 2013 12:57 am

So who here is volunteering to do this? Because it needs to happen.
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

Jay2Jay wrote:So who here is volunteering to do this? Because it needs to happen.
We've got a lot of programmers here, apparently, so we could likely get this set up despite how advanced it sounds. Perhaps if we got more specific with what the various weighted actions should be, we could get a framework set up more quickly. Anyone have ideas?
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

I'm not sure how much the size of the neural net impacts processing speed, but the inputs I think relevant are

Shield strength
Armor strength per segment
A random input
And 3 sets of sensor wedges: within twice the turning radius, within weapon range, and beyond weapon range for enemies, non-enemies, and hostile projectiles. Each wedge would need two values, a boolean and a relative angular speed.

Wedges should be narrowest forward and aft because there are ships with fixed axis weapons forward and aft. Probably 3 degrees dead ahead and dead aft, slightly wider flanking those two, and 4 or 5 per flank filling the rest of the circle.

Outputs are turn left, turn right, accelerate, decelerate, fire weapons, fire launcher, cycle weapon, and cycle missiles.

That's sounding like a lot of inputs. Non-capital ships could get by with fewer wedges, but I suspect we need a one size fits all neural net that can only have different weights for different ships.
Literally is the new Figuratively
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

That looks reasonable, but should probably handle ships with multiple active weapon hardpoints. Should turrets just target the nearest enemy like they currently do?
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

Decelerating would require turning 180 degrees and then accelerate, then turning back 180 degrees, wouldn't it? We'd need to take into account the time needed to do the maneuver when deciding whether or not to do it. Currently big ships can rob themselves of a lot of firing time by trying constantly to keep a distance, turning back and forth to 'decelerate'.
Yes, look at my avatar, I have a wyvera type ship.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

sun1404 wrote:Decelerating would require turning 180 degrees and then accelerate, then turning back 180 degrees, wouldn't it? We'd need to take into account the time needed to do the maneuver when deciding whether or not to do it. Currently big ships can rob themselves of a lot of firing time by trying constantly to keep a distance, turning back and forth to 'decelerate'.
 …Which really seems somewhat ridiculous, given that the player doesn’t need to go through all that rigmarole to decelerate.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

Indeed. Perhaps the cap ships were trying to get away and not just decelerate, on second thought. I guess they have a really narrow 'acceptable range' from which they will happily fire at an enemy. Whenever they get too far away they try to get closer, which often put them too close, where, rather than just waiting for the enemy to run further away, they turn back and try to get in position themselves.
Yes, look at my avatar, I have a wyvera type ship.
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

sun1404 wrote:Decelerating would require turning 180 degrees and then accelerate, then turning back 180 degrees, wouldn't it? We'd need to take into account the time needed to do the maneuver when deciding whether or not to do it. Currently big ships can rob themselves of a lot of firing time by trying constantly to keep a distance, turning back and forth to 'decelerate'.
NPC ships can lock themselves into a formation to some degree, so it's reasonable that they should be able to decelerate in the same manner we can.

Anyways, comments on this setup? It's assuming we give each ship its own AI.:

Inputs: Angle from ship to target, angle relative to target ship, target ship's angle relative to self, Distance from ship to target, array of weapons on both ships (launchers included, all variables for each, include which weapon is target's active weapon, if applicable), acceleration, maxspeed, and max turning rate for both ships, current velocity, acceleration, and turning rate for both ships, array of hostile projectiles(those not fired by self), array of own projectiles(useful for trapping target and fighting aggressively, as well as avoiding own blast radius).

Outputs: Fire current weapon, switch to weapon number X, Fire launcher, switch to launcher number X, rotate port, rotate starboard, thrust, decelerate.

I didn't list armor segments here because a successful AI will naturally end up focusing on a given portion of the target's armor with the current set of inputs.

I'm not handling multiple possible target ships here because I believe doing that would use excessive resources, and there's not really that much difficulty in hard coding this part. Just have ships designed to fight capitals target a capital weighted based on its proximity and health% remaining, and ditto for gunships with the addition of a hard coded 'stay the hell out of capship turret range' part. Could probably get a better set of inputs by looking at what hard coded AIs for similar games have.
Post Reply