[edit: File has been updated so that the resolution isn't fixed to 1024x768]
I apologize for the length of the following post... I can't seem to help myself! I'll try to format it so that it's a bit easier to read.
Anyhow, I've been giving some thought lately to the combat system in GC2. To be honest, it's pretty dry... simple to understand, but it doesn't allow for a lot of variety or very interesting interactions between ships. It's pretty easy to find dominant strategies: just load up the largest hull you have with the best weapons and a proportionate number of defenses, and you have the most cost-effective, dangerous ship you can build. There's no need for mixed fleets, using different hull sizes, or even mixing up defenses and weapons (though I recognize that the latter is by design), and the battle viewer just isn't that interesting to watch... round after round of ships randomly flying in circles and hammering away at each other.
The system I would propose instead is more of a simulation of the combat instead of such a high level abstraction of it. Before I go into more detail, I realize that Joe Schmoe rattling off on an internet forum about what would make the "AWESOMEST GAME EVAR" is not particularily convincing, and that untested ideas are worthy of a fair bit of skepticism.
To that end I've prototyped my ideas for a GalCiv3 combat system in C++ to illustrate how they'd work out (you can grab the .zip at http://www.mediafire.com/?elmbc7r4zip.) It's 2D, but it still gets the point across. Since I neglected to stick a README into that, I'll put the controls up here:
- Use CTRL+L to load one of the predefined scenarios at any time
- Click on an object to have the camera follow it. Click on empty space to make it stop following.
- Mouse wheel zooms to cursor
- The - and = keys control the playback speed
You can also create new scenarios and change the weapon/ship definitions if you'd like... the file formats should be pretty straight forward (plain text, edit them in notepad, etc.), and this post is going to be monstrous ENOUGH without a tutorial for them!
- A deterministic system... given the same seed and the same starting conditions, every battle will always end exactly the same way. The test.txt scenario in the files linked above is an example of this... the battle always ends in the same configuration, regardless of playback speed or framerate. While not currently implemented, the battles could be entirely simulated without any rendering going on as a "skip battle" feature.
- Encourage ship variety
- Make the battle viewer more interesting without having to create a "director" that attempts to spruce up a more abstract system
- Make nods to the realism hinted at in the tech descriptions
- Make battles more unpredictable, so that outcomes feel less preordained
The playing field is an infinite space, where every major gridline (which has 10 subdivisions) represents a single lightsecond. Ships have a maximum speed (currently set to 0.01c) which mainly serves to keep them from getting into relativistic territory and removes most edge cases where the simulation would "hang" because two opponents were having trouble catching each other. Aside from that, movement is handled completely by newtonian physics, with a maximum acceleration determining ship agility.
A wrinkle in here that I've experimented with: every ship is assumed to be doing evasive manuevers to avoid incoming projectiles, and this is factored into most weapon calculations as an abstracted feature. Long story short, a quickly accelerating target is hard to hit at a distance if the weapon itself has a slow projectile speed.
Don't worry about the large distances and high speeds being problematic: it's all "under the hood". Ships and weapons fire are rendered large, the realism is only there to provide an underlying consistency to the simulation.
I really liked the GalCiv2 dichotomy between beam, kinetic, and missile weapons. However, I think it should be tossed up a little bit. The three basic weapon types should be in a rock/paper/scissors dynamic with each other: beam weapons can shoot down torpedos mid-flight, mass drivers will overpower beam weapons, and mass drivers will provide no anti-missile capabilities. This encourages ship and fleet variety, as a fleet armed with only one type of weapons will be easily countered.
I would also suggest light, medium, and heavy versions of each weapon, with the heavier weapons being more effective versus large targets while the lighter ones are better suited to taking out smaller fighters and corvettes, further encouraging variety in ship design. I'll explain how this would be achieved shortly. I've also experimented with a couple "odd" weapons. In the .zip, most of the heavier ships are armed with "Interceptor Missiles" which are high speed missiles with low yields, but the ability to take down enemy torpedos... it's really cool to watch, and they do the job pretty decently!
There are a few other wrinkles in the system that I have implemented in my simulator: beams and mass drivers have a chance to miss the target depending on the target profile (ie, how much surface area there is to hit), the projectile speed, and the maximum acceleration of the target. Beams will almost always hit, but mass drivers will miss a great deal at long range against small targets. Additionally, missiles spawn their own object when fired which then must obey newtonian physics to reach its target... once it gets close enough to the target, it deals its damage. Finally, beam weapons may be almost perfectly accurate, but their maximum damage degrades linearily over range. It's usually still enough to take down missiles at a distance, but closer range is preferable for dealing damage.
Again, I really liked how GalCiv2 handled defenses. The only thing I've changed is to remove the off-type defenses (since they were a complicating factor that didn't make a lot of sense... how's chaff going to throw off a mass driver?) and to remove the concept of "defense degradation". Every weapon hit needs to go through the armour/shields/point defense fresh.
This effect has the result of making weapons with higher per-hit damage more effective against well defended targets. As long as the defenses (shields, armour, point defense) are all too large to mount on the smaller ships, the larger vessels will thereby be characterized by their strong defenses. Heavy weapons will have the damage-per-shot to break through this, but the light weapons will mostly just glance off. On the flip side: lighter weapons will be most cost and space effective, so you'll have to bring lighter weapons to bear if you want to take on smaller ships effectively. Balanced correctly, this would strongly encourage the use of multiple hull sizes, since your dreadnaughts wouldn't be cost effective versus the swarm of fighters with anti-capital ships weapons! However, care must be taken to not allow ships to bring their defenses to too high a value, since without defense degradation it would become extremely difficult to pierce them with anything... a few points of defense will go a long way.
In the simulator I've provided, I've also implemented a concept of "weapon neutral armour" that defends equally against all weapon types (and presumably would be less cost effective). However, experimentation has revealed that it just doesn't work... it doesn't add anything useful, and different weapon types tend towards different damage outputs (ie, 3 points of deflectors are going to save you more HP than 3 points of point defense, since beam weapons tend to do their damage in small hits while missile weapons deliver one big blast.) The same effect would be better achieved by simply allowing components in GC3 to improve multiple defense values in differing amounts.
While I don't doubt that this'd make strategic decisions more difficult, the AI on the simulation side is surprisingly simple. The results I've already got are more than adequate, and in my case the ships are following a few simple rules:
- Move towards the opponent with the lowest percentage of their health remaining
- Aim to pass that opponent on one side at a distance that allows most of your weapons to fire
- Fire your weapons at any enemy that gets within range, regardless of whether or not they are your target
- Anti-missile capable weapons like lasers prioritize enemy missiles as targets
One can easily imagine extending this to formations or flocking behaviours, or even race specific tactical personalities.
The typical battle takes about 800 ticks (where 1 tick represents 4 seconds of "in-game" time), and that can be calculated very quickly. However, I've seen battles take upwards of 3000 ticks when two ships are unable to do damage fast enough. At some point, there will need to be a cutoff where the battle is simply left unresolved, and any surviving combatants get to live for another day.
Processing time is also increased over the GalCiv2 combat system. While it can still be resolved in only a few seconds in the most cases, it's still something to take note of. Ships loaded down with missile launchers can make things a little laggier!
Potential Extensions to the Concept
Detailed stat tracking during the battle is one thing to attempt: what types of damage are crippling your fleet, average survival time of a specific ship class, etc are all very useful tools for adjusting ship design and fleet composition.
Also, I haven't really looked at how "escorted" ships like troop transports would be handled. Having them flee the battle while everyone else fights would cause its own problems, but keeping them in the battle would mean they'd be vulnerable to a chance flyby... my guess is that the best thing to do is simply to keep them in the fray and let them potentially be destroyed. However, this is something to experiment with.
Congrats to anyone who made it through that monster of a post. I hope you like the prototype... I had a ton of fun making it!