Return to “Suggestions”

Post

Procedural variety in NPC fleet tactics

#1
I'll start this thread by admitting that what really hooked me on this project was the video of the fleet combat and the RTS portion of Limit Theory. I enjoy the RTS genre more than anything else, and am very eager to see how Limit Theory shapes up on that front. I did run a cursory search through the Suggestions forum for this topic, but if it's already been brought up, then feel free to ignore/delete this post and direct me to the appropriate thread!

---

One of the most enjoyable aspects of RTS is putting theory into practice. You see your enemy's tactics, their fleet makeup, and think how you could defeat it. You buy the ships and kit them out, assign them roles to make sure they fly appropriately to their kit, and then let your fleet loose on the enemy to see how it works. Tweak, rinse and repeat.

But if there's only one enemy "fleet type," the gameplay can get stale pretty fast. Once you understand the AI tactics and weaknesses, it's easy to pick them apart by exploiting those weaknesses. The more variety you can include in AI fleet tactics, the more interesting the RTS element becomes. Are you fighting against an enemy sniper fleet, a tanky fleet, a high-DPS brawler fleet, a fighter swarm, or something else entirely? That's the kind of variation that would have me playing this game for days on end.

Based on ThymineC's post on assignable fleet roles, here's one way I can envision implementing AI fleet variety at a high level:
  • -Any combat NPC can be assigned as a commander. Ship size may influence level of command.
    -Each commander has a somewhat random (or faction-based) preference for fleet type.
    -Fleet type preference determines what ships the commander will allow in his fleet and what role he assigns to those ships.
This should result in NPCs procedurally building their fleets with a coherent doctrine in mind. The library of fleet types would need to be more or less hard-coded in this vision, but you can still get a great amount of variety of tactics with only a few pre-programmed fleet types.

Here are some sample fleet types and the roles an NPC commander might use, mostly based on my experience with EVE:
  • -Short-range brawler: mostly Interceptor roles using heavy ships
    -Long-range sniper: mostly sniper and support roles using nimble ships and low-DPS but instant- or fast-hit weaponry
    -Swarm/hive-mind: Sniper role capital ships with tons of interceptor role fighters
    -Spider-tank: Nearly 100% support role heavy ships, with an equal mix of guns and repair modules
    -Hit-and-run: Coward role bombers and coward/support role dedicated healers, intended to stay outside the battle and heal the bombers as they retreat
    -Kitchen sink: The most basic and easiest to deal with, allows any NPC and assigns simple roles based on size and equipment
---

Instead of hard-coding the fleet doctrines, there are a couple of proposed genetic algorithms to use during region generation that could achieve similar results. Assuming such a genetic algorithm were sufficiently tested and refined, it could produce varied, intelligent NPC fleet compositions given the available resources in the region.

What might this algorithm look like? Well, I'm no programmer, but here's a basic idea.

-The algorithm starts by looking at the factions within a region and their innate or evolved preferences. Those preferences can include ideas like value of life, value of tech, value of wealth, etc.
-Roll commanders for each faction based on the starting values, with each commander having some deviation in how picky they'll be when assembling their fleets.
-Assemble initial fleets for commanders based on faction wealth and commander pickiness / ship type preference. High value of wealth and tech will influence ship and module choice. (Fleet assembly should also depend on resource availability within region - does this region contain plutonium for missiles, unobtainium for advanced shields, etc.)
-Compose tactics for each commander. Somehow, the tactics should try to conform to ship choice, or vice versa. Value of life should strongly influence tactics as well - high value of life means a ship that's likely to die quickly will score very low. Low value of life means ship death is irrelevant and only victory matters.
-Simulate battle using metrics as close to player-influenced combat as possible. Some metrics to consider:
  • **Time spent within optimal range and firing arcs
    **DPS within optimal range and firing arcs
    **Target priority
    **Relative speed of priority target/attackers
    **Relative optimal range of priority target/attackers
    **Heal rate of priority target including remote healers
    **Retreat value (if relative speed higher than pursuers; if lower, then retreat value roughly 0?)
-If a fleet commander loses a battle by retreating, he can remain in the pool to try another battle. On the other hand, if he dies, then he's done. Repeat the algorithm with the remaining pool of commanders, using victory/defeat scores to influence commander preferences for ship type and tactics.
Image An interesting side effect of this "fleet type preference" is that it has great potential to drive the regional economics of the game. Scarce resources that are required for building towards the faction/region's preferred fleet type will be very expensive and lucrative to either produce or transport.

Open to suggestions!
Last edited by fatmop on Tue Jan 21, 2014 12:44 pm, edited 6 times in total.
Spacecredentials: looks at stars sometimes, cheated at X-Wing vs TIE Fighter, killed a titan once.
Post

Re: Procedural variety in NPC fleet tactics

#2
Almost totally agree, but instead of hardcoding in fleet types, why not let the NPCs naturally develop fleet types through experimentation? There could be thousands if not millions of battles that occur over the course of history generation. They wouldn't need to be simulated in great deal - the computer just assesses the relevant factors involved and determines the outcome of the battle algorithmically. But if the NPCs experiment with different types of weapon/shield/armour combinations or different fleet configurations, then those with poor setups will be killed and those with good setups will survive - survival of the fittest. Over time, this should naturally produce NPCs that use intelligent, sound strategies, like attacking shield-heavy ships with laser or plasma weaponry, or using something like a spider-tanking fleet setup.

Hopefully. Depends on how smart the NPC learning algorithms are and how fast history generation can be done. Assuming that it takes 100ms on average for a typical computer to throw about a bunch of numbers to simulate (in low-resolution) a battle and calculate its outcome, you could simulate 100,000 battles in under 3 hours. I would certainly willing to wait a few hours or even half a day if the end result was a living, breathing universe with intelligent NPCs that I could lose myself in for weeks or months.
Post

Re: Procedural variety in NPC fleet tactics

#4
fatmop wrote:I like that! If you want each faction to have a unique twist, you could give the algorithm a slight weight towards features like range, tank, DPS, etc. during generation and see just how varied the results become.
Nope, not even necessary! Because it will still all arise naturally. Different factions will originate and be based in different regions of space. Different regions of space will have various materials available in different levels of abundance. This naturally means that some factions will have better access to some resources than others. Combined with the infinite-variety crafting system I proposed in Additional Thoughts on Research and Production, these factions will be producing components using different combinations of materials and therefore subcomponents. This will mean that different factions will develop components and systems that tend to have different strengths and weaknesses relative to the components developed by other factions. This, in turn, will mean that the ships that faction A develops will tend to be of a different "flavour" to the ships that faction B develops. And, taking this all to the logical next step, this will mean that faction A will probably favour some kind of fleet tactics while faction B will favour others.

To a simulationist like me, it's important the internal consistency is maintained and that "internal cause is king" (link). If all of these systems are implemented, it may be possible to see all this variety and diversity evolve out of the establishment of these basic principles without the need to hardcode anything.
Post

Re: Procedural variety in NPC fleet tactics

#5
In theory, I am perfectly fine with that solution. It sounds awesome. Hopefully there is enough time in the development schedule to test whether sufficient fleet variety occurs in simulation.

Edit: I'm not a simulationist, and although it all sounds like an amazing emergent experience, I'd hate to see actual gameplay sacrificed on the altar of the kings of internal causation. Still, that's what testing is for.
Spacecredentials: looks at stars sometimes, cheated at X-Wing vs TIE Fighter, killed a titan once.
Post

Re: Procedural variety in NPC fleet tactics

#6
I've always liked the idea of doctrine differences. Too often games try to create factions where they all just make ships that are minor variations of a theme. It would be much more interesting if the factions had fundamentally different fleet doctrines. Faction A likes battleships with a small fighter screen. Faction B likes fleets of guided missile cruisers. Faction C likes swarms of torpedo boats. Faction D goes for the carriers with massed wings of fighters/drones.

EVE was quite fun in that regard, with fleet doctrines that focused on specific capabilities of a small handful of ships.
ThymineC wrote:Almost totally agree, but instead of hardcoding in fleet types, why not let the NPCs naturally develop fleet types through experimentation? There could be thousands if not millions of battles that occur over the course of history generation. They wouldn't need to be simulated in great deal - the computer just assesses the relevant factors involved and determines the outcome of the battle algorithmically.
Ask Gazz how easy it is to develop a turn based model that accurately simulates the results of real time combat. I really do not think the history generation could create anything that would function realtime.
Post

Re: Procedural variety in NPC fleet tactics

#7
If the resources to build weapons are sufficiently varied, and their limitations on technology are severe enough, you can probably still get doctrinal variation. For example, let's say the relative frequency of plutonium for warheads is very low in most space, but very high in a particular sector. The faction from that sector is far more likely to use missile-based doctrines than its neighbors. Same for any module group - lasers, remote shield repair systems, projectiles, thrusters, railguns.

However, you're right about the turn-based simulations. They're bad abstractions of what's actually happening in ship-to-ship combat, unless your GPU devotes a ton of cycle time to simulating microsecond turns. At some point, you run into diminishing utility when trying to simulate historical battles, and for gameplay's sake it might simply be better to hard-code fleet type preferences. That doesn't mean every fleet of a type is going to look the same! It does mean that there is some "ideal" that an NPC commander is wishing for.
Spacecredentials: looks at stars sometimes, cheated at X-Wing vs TIE Fighter, killed a titan once.
Post

Re: Procedural variety in NPC fleet tactics

#8
I've also long liked the idea of doctrinal differences, but at a level up from hardcoding ship/fleet types -- I prefer to see strategic, operational and tactical choices flow from fundamental cultural attributes.

For example, take the value a culture places on the worth of the individual person. A culture for which that's important might choose to produce a relatively low number of vessels that have plenty of high technology and defensive capabilities. Those craft would be pretty expensive, but they'd do a pretty good job of protecting well-trained pilots and crew, and their typical operational model would be the precision strike. (They might also specialize in remote warfare, such as through drones.) Such a culture, which values individual initiative, would probably favor tactical competence over strategic insight, since the latter tends to objectify people as mere numbers and markers on a map.

Another culture that places less importance on the value of the individual might converge instead on a doctrine of throwing a relatively large number of relatively cheap units at opponents. From that cultural perspective, their core military strategy would likely emphasize mass production and numerous distribution channels, and the most common operational pattern would be their species equivalent of "human wave" attacks -- throw everything including the kitchen sink at the opponent to try to overwhelm them. (Basically zerging them.) The lack of value placed on individual units would tend to minimize tactical competence, but surviving units would (of necessity) have a very high level of resourcefulness.

Those are just examples. Other kinds of cultural attributes (curiosity, work ethic, pacifism, etc.) might lead to variations on these strategic, operational, and tactical choices, or to different kinds of choices entirely. Those choices are what would produce ship types, as well as how those ships are used.

Randomly giving preference to certain ship systems (weapons, defenses, research, engines, etc.) and calling it a "doctrine" would be simpler, certainly. But not as much fun!

Oh, and while I have zero objection to real-time personal ship combat, at anything larger than 10 or so ships (or multiple fleets) I hope to see a Pause-Indefinitely button for collecting information, analyzing it, forming plans, and giving orders. "Real-Time" and "Strategy" are mutually exclusive. ;)
Post

Re: Procedural variety in NPC fleet tactics

#9
CutterJohn wrote:Ask Gazz how easy it is to develop a turn based model that accurately simulates the results of real time combat. I really do not think the history generation could create anything that would function realtime.
Isn't Josh going to need to do something like this anyway to simulate events happening in systems far away? LOD and all that.
Post

Re: Procedural variety in NPC fleet tactics

#10
ThymineC wrote:
CutterJohn wrote:Ask Gazz how easy it is to develop a turn based model that accurately simulates the results of real time combat. I really do not think the history generation could create anything that would function realtime.
Isn't Josh going to need to do something like this anyway to simulate events happening in systems far away? LOD and all that.
I imagine so. All I'm saying is that you couldn't actually draw conclusions about what works and what doesn't from it. The ships/fleets/tech would certainly get refined, but only in the context of the turn based model. As soon as you transferred those assumptions to realtime, they would suffer significantly.
Post

Re: Procedural variety in NPC fleet tactics

#11
The question is is the simulation will be close enough to allow useful prediction of "live" combat.
Simulating events at a generous timestep (30 sec steps in X3) glosses over a lot of the finer points so you may lose entire features that can not be evaluated at all and therefore don't "score".
There is no "I" in Tea. That would be gross.
Post

Re: Procedural variety in NPC fleet tactics

#12
Gazz wrote:The question is is the simulation will be close enough to allow useful prediction of "live" combat.
Simulating events at a generous timestep (30 sec steps in X3) glosses over a lot of the finer points so you may lose entire features that can not be evaluated at all and therefore don't "score".
Oh, is that how it's going to be done? I was assuming something where you just have two fleets approach each other and all it does is crunch all the numbers together and produces an outcome from it. For instance, Endless Space had a system where you could play out a battle in real-time, or just click a button and "auto-resolve" it.

A complicated but potentially helpful way of going about it would be to construct different battle scenarios, and play out those scenarios in two ways: one in which the battle is resolved in real-time like it would for the player and one in which it is resolved algorithmically. The aim would be to try to get the two outcomes to be as close to one another as possible. If you allow the algorithms involved to be tweaked and refined using genetic algorithms, it would free up Josh to work on other things. I'm not sure how practical this would be, though.

Aspects of a battle that may be lost by simulating it with large time-steps could be captured by using the algorithmic approach by tweaking constants and variables in what would seem to be arbitrary ways, but which actually help make the algorithms better at modelling battles. It also has the potential to be a lot faster than simulating battles, even with generous time-steps.
Post

Re: Procedural variety in NPC fleet tactics

#13
ThymineC wrote:Oh, is that how it's going to be done? I was assuming something where you just have two fleets approach each other and all it does is crunch all the numbers together and produces an outcome from it. For instance, Endless Space had a system where you could play out a battle in real-time, or just click a button and "auto-resolve" it.
Endless Space combat was turn based even if you played it yourself, so the simulation and the real time would not be notably different. The only change is the computer chooses what cards and what order to play them instead of you doing so.

In a game where the bullets are actual projectiles, missiles actually track, etc, any 'auto resolve' simulation is going to be a very rough approximation of what goes on. This is good enough to keep things going in the universe, but is not good enough to make useful or functional evaluations of what tech/tactics/etc work in real time combat.
Post

Re: Procedural variety in NPC fleet tactics

#14
Gazz wrote:The question is is the simulation will be close enough to allow useful prediction of "live" combat.
Simulating events at a generous timestep (30 sec steps in X3) glosses over a lot of the finer points so you may lose entire features that can not be evaluated at all and therefore don't "score".
A huge problem here was also that ships weren't firing at each other at the same time, and that weapons were too powerful in regards to the possible defences/hull.
Beware of he who would deny you access to information, for in his heart he dreams himself your master.
Post

Re: Procedural variety in NPC fleet tactics

#15
ThymineC wrote:Oh, is that how it's going to be done? I was assuming something where you just have two fleets approach each other and all it does is crunch all the numbers together and produces an outcome from it. For instance, Endless Space had a system where you could play out a battle in real-time, or just click a button and "auto-resolve" it.
I don't know.
Are you proposing an even larger timestep of "the entire battle"? It's all a matter of resolution. *shrug*
There is no "I" in Tea. That would be gross.

Online Now

Users browsing this forum: No registered users and 15 guests

cron