CanHitSource bugs/regressions (Some potentially serious)

Found a bug in the game? Post it in one of the applicable sub forums depending on the version you are using. Tech support is also available in the Tech Support subforum.
Post Reply
User avatar
Shrike
Fleet Admiral
Fleet Admiral
Posts: 2704
Joined: Mon Aug 17, 2009 4:27 am
Location: Scouting the borders of sanity (there's a lovely view of the abyss).

Thu Mar 05, 2015 3:29 am

I was trying to revamp the CRM100 for SM&M++, and I couldn't see why it wasn't working. Upping the damage of the fragments did nothing at all....it still required a direct hit in order to do any direct damage.

Then I noticed that the fragments coming away from it seemed to have explosions for graphics. This is odd, since that's not a default thermo thing, and the mines as a rule use default effects. In addition, odd graphical effects were appearing, as I would expect from a fragmentation weapon hitting a radius fragment. Quite odd all in all.

I presumed that this meant that the fragments were somehow being destroyed when they spawned, then remembered a time (years ago) when I blew myself up with a mine..... so on a hunch, I removed the CanHitSource attribute from the CRM100.

This immediately made the mine behave as it is intended to behave.


I think this means that the game not only sets the ship that fires a missile as the "source". It also has the missile itself, and by proxy, the fragments. As a result, a weapon that spawns a great deal of fragments (or a CanHitSource radius and several normal fragments) will spawn all those fragments at the origin (0,0 from the point of detonation). These will immediately interact and destroy themselves, leaving the hiteffects to continue out with the same lifetime/speed as the missile itself is supposed to have. Unless the weapon has made a direct hit at the front of a target (the class 'best case to prevent hit detection bugs' scenario in Transcendence), little or no damage will be taken. If a direct hit is made on the front or side of a target, the origin point will be inside the target, and the hit detection system will register all the damage at that one point, creating the usual overkill that you'd expect from this.



Solution: Make CanHitSource not affect fragments from the same munition/source fragment.
Last edited by Shrike on Thu Mar 05, 2015 4:14 am, edited 2 times in total.
Your friendly local genderqueer weapons designer & forum moderator. My pronoun is "They".

User avatar
Shrike
Fleet Admiral
Fleet Admiral
Posts: 2704
Joined: Mon Aug 17, 2009 4:27 am
Location: Scouting the borders of sanity (there's a lovely view of the abyss).

Thu Mar 05, 2015 3:58 am

Having examined this more, I think there's something else that's very wrong with the hit detection on fragments with CanHitSource. Fragments set with this attribute will routinely fail to do damage on a direct hit (when the "shooting itself down" bug doesn't crop up. I think. Unless it's removing the fragments but not removing fragments.):
CRMDerpOne.jpg
CRMDerpOne.jpg (209.49 KiB) Viewed 1587 times

Exhibit One. CRM500 mine with CanHitSource set as 'true' (AKA: Vanilla mode). Centauri Raider blocks or is hit by multiple fragments via a direct hit to the right-side gunpod. No damage is taken.
CRMderp2.png
CRMderp2.png (68.04 KiB) Viewed 1587 times
Exhibit 2. CRM500 mine without CanHitSource set as 'true'. Centauri raider is hit in roughly the same place, is blown apart instantly.



I'm not sure what's going on here, but the CanHitSource system appears to have some nasty regressions that have snuck in at some point.

(Also, the attachments system went crazy with this post. Think I've got it more or less fixed now though)
Last edited by Shrike on Thu Mar 05, 2015 4:18 am, edited 1 time in total.
Your friendly local genderqueer weapons designer & forum moderator. My pronoun is "They".

User avatar
Shrike
Fleet Admiral
Fleet Admiral
Posts: 2704
Joined: Mon Aug 17, 2009 4:27 am
Location: Scouting the borders of sanity (there's a lovely view of the abyss).

Thu Mar 05, 2015 4:12 am

Ok, an important bit for any modders reading this: DO NOT SET CANHITSOURCE AS TRUE ON ANY MAIN WEAPON.

Any standard weapon (as opposed to fragment) with CanHitSource="true" will hit the ship that is firing the gun on a certain % of shots. This basically makes the system a massive liability. It's part of the same bug that results in fragments shooting each other down....but it's much, much worse than that. It's a regression ( I think. Pretty sure I've used CanHitSource on a main gun back in 2012 or so and it worked fin) that may result in some of the more powerful modded weapons becoming massive death-traps for anyone who uses them.

To test: Take a regular beam weapon (eg. Heavy ion blaster), add CanHitSource to it. Then fire continuously. If you're using hierosteel, you'll see the hit effects bounce off you every so often. If you're using regular armor/shield, you will start to take damage.
Your friendly local genderqueer weapons designer & forum moderator. My pronoun is "They".

User avatar
Shrike
Fleet Admiral
Fleet Admiral
Posts: 2704
Joined: Mon Aug 17, 2009 4:27 am
Location: Scouting the borders of sanity (there's a lovely view of the abyss).

Thu Mar 05, 2015 9:36 pm

Important update: I've found that my own copy of the CRM500 was actually modded to produce extra fragments...a lot of extra fragments. I'd accidentally altered my source files as well so comparing them when I came back to testing after a long break made it look like it was a stock problem. This may not affect the stock CRM-series munitions as a result. However, it's still a bug that could use fixing.
Your friendly local genderqueer weapons designer & forum moderator. My pronoun is "They".

Post Reply