Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: [1] 2

Author Topic: Beam Weapons & EMP  (Read 6085 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Beam Weapons & EMP
« on: November 26, 2012, 11:44:19 AM »

Ran into a weird issue, looks like a bug. 

Beam weapons that are doing EMP along with regular damage appear to be doing EMP-only damage if they hit Shields.  Not happening vs. Armor, other attack types don't appear to be having this issue. 

Was testing out stuff, and I have very minor EMP on the Phase Lance (the phasebeam-equivalent in Vanilla) and it never, ever, ever raised Hard Flux.  Was like a pure-EMP weapon.

Stats:
Code
Phase Lance,phasebeam,1,6500,1400,1300,,20,0,60,12,,,ENERGY,,225,0.5,1,,,,,,,2400,,,,,,20
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Beam Weapons & EMP
« Reply #1 on: November 26, 2012, 11:50:59 AM »

Without checking into it (yet), beam weapons never raise hard flux to begin with. Maybe that's that what you're seeing?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #2 on: November 26, 2012, 11:58:29 AM »

Ehhhhh??  So, like, it's not going to ever raise flux if the flux dissipation rate > beam damage? 

It does explain a lot about why I had to jack their DPS up to finally make them worth buying, though.  I thought it was just some weird issue with them not collecting their damage per frame or whatnot. 

That creates a lot of problems for me, though; it means ships that can lose a lot of Flux per second and have efficient shields literally just ignore that weapon entirely, instead of taking longer than usual to get chipped away.

Is this specific to all beams or just to beams with ENERGY as the damage type?
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Reshy

  • Admiral
  • *****
  • Posts: 1100
  • White
    • View Profile
Re: Beam Weapons & EMP
« Reply #3 on: November 26, 2012, 11:59:25 AM »

Beam weapons have a history of being underpowered and overpriced.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Beam Weapons & EMP
« Reply #4 on: November 26, 2012, 12:05:32 PM »

It's for all beam weapons. I'll probably look at making it moddable at one point or another, but it's a core mechanic, and changing it would need some UI support, too.

Beam weapons - in vanilla - have other properties that compensate for this. They hardly ever miss and are very flux-efficient. Thinking that the target ship is "ignoring" the damage misses an important point - it's both forced to keep the shield up *and* denied some amount of flux dissipation. Beam weapons also tend to have longer ranges, and are in general intended as support.

If they did do hard flux damage, they couldn't have the ranges they do now - or they'd be much too good for kiting. Basically, it's a way to give smaller ships longer-range support capability without making them automatically able to solo anything slower with zero risk, given enough time.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #5 on: November 26, 2012, 12:38:12 PM »

Well, I did the opposite; beams are intended for midrange / assault unless using HEF. 

Kind've made more sense than making them kite monsters, other than allowing for glass-cannon HEF ships whose shields are down and take more damage.  This mechanic kind of upsets the apple cart vs. anything with high dissipation rates. 

It creates true invulnerability scenarios for this weapon type if balance moves much outside a very narrow range.  Moreover, there are damage numbers showing shield damage that isn't actually happening, which makes it unintuitive.

And in Vanilla right now, with the introduction of skills, it's probably causing more problems than it solved.  For example, a 100-Vent ship can shrug off pretty much any amount of beam fire once Hard Shields / char. skills are in place, amongst other things.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Beam Weapons & EMP
« Reply #6 on: November 26, 2012, 12:56:45 PM »

Well, I did the opposite; beams are intended for midrange / assault unless using HEF. 

Kind've made more sense than making them kite monsters, other than allowing for glass-cannon HEF ships whose shields are down and take more damage.  This mechanic kind of upsets the apple cart vs. anything with high dissipation rates. 

You might run into problems with fighters being viable... even low-damage beam weapons already murder them.

High dissipation rates can always be countered with low shield efficiency. And, again, they don't have to do hard damage to be effective. Simply being able to trade some of your flux dissipation rate for some of theirs - at the right time, and without the enemy having much way to avoid it - is very powerful.

It creates true invulnerability scenarios for this weapon type if balance moves much outside a very narrow range. 

Only for a beam-only ship design. Actually, the idea is for it to specifically create those scenarios with smaller ships vs larger ones - so, it actually isn't a narrow range, but one with an open end. Anything where ships have enough - or more than enough - dissipation to shrug off pure-beam attacks from smaller ships is in the "good" range.

Moreover, there are damage numbers showing shield damage that isn't actually happening, which makes it unintuitive.

Hmm. Well, it's sort of happening - it's just not hard damage. I do see your point, though.

And in Vanilla right now, with the introduction of skills, it's probably causing more problems than it solved.  For example, a 100-Vent ship can shrug off pretty much any amount of beam fire once Hard Shields / char. skills are in place, amongst other things.

Again, I think you're working off the premise that beam weapons have to do damage to be effective. Which is a reasonable premise, but isn't how they're designed :) They're primarily pressure and support weapons, and only do well in an assault role vs something smaller or unshielded.

I understand that this is likely a big issue for your mod. You may wish to reconsider using beam weapons for the purpose you are - it's probably going to end up being a bit of a square peg/round hole thing. (And, as you said, restrict balance to a narrow range, which would be difficult to sort out).
Logged

neonesis

  • Commander
  • ***
  • Posts: 248
    • View Profile
Re: Beam Weapons & EMP
« Reply #7 on: November 26, 2012, 01:05:46 PM »

Well, if you want to see the power of Beam Weapons, try full-beam Paragon - it's single handedly most powerful build in Starfarer, capable of taking 3 Onslaughts at the same time (If you're skilled. If you're not, 2 is very easy to take on)

Normally, beam weapons are meant for support, not as the actual killing force. But when you cross the critical amount of beam damage, it becomes better than anything else - low flux cost, incredible accuracy (superior to any other weapon), long range, constand damage dealing (cannot be semi-evaded by turning shield on/off)
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Beam Weapons & EMP
« Reply #8 on: November 26, 2012, 01:16:51 PM »

Check the Star Trek mod for a mod example where 50% of the weapons are beams, I've always seen beam weapon types as the arch-nemesis of hulls and armor, while projectile weapons do easy work on shields even if its not that way on vanilla...
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #9 on: November 26, 2012, 01:54:48 PM »

<shrugs>

I guess I'll just convert all of them over to bolt-firing weapons with fairly high shot speeds for now.  

Players will whine, because the cool visuals will be gone and shots will have a time delay, but I don't think those mechanics make any sense for what I'm doing.  It's just irksome that it's tied to the visual effect itself, not just to a specific boolean.

Waitaminute...

Can this be addressed via intercepting the event of the hit in the everyframe stuff and applying a fix for this behavior there???  If we can raise hard flux there, I can just go around this issue...
« Last Edit: November 26, 2012, 01:58:19 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #10 on: November 26, 2012, 02:20:43 PM »

Looks like yes, we can implement a ruleset.  On the practical end, it's going to cause some issues because of UI display not matching damage, but I can live with that.

Unfortunately, now I'm out of time for the day, lol.  Ah well  :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #11 on: November 26, 2012, 06:37:10 PM »

Knocked out some code for this problem, but I've run into trouble.

1.  BeamAPI didDamageThisFrame() always returns false, even when a beam's doing damage.
2.  applyDamage() requires an entity ID to apply it to, but the entity that's being hit by a beam isn't being returned by getDamageTarget(), which always returns null.

Kind've stuck here; I can get the from / to vectors just fine but I need to know that the beam actually hit something and then I need to apply the damage to that something.  Also, the BeamAPI doesn't return the damage dealt, so IDK how I'm going to get a damage number to apply some standard damage yet.

Code
package data.scripts.plugins;

import java.awt.Color;
import java.util.List;

import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.mission.FleetSide;

public class TestCombatPlugin implements EveryFrameCombatPlugin {

/**
* Set this to true to have the plugin actually do stuff.
*/
private static boolean TEST_MODE = true;

private CombatEngineAPI engine;
private CombatEntityAPI entity;

public void init(CombatEngineAPI engine) {
this.engine = engine;
}

public void init(CombatEntityAPI entity) {
this.entity = entity;
}

public void advance(float amount, List events) {
if (!TEST_MODE) return;
if (engine.isPaused()) return;
List beams = engine.getBeams();
for (int i = 0; i < beams.size(); i++)
{
BeamAPI thisBeam = (BeamAPI) beams.get(i);

boolean didDamage = thisBeam.didDamageThisFrame();
//The above always returns false here

if (didDamage == false)
{
CombatEntityAPI beamTarget = thisBeam.getDamageTarget();
if (beamTarget == null){return;}
Vector2f source = thisBeam.getFrom();
Vector2f damageLoc = thisBeam.getTo();
/*if (beamTarget == null)
{
beamTarget = source;
}*/
float damage = 100f;

engine.addHitParticle(damageLoc, damageLoc, 5f, 1f, 3f, Color.YELLOW);
engine.applyDamage(beamTarget, source, damage,
DamageType.ENERGY, 0f, false, false, source);
} else if (didDamage == true) {
ShipAPI playerShip = engine.getPlayerShip();
if (playerShip != null && !playerShip.isShuttlePod()) {
engine.spawnProjectile(playerShip, null, "swarmer", playerShip.getLocation(),
(float) Math.random() * 360f, playerShip.getVelocity());

for (int b = 0; b < 1; b++) {
Vector2f loc = new Vector2f(playerShip.getLocation());
loc.x += 50f - 100f * (float) Math.random();
loc.y += 50f - 100f * (float) Math.random();
engine.addSmokeParticle(loc, playerShip.getVelocity(), 35f, 1f, 1f, new Color(100,100,100,255));
}
}
}
}
}

}
« Last Edit: November 26, 2012, 06:39:43 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Beam Weapons & EMP
« Reply #12 on: November 26, 2012, 06:55:22 PM »

Hm, crap. You're right! It worked in my test because I was calling the method from a different place in the main loop, but by the time the script's called, those get reset to null/false. Fixed for next release.

For now, I dont think there's a good solution. Well, maybe there is, actually. You'd have to check to see if shields were hit, anyway - and that's a pretty simple "is this beam in the active shield arc for that ship" test. You could just do it in a loop, for every ship (culling somewhat based on distance, if necessary). Basically, do the collision detection yourself. Since you don't care about the ship bounds - just shields - you'd avoid the hairier checks.

Although, if you're going with "applyDamage", you'd have to check vs the bounds too. But there's another option - actually have the beam do standard damage (i.e. don't bypass that mechanism altogether) and decrease flux then increase hard flux using ship.getFluxTrackerAPI(). That way you only ever need to do anything if there's a shield hit.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Beam Weapons & EMP
« Reply #13 on: November 26, 2012, 07:07:39 PM »

It's all good.  At least it wasn't me forgetting to do something totally obvious, merely breaking stuff that's still experimental ;D

Hope that the next release is Soonerâ„¢, I want to build FX systems and do all kinds of Fancy Stuff besides just fixing this particular lil' issue.

Oh, and...

Quote
that's a pretty simple "is this beam in the active shield arc for that ship" test.
How?  I mean, I get that I can cycle through the entities list and cull anything > distance and find the closest match, but the shield arc?
« Last Edit: November 26, 2012, 07:10:02 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Beam Weapons & EMP
« Reply #14 on: November 26, 2012, 07:12:33 PM »

It's all good.  At least it wasn't me forgetting to do something totally obvious, merely breaking stuff that's still experimental ;D

Experimental... you're too kind :) More like "trying to use stuff that was broken".

Hope that the next release is Soonerâ„¢, I want to build FX systems and do all kinds of Fancy Stuff besides just fixing this particular lil' issue.

Is there something else in the next release that I'm forgetting about? Or do you just mean this fix enabling <whatever else>? In either case, I'd expect the schedule to follow the general pattern of previous releases. I.E., the next release is going to be a "bugfix release", not a major feature release.
Logged
Pages: [1] 2