Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just **Better AI** in the most general sense #7539

Open
ChuckStarchaser opened this issue Nov 7, 2022 · 5 comments
Open

Just **Better AI** in the most general sense #7539

ChuckStarchaser opened this issue Nov 7, 2022 · 5 comments
Labels
enhancement A suggestion for new content or functionality that requires code changes

Comments

@ChuckStarchaser
Copy link

ChuckStarchaser commented Nov 7, 2022

Problem Description

Many problems; not just one. But I'm not talking about "dysfunctions", exactly; just at stuff that makes no sense. When stuff does not make any sense, it kills immersiveness, in the sense that you tend to sort of wake up from the game. It's as if you are comfortably happy in The Matrix, and then you see a flying elephant landing in your backyard. Examples:

    • Small ships, e.g. pirate interceptors, coming in firing at entire fleets of ships much bigger, effectively committing suicide for no purpose whatsoever.
    • Pirates constantly, constantly dying everywhere by the hundreds per minute... How many children do pirate mothers have to give birth to, to replace such a high rate of attrition?
    • Escort ship AI that never gets a copy of your mission description. How is it possible? You have a mission to disable (but not destroy) a ship, and your stupid escorts destroy it in less than a third of a second ... before you even see it. Can't they read? Don't they check their email? Don't they understand what "disable" means? Or they just don't care?
    • There seems to be no goals in the current AI; A hates B therefore A shoots at B. As if Republicans and Democrats would shoot at each other as they drive on a highway to work every day. We all have antipathies or rivalries, but that doesn't mean we are all shooting at each other all the time, everywhere. There has to be a REASON for engaging in battle. Secondly, there has to be a consideration or balancing of risks versus rewards. If I'm a thief, for example, I'm not just going to go around shooting at every police car I see, just because they are "the enemy"; I will try to avoid them, in fact, and try for them not to notice me.
    • It seems to me that currently AI is just about flying and shooting. No part of the cortex is modeled at all.
    • You could argue that "it's war"; but no, it isn't. If I fly into Korath territory, for example; are the Korath and the Humans at war? No. There's no reason for them to attack me. Perhaps they should be bothered. Perhaps they should have a chip on the shoulder, and be ready to explode in anger and violence at the slightest; but there is no reason for automatically attacking. Yet, this is the behavior, not just of the Korath, but of most (if not all) species towards all their negative standing others: just start shooting; ask questions later. It does NOT make for interesting gameplay; let me tell you. Maybe it appeals to some adrenaline junky kids raised on McDonnald's "food" and cheap pizza, with excessive omega-6, and insufficient omega-3 and terribly deficient vitamins B-12, D and K, as well as potassium and magnesium.

The dumbness of the current AI gives the game a very cheap, arcade feel; admittedly not so bad as to make one quit playing the game; but the reason one keeps playing it is curiosity about all the stories yet uncovered and systems undiscovered; I most definitely don't keep playing because I enjoy the action in space, in any way, shape or form; I keep playing in spite of it.

Related Issue Links

For absolutely excellent ship specialization, I recommend playing the ancient Masters of Orion 2.
For amazing fleet battle complexity in space, I recommend playing Homeworld.
For magical ambience and engrossing immersiveness in a space trading game, I recommend playing the ancient Privateer.

Desired Solution

AI should be understood as something MUCH bigger than just the ability to fly, aim and shoot.
It should aim to

    1. fool the player into believing that every NPC is a real, human player, out there in the internet. Actually, no; it should aim higher than that ... What I mean is this: A human player out there in the internet might have nothing to lose in dying ... Just re-spawn! An AI, however, should act as if it considers its own survival above all else; unless it is actually flying with a military fleet; in which case obeying orders technically comes before survival of self. But certainly pirates would place their own survival above all else, rather than fly kamikaze the way they do in ES currently.
    1. fool the player into believing that it actually "thinks", "reasons", by, for example, changing strategies when what it's doing is not working.
    1. fool the player into believing that the AI actually has a goal it is trying to achieve, rather than shooting like a mindless idiot on a rampage. The best way to fool the player this way is for it to actually have a goal ... AND a plan
    1. when things are not going well for the AI, it should be smart and retreat, try to escape; not just keep shooting till death do us stop.

Alternative Approaches

I have never programmed neural networks, though I have a basic understanding of how they work.
In this case, I think that if the number of goals for AI's is a relatively short list, and if NPC perception of other ships (sight and/or radars, sensors) can be expressed succinctly, a new faction could be thrown into the game, with whatever set of allegiances, who are there just to learn. First learn to survive. Then learn to achieve goals. Finally learn to set goals.
Then, with that basic AI as a starting point, race-specific behaviors could be trained into it, to serve as the AI's of the different factions.
I don't think this would take huge neural networks. Probably 4x4 planes of neurons, a few levels deep, that can be accelerated using XMM instructions to take less than a microsecond per simulation frame.
Just an idea; it could also be coded in C++, too, probably.
But the important part would be to have one set of code or neural network for flying; another for aiming and shooting; another for goal setting, or rather for goal exploration; another for planning, given a goal and circumstances; another for feasibility or likelihood of success; another to consider the risks. Each could be just two or three lines of code, in the simplest implementation; but at least have these elements there, however simple they may be.

Additional Context

Improving the AI could have dire consequences to game-play, it needs to be said and considered.
It would be foolhardy to expect new AI to simply replace the old AI and everything be okay.
OF COURSE there will be problems to resolve.

Attackers will often NOT attack, but when they do they will attack when they know they have a good chance of winning, and they will be right more often than perhaps desirable. There's something to be said for the cheap fun of hordes of zombies attacking you with no chance of success; it can be a laugh, once in a while, (and who knows, perhaps there could be a race in the game that have zombie AI, just for laughing; what it should NOT be is the default AI for every race.)

But so, anyways, I think that a much improved AI would call for a corresponding decrease of spawning rates, for starters.

Another thing the game needs, in my opinion, is slowing down the pace in space. Huge battles happen in seconds, in ES, that would probably span hours in the real world. With battle happening in realistic time, you could, for instance, tell to each of your escorts what to do, much like in Homeworld. I fly all the time with Caps-Lock on, and I think of it as "time-compression", and I'm all for having the feature; however, when battle begins, time compression should automatically turn itself off, and it should be a lot slower; like a 10:1 difference, or more. Then, the specializations of ships in your fleet, and battle tactics, would add multiple dimensions to space battle. There would be entire papers written and videos advocating this or that set of specializations and strategies and ship commands when fighting against faction such and so. It would become "an intelligent game". But by the same token, you could not be having one such battle every other jump; battles would be fewer and farther in-between; almost always predictable or known in advance.

I have heard that larger systems have been proposed, already. That would be part of the solution in slowing down and complexifying the space-flight experience. Somehow, Privateer (Wing Commander) was a game where flight was indeed a complex and engrossing experience. Each system had a "personality". Some were full of dangerous flying rocks. Some were full of pirates, or bounty hunters, or retros (religious fanatics), and you knew all the systems like the palm of your hand, and sometimes concocted flight paths to avoid major dangers. You could traverse a system in seconds using Auto, but it almost always led you to trouble; it was better to fly manually, even if it took long minutes to get through.

Improved AI, and slower battle mode, together would make this game appeal to many more people and be a real joy in terms of game-play, and not just in terms of story.

@mOctave
Copy link
Contributor

mOctave commented Nov 8, 2022

But certainly pirates would place their own survival above all else, rather than fly kamikaze the way they do in ES currently.

Actually, the vast majority of pirates have the coward personality flag. They will abandon their fleet and flee the system if their health drops too low. Of course, pirate interceptors and light warships can still get wiped out in seconds if you have a strong enough fleet, which means that the coward attribute doesn't do too much for them in the late game. Perhaps a cautious flag, which made the fleet flee if there was more weapon capacity or something similar in all the ships of their enemies than in all the ships of their allies, could be a solution to this.

Overall, AI is certainly something that is improving, but, since this is an open-source game that intends to be fairly low resource-intensity-wise, it will probably take a while (several more years, at least) to get to a point where the other ships are indistinguishable from people.

@ChuckStarchaser
Copy link
Author

Touche. And yes, perhaps a flag is all that is needed. I tend to make things sound complicated by over-explaining.

@Zitchas
Copy link
Member

Zitchas commented Nov 8, 2022

I generally agree with this, with a caveat. In terms of pirates, which are the general universal enemy of almost everything, it'd be nice to see some variation: The majority of the pirates should be, as you say, smart enough to pick and choose targets. The sparrow pirate shouldn't be madly attacking the carrier, for instance. They should arrive, take a good look at the behemoth with all its weapon hardpoints filled, and go "I think I'll look elsewhere, thanks." On the other hand, I do like having some enemies that are just things that can be freely killed without consequence or second thought.

To use EVN as an example, there were three "pirate" groupings:

  1. The not-really-pirates but more like merchants who would opportunistically take illegal jobs. These were generally friendly to both pirates and law enforcement.
  2. The smart pirates. Ones that would avoid heavily armed ships, and generally left the ones in 1 alone, and generally acted like they were out to make money, not die.
  3. The beserkers. Basically like the Reavers/Ravagers in Firefly. Attack anything and everything, not friendly to anyone, even other pirates will try to kill them. These were the rarest pirates, but provide some fun arcade style "here's an enemy you can just have fun killing without worrying about how it affects your rep with anyone else."

In short, while it'd be really nice if most of the pirates and illegal activity was in categories 1 and 2, I do think we should always retain some amount of group 3, just for the fun of it. This could also be improved by changing loadouts. Currently, we have a lot of variants that are outfitted as if they are intended to be part of a fleet. Having an interceptor min/maxed to the limit with enough weaponry to put the hurt on a medium or heavy warship is fine if they are escorts for some larger looting ship, and they're only there to deal with a target's escorts. But they have no business being a solo pirate since they have no space to loot anything (and insufficient crew to capture, either). Not to mention that no ship intending to loot or capture freighters has any business using heavy rockets, but I digress. These do, however, make great ships to have as type 3 we're-just-here-to-kill-stuff rampagers.

In other words, we need to revist the weaponry on a lot of the pirate ships to ensure that they are outfitted appropriately for people intending to disable their target and actually take loot from them. This is quite a bit different from being equipped as the best warfighting DPS dealer they can be.


As for the speed of battle... Yeah, I agree. This was one of the things I tried to deal with in the Revamp PR. (Note: This was a test-bed PR that aimed to facilitate testing a lot of ideas at once, and wasn't intended to actually be merged. Although that being said, many of the things included in it were, eventually merged) Some of the many things that PR tried out included:

  • Massively increasing the mass of big ships to slow them down.
  • Decreasing the mass of fighters, drones, and interceptors so they could actually do preliminary raids and tactical movement.
  • Fighters were given strafing capabilities (as in sideways thrust) as well as AI that would use it to try to focus their attacks on the engines of the target ship, and thus stay away from the guns at the front of the ship. This increased their survival rate hugely and made them much more challenging to fight against.
  • Almost all weaponry was slowed down: Half the rate of fire, projectiles had half the speed, but did double the damage and double the duration. (so effectively the same range, but more space between shots. Each shot hurt more, so dodging was both more possible and more rewarding, but overall DPS remained constant.)
  • Early implementation of arrival distances, so enemies often started out with most of the system in between them.
  • Formations (fleets would generally fly in a V formation, so they moved together and visually could be identified as being a fleet)

The net result of all this was that combat usually began with fleets being a long ways apart. So combat started with fighters racing ahead to harry, followed by missile barrages and long range weaponry as they came into range, and only after quite a while after that did the fleets actually make contact and settle into the typical death balls.

Obviously, it didn't solve the combat; but it did spread it out into distinct phases, and made it possible to see how one could optimize ships (and even position them) to keep their distance, provide long range or mid range artillery/missile barrages, etc. It also made skill at flying much more rewarding, and lessened the pressure to just fly with a fleet and let the AI do the fighting. Combat felt more cinematic, and one could watch fights develop instead of just having it errupt randomly when a ship warps in on top of someone else.

It also made it both harder and easier to avoid pirates: Harder, because one arrived at the outskirts and had to fly in to the planet, which gave time for pirates to arrive and engage, and the superior speed of interceptors meant they actually had good odds of intercepting. On the other hand, since one arrived far enough out to see what was in-system before being on top of it, noticing that there were hostiles and turning around to run was also much easier. So it makes for an interesting trade off.

@ChuckStarchaser
Copy link
Author

ChuckStarchaser commented Nov 8, 2022

"Combat felt more cinematic, ..." This test-bed PR sounds wonderful.
I think the problem is we have a tendency to think that "slow" is bad, that "taking longer" is boring.
If you ask your customer, the customer always wants faster, faster ... But they don't really know what they want.

One of the most, if not THE most profound gaming experience of my life was TFX - Advanced Tactical Fighter Experiment.
It was a flight simulation game from the DOS days, very low polygon AND low resolution graphics (there was no NVIDIA those days, yet, and not even the VOODO chip existed yet ... way before any 3D hardware), but everything else was super-realistic: Avionics, aerodynamics, weapons systems, fuel consumption, missile locks, radar scanning modes, bands, enemy AI, wing-man AI, refueler AI, AWACS AI, civilian aircraft AI, ... EVERYTHING was as it should be. There was NO SUCH THING as time compression, or pausing the game, or any excuses from absolute realism. If a mission took an hour to get there, and an hour to get back, you'd typically ignore anyone knocking at your door. Told my friends not to call me; that I'd call them. The game was also, what's the term? "Hard core"? If you die, there is no reloading from save-file; there is no restarting the mission. Dead means dead. You have to create a new pilot and start again from the very beginning, with the academy part of the game. Harsh, given it took well over a month of playing to finish all the campaigns; and there were more dangers than just enemy fire; you could bump into a wing-man, or have a fatal refueling accident, or a bad carrier landing.
But each mission you got, after the briefing, you had a chance (and were encouraged) to practice the mission on the simulator.

Most people I talk to about this game they make faces like it sounds boring ... Nothing could be further from the truth; it was the most engrossing game I ever played. If you spent 90 minutes flying to your target, you spent the 90 minutes rehearsing in your head all the steps of what you plan to do when you get there, chewing your nails pondering possible bad scenarios, all while looking at the clouds pass by, checking you instruments, checking the AWACS data coming in ... I could not fly more than one mission per day, as much as I wanted to, because I needed to rest from the adrenaline. The best part of any mission, was flying back to base, as you could finally breathe and enjoy the view, instead of worrying yourself to insanity. It was SOOO enjoyable to fly back that you savored the flight time. Ahhh, mission accomplished! Look at those stars!

@Hurleveur
Copy link
Member

#7552 this should help making AI look smarter, and use its ranged weapons to its advantage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion for new content or functionality that requires code changes
Projects
None yet
Development

No branches or pull requests

5 participants