Close combat units

Close combat units

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
hangyaoy
Posts: 4
Joined: 27 Jul 2016, 11:33

Close combat units

Post by hangyaoy »

Sorry for trivial question.

Can I create close combat units in spring engine?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10329
Joined: 24 Jan 2006, 21:12

Re: Close combat units

Post by PicassoCT »

Yes, but animations are difficult

To elaborate more in depth. Spring provides no adhoc physical simulation for "real" close combat, cause nobody can do that reliable.

Most rtses use instant hits.
Animations are either broad (huge swing, generic hit animation), allowing for units to be still free moving. Or coupled animations, where one unit basically transports the other during engsgements(Finnish moves in dawn of war).

A third option in theory was to have kinemTiks for the units run on a gpu and have real ragdoll physix per unit.

Did not see that anywhere yet.

Close Combat has priority for me though. All the visually appealing combat in cinema is either close combat or close ups ob Ranged Combat. We didn't venture into the savannah for artillery duels.
User avatar
ThinkSome
Posts: 342
Joined: 14 Jun 2015, 13:36

Re: Close combat units

Post by ThinkSome »

The Cursed has them.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10329
Joined: 24 Jan 2006, 21:12

Re: Close combat units

Post by PicassoCT »

Cursed them for their sudden but inevitable betrial
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

Invisible lasers work well for this.
User avatar
azaremoth
Cursed Developer
Posts: 543
Joined: 17 Feb 2005, 22:05

Re: Close combat units

Post by azaremoth »

I did use invisible Cannon type weapons in the Cursed. That also works nicely.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10329
Joined: 24 Jan 2006, 21:12

Re: Close combat units

Post by PicassoCT »

If you want to get drastic, both types should work.

Spring.GetUnitLastAttackedPiece

Should give you the last attacked piece, and if you follow the piecemap down recursively allow you to sever arms, heads and legs. Plausible animation afterwards might be difficult.

Ps, you can e en drop limbs to the floor. Just reverse all unit rotations from root up to the limb and then treat it like aphysim
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

Honestly not really needed. You can use hitbyprojectile or whatever it's called and have sparks, blood, oil, etc fly when the unit is hit.

I would say invisible lasers is better because no possible drop and they don't suddenly just not hit if you give them insane velocity (like cannons).

Technically we have a hitscan weapontype, but it's garbage.
hangyaoy
Posts: 4
Joined: 27 Jul 2016, 11:33

Re: Close combat units

Post by hangyaoy »

Thank you for the answers.

I don't want physical simulation. I'm perfectly happy with an RPG like instant hit. Random damege between min and max SP or missing, based on attack / defence.

But if I understand good. There is no close combat unit implemented.
I can create a very short range invisible cannon or laser, and I have constant dps. (local weaponDefs=...) Wich isn't realy bad, this would do for now.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

Technically the only difference between spring and any other engine is that we don't really have a hitscan weapon that is worth a crap, but an invisible laser or cannon projectile that is super close range with say 10k velocity is effectively hitscan. As a result, there never has been much of a push for hitscan weapons.

That said, personally I can think of a bunch of scenarios where my life would have been easier with a hitscan weapontype.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

I mantised a feature request for it:
https://springrts.com/mantis/view.php?id=6354

I wouldn't necessarily hold my breath for it to happen, but I can think of multiple situations to where I would find it useful.
Google_Frog
Moderator
Posts: 2448
Joined: 12 Oct 2007, 09:24

Re: Close combat units

Post by Google_Frog »

Technically the only difference between spring and any other engine is that we don't really have a hitscan weapon that is worth a crap, but an invisible laser or cannon projectile that is super close range with say 10k velocity is effectively hitscan. As a result, there never has been much of a push for hitscan weapons.
I disagree, based on my understanding of the definition of hitscan. An invisible laser with a properly set up LUS and appropriate parameters is exactly an instant raytrace damage type, ie a hitscan. You have control over what it hits with tags like collideEnemy.

I think you're requesting a weapon that instantly damages a target in range regardless of raytracing checks. This could be useful, since changing the range of BeamLaser to non-spherical is tricky. That said, I have messed around with making agile melee units with BeamLaser, and have never had problems.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

Well, as I said earlier and in my request, lasers also will sometimes not impact the target, even if it is inside their range. The faster the laser, the more erratic the behavior you end up with. Even with the tag enabled that does the extra checking. With a stupid fast laser, it's somewhat unreliable, therefore a hitscan weapon is desirable. Additionally, it's useful for things where you want instant effects, like spellcasters as an example.

I requested the ability to have it hit, ignoring terrain, which would especially be useful for spellcaster units so that the spell can be cast wherever you like and you don't have to worry about whether you have LOS on the target area.

In my request I requested that it be possible to define a hitceg like we have for other weapons. Firing animations are all triggered in the script anyway so those aren't a concern.
I think you're requesting a weapon that instantly damages a target in range regardless of raytracing checks.
This is the definition of a hitscan weapon, yes.



There more serious thought I put into a hitscan weapon, the more I see it's usefulness and utilitarian purposes.
Google_Frog
Moderator
Posts: 2448
Joined: 12 Oct 2007, 09:24

Re: Close combat units

Post by Google_Frog »

I think you're requesting a weapon that instantly damages a target in range regardless of raytracing checks.
https://en.wikipedia.org/wiki/Hitscan
A hitscan in computer games, most commonly in first person shooters, is where the programming system determines where the gun/ object is pointing, casts out a ray in that direction when shot, for a certain range programmed into the system, and see if that ray comes in contact with any object in the line of fire. Hit scan is a term that could also be classified as “hit instantly” because it instantly hits the target when shot.
I don't disagree that what you are describing sounds like a useful feature, I just think it is important to get the name right when requesting the addition of a named entity to the engine. Every definition of hitscan I have found refers to raytraces, which makes BeamLaser a suitable replacement. If a new game or engine dev sees a weapon type named HitScan, then I would expect them to think it involves raytracing. I'd call what you are requesting something like NoTest or InstantHit.

It also sounds like you have been trying to implement instant weapons with a LaserCannon. Of course, LaserCannon will miss since it has speed, for now you should use BeamLaser instead. I do not know of a relatively lua-free ways to make a spellcaster that instantly casts a spell at a point. You can make a BeamLaser aim through and ignore terrain, allies, and enemies, but then the projectile would not explode.
sprunk
Posts: 86
Joined: 29 Jun 2015, 07:36

Re: Close combat units

Post by sprunk »

Spring supports Rifle, which is a projectile-less raytrace: https://github.com/spring/spring/blob/d ... le.cpp#L25
And Melee, which just deals damage unconditionally: https://github.com/spring/spring/blob/d ... on.cpp#L10

Those could potentially become useful with some tweaks:
  • Rifle suffers from hardcoded low-quality particles. Here's a PR https://github.com/spring/spring/pull/489
  • Rifle disobeys collision flags. Here's a PR: https://github.com/spring/spring/pull/490
  • Both suffer from poor ground hit detection. All you can do at the moment is to poll the weapon for its target when it fires but that doesn't take ground collisions into account. Unsure what the interface should be (probably call Explosion?).
Google_Frog
Moderator
Posts: 2448
Joined: 12 Oct 2007, 09:24

Re: Close combat units

Post by Google_Frog »

Since it is possible to make a BeamLaser invisible, what is the purpose of Rifle? If the difference is just in particle creation then it sounds more maintainable to make tags that prevent the creation of the particles and projectile.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

Can we stop trying to hack shit together to make something work and just get a proper weapontype for spellcasters? This would also solve the needed requirements for melee weapons.
Wesbruce
Posts: 1
Joined: 05 Jul 2020, 23:47

Re: Close combat units

Post by Wesbruce »

I'm new here and still learning, relearning, the game.

It sounds like people are talking about the old Kill Box solution back before ray tracing was invented and when 64 bit memories were considered big. The wikipedia page is not going back far enough. A box, any shape, attached in front of the unit big enough to clip into the foes hit box. If 'Foe in kill box' = true it triggers animations for both units, strike and hurt and deals damage. In spring that would just be a mesh with no texture and no collide and a kill Box or Hitscan flag. A relatively simple script.

The problem is triggering the animations; strike and hurt or block at the same time. Firing precedes hit in ranged but in Melee the animations need to be closer to the same times. Same with some magic.

In second life they started with ranged combat and turned in into Melee with big bullets with almost no speed but only a few ticks life. Where is the bullet repository? do we have big fat bullets or are they all tiny?

There is another way to do this that may work. Add 4 emitters in a grid firing at once and all aimed down at the ground. Fire twice per melee animation cycle. If they hit the ground nothing happens. Slow bullets. Trigger the melee animation if Target nearest takes damage. Add a time delay of half an animation to foe damage display update. [Yes this will trigger animations of the foe got hit by an archer ] Aiming down at the ground means you can use a slower 'bullet'.

What's really needed may be:
Hitinmelee (So you play the right animation)
Blockmelee, (The other animation.)
Use hitbyprojectile to do the actual damage.

Note some units like cavalry will need two or more Hiscan or emitter arrays. One each side so he can hack the poor coot that got to close. Spears, pikes, lancers bayonets needs a downward array or hitscan at the tip of the spear.

Wrap it up in a package and call it a hitsan. [If only programming was that easy]
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14637
Joined: 17 Nov 2005, 02:43

Re: Close combat units

Post by Forboding Angel »

FWIW, a month after my last post, the commits that sprunk referenced were merged, making those weapontypes more useful/usable.
Post Reply

Return to “Game Development”

cron