CombatExtended-Continued / CombatExtended

Combat Extended mod for RimWorld
377 stars 254 forks source link

[Discussion]: Guided projectiles #361

Closed sumghai closed 3 years ago

sumghai commented 3 years ago

Although most ranged combat in CE occurs at pawn-to-pawn ranges with weapons that fire projectiles on a purely ballistic trajectory, guided projectiles could add a new element to gameplay:

Types of Guidance

Type Description Target Type Relative Crafting Cost Player Countermeasures
Manual/Command The firing pawn/turret continues to 'aim' the weapon at the target as it guides the projectile, without stopping to reload or switch targets All Low (+1 Industrial Component) Seeking cover and breaking line-of-sight
Fire-and-forget (Infrared) The projectile automatically seeks out the target's body heat emissions, freeing the firing pawn/turret to reload or switch targets Organic humanoid/animal pawns, vehicles with running engines Medium (+2 Industrial Components Decoy heat sources (e.g. fires, heaters, flares)
Fire-and-forget (Radar) The projectile automatically seeks out the target's electronic emissions, freeing the firing pawn/turret to reload or switch targets Mechanoids High (+1~2 Advanced Components) Very difficult to jam, unless the player builds jammers/dazzlers

Implementation

Ideally via a custom comp, so that it can be easily added to new/existing projectiles as required:

<li Class="CombatExtended.CompProperties_GuidedProjectile">
        <maxAngleChangeRate />
        <maxLifetime />
        <detonateAtMaxLifetime />
        <seekerMode />
</li>
Parameter Description Allowed Values Default (if unspecified)
maxAngleChangeRate Max angular change per tick/second of projectile Integer: 0~90 ?
maxLifetime Max number of seconds projectile has to seek its target before its guidance behaviour stops Integer: 0-? 10
detonateAtMaxLifetime Whether it detonates at the end of its max lifetime Boolean:
true (explodes)
false (reverts to unguided projectile)
false
seekerMode How the seeker operates Enum: manual,infrared,radar manual

Alternative approaches to tuning:

Additional thoughts

fors4ken commented 3 years ago

I like this idea a lot.

Should there be a distinction between radar and IR guidance?

Not sure about this. I just hope it doesn't end up as a bloated feature that no one likes/uses.

Tostov commented 3 years ago

It should be possible to set a guided munition as either fire and forget or as manually guided (and the systems for supporting that, such as making a pawn/turret continue to 'aim' the weapon without stopping to reload/switching targets).

Given that dodging isn't really going to be a thing, I think just a simple max angular change per tick/second parameter is probably entirely sufficent. Making it easy to set up is probably the most ideal way to do it here.

sumghai commented 3 years ago

Should there be a distinction between radar and IR guidance?

Not sure about this. I just hope it doesn't end up as a bloated feature that no one likes/uses. I brought up the subject of different guidance types so that it is possible to counter against them, discouraging players from simply bum-rushing research towards an "I win" button.

Perhaps there could be research/crafting cost differences?:

It should be possible to set a guided munition as either fire and forget or as manually guided (and the systems for supporting that, such as making a pawn/turret continue to 'aim' the weapon without stopping to reload/switching targets).

Oooh, I quite like this idea.

In a similar vein to my preceding comment, perhaps command/manually-guided systems are cheaper to build and unlocked earlier in the research tree, compared with fire-and-forget?

sumghai commented 3 years ago

Updated OP with feedback from @fors4ken and @Tostov.

@CombatExtended-Continued/coders @CombatExtended-Continued/playtesters - feel free to share your thoughts as well.

perkinslr commented 3 years ago

From a coding perspective, letting the projectile change x MoA / tick is the simplest approach, as is tying it to a marker like the Mortars currently use. Trying to decide "what's the warmest thing in X area" would be considerably less clear. In addition to the max lifetime, there should be a setting for what the projectile does at the end of the lifetime (detonates or just turns into a dumb projectile).

sumghai commented 3 years ago

Trying to decide "what's the warmest thing in X area" would be considerably less clear.

And potentially computationally expensive, if calculated across the whole map at regular intervals.

there should be a setting for what the projectile does at the end of the lifetime (detonates or just turns into a dumb projectile).

Perhaps as a simple boolean parameter?

detonateAtMaxLifetime: true by default, false for turning into a dumb projectile

perkinslr commented 3 years ago

Not likely to be that computationally expensive. You can cache the items of interest, so it's pretty close to O(1) with regard to the number of projectiles. But that does mean that the program complexity is higher, which increases the probability of errors.

And yes, a simple boolean is likely sufficient, if anyone can think of another behavior beyond "explode or become dumb" then it could become an enum, but I can't think of anything else. I suppose "land" could be a possibility for some munitions...

sumghai commented 3 years ago

Not likely to be that computationally expensive. You can cache the items of interest, so it's pretty close to O(1) with regard to the number of projectiles. But that does mean that the program complexity is higher, which increases the probability of errors.

Ah, I see.

And yes, a simple boolean is likely sufficient, if anyone can think of another behavior beyond "explode or become dumb" then it could become an enum, but I can't think of anything else. I suppose "land" could be a possibility for some munitions...

Yeah, a boolean would be sufficient. I'll update the OP in a sec.

For the purposes of RimWorld and CE, we can assume there are no dud rounds. And any suicide drone/missiles would probably be implemented as pawns instead.

Arcalane commented 3 years ago

Another potential element/reference for your first list could be Cyberpunk 2077's Smart weapons. Whilst they're not as powerful per-hit as regular firearms, they're significantly more accurate if used correctly. There's an added catch in that they require supporting hardware too.

Something as simple as 'requires a gunlink eyepiece, qualifying helmet (i.e. power armour), or any tier of bionic eye' could be a useful balancing factor for high-end stuff, if it's possible to check for that kind of thing without too much slowdown.

And yes, a simple boolean is likely sufficient, if anyone can think of another behavior beyond "explode or become dumb" then it could become an enum, but I can't think of anything else. I suppose "land" could be a possibility for some munitions...

Depending on the strength (or relative value/difficulty of creating) of the warhead you might not want it to automatically detonate or continue on to potentially detonate when it misses, especially if there's a risk of starting giant forest fires or something. Having projectiles that can land intact on a miss (% chance?) seems more like a thing for bows and similar low-tech weapons though.

ed: actually, 'create armed object' could also be useful as a general projectile behaviour, then you could add things like advanced grenades for grenade launchers. especially if you could do something like a grenade that detonates if it hits a pawn but turns into a timed or proximity grenade if it hits a wall.

If you were feeling adventurous, the ability for a secondary pawn to guide missiles using a handheld designator 'weapon' (similar to how binocs are supposed to improve mortar accuracy?) could be interesting. probably tricky to code though.