smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
729 stars 73 forks source link

Weapons and damage system #243

Open MCMic opened 4 years ago

MCMic commented 4 years ago

Missiles are too powerful, while torpedos are really hard to use.

Most fights are either short-lived or never-ending.

Ideas:

  1. Slow down missiles a bit to increase chances of using CHAFF or shooting them down (is that possible?)
  2. Speed up torpedos?
  3. Add some clue to know when blowing a torpedo might damage the enemy (some beep or visual clue that shooting at the torpedo now would have the enemy ship in the range of the explosion)
  4. Make it a bit harder to shoot a missile: Have a «target locking» delay needed before you can shoot the missile, and you need to keep the ship on weapon screen during the delay so that it can be locked.
  5. Make shield more resilient, and try to make it really usefull to use wavelength information. (Something like missile weakening a random wavelength really bad so that if you take the time to adjust wavelength a few shots are enough to finish the job)
  6. Change damage repartition to increase chances of having something broken while the rest works. (This comes from @smcameron idea of having to drive by computer because nav is broken, I feel like situation where you have to keep going with some parts not working might be fun)

The goal would be to be able to have long interesting battles. Two common scenarios would be one big ship against several small ones (this is what we have in most missions right now), and one big ship against another one (bonus points if this interesting in PvP context). Being experienced at the game and team play should be required to win, ideally.

smcameron commented 4 years ago

Yeah, the missiles are too powerful/easy for players to use, and if enemies use them, they are too hard to avoid, so many mission scripts don't allow enemies to use them.  There definitely needs to be some way to make the missiles more expensive for the players in some way.  I think it's possible for scripts to take away the missiles.  Probably the scripts that were made before the missiles existed should take away the missiles.

These are some good ideas, thanks.  I also had an idea that maybe when the player ship is hit, damage shouldn't be so random and spread out, but more concentrated on a single system for any given hit.  Maybe even randomly select a system for a particular time period (e.g. every 20 or 30 seconds or so, select a new random system) and any hits coming in within that 20 seconds affect that system (and maybe also always hit shields a bit?).  It would give the attacks more of a particular "flavor" and make them not all seem so "samey".  But I haven't tried this idea, it might be awful. It's definitely possible to slow the missiles down (they are already slowed down considerably since they were first introduced).  I should make MISSILE_VELOCITY tweakable so it's easy to experiment (I'm a little surprised I didn't already do that.)  Also TORPEDO_VELOCITY. Currently NPC ships make no attempt to evade missiles or use chaff.  Maybe they should. And maybe missiles should participate in this by being less perfect in their pursuit than they currently are.

Also, I have long thought that I probably should change the way shields work so that you also have "hull integrity", which deteriorates as well, but if shields are working well, then the hull is protected.  The situation right now is that shields also serves as hull, so the second shields hit zero, you're dead.

smcameron commented 4 years ago

Made MISSILE_MAX_VELOCITY tweakable b700dbfc7f28b58fa91f212c7b1fd5d18d32a2c3 I don't think it really helps though. MAX_MISSILE_DELTAV is also tweakable (affects how quickly they can steer). Some limited experimenting with that didn't seem to make much difference either. The missiles might take longer to get where they're going if they're slower (or never get there if comically slow), but they're still too easy. I think some NPC evasive action might be the best bet.

smcameron commented 4 years ago

And TORPEDO_VELOCITY already is tweakable as of 3759a0d9d758d7dd310faf8675122f127b904658

smcameron commented 4 years ago

Add some clue to know when blowing a torpedo might damage the enemy (some beep or visual clue that shooting at the torpedo now would have the enemy ship in the range of the explosion)

Currently, I think if you shoot at a torpedo and blow it up, the torpedo doesn't damage anything. I only imagined shooting torpedoes to be a defensive move, you shoot incoming torpedoes to prevent them damaging your ship. I never considered shooting them near the enemy ship. I would think this would be a very difficult thing to accomplish... (I mean, hitting a torpedo near an enemy ship would be difficult, not coding it up).

smcameron commented 4 years ago

You know what's weird, in this video https://www.youtube.com/watch?v=nTBiM5zJi8A from July of 2016, it seemed the battle was pretty long and satisfying. But unbeknownst to me at the time, there was a bug, and if you pay close attention to the video you can see the bug in action. The bug is long ago fixed (but I couldn't seem to find the change that fixed it, or remember quite what caused it. Might have been underflow on uint8_t.) In any case it caused the damage to each system to be random. That is to say, each hit could not only decrease a system's health, but also increase it! In the video, you can hear that at the time, I thought this was the damage control robot fixing things, but it wasn't! The effect of it was, the battle was much longer and I lasted longer than I should have, and thought I was closer to death than I really was. Not that this sort of thing is a good idea, esp. if the players know about it, but it seemed to have approximately the desired effect of prolonging the battle. I do know that some games will give the player a little extra resilience when they are close to death to boost the drama and make a "close shave" situation more likely, e.g. as described in this clickbait: https://www.goliath.com/gaming/14-hidden-video-game-design-tricks-that-will-blow-your-mind/

Edit: I think this is the fix to the bug I mentioned: 66adc2641ceb827b3144bda87eb1fddeeb3568b8 (was going to drive me crazy if I didn't find that commit. And it was 2 years after that video, ha!)

smcameron commented 4 years ago

A couple commits to make chaff more effective and allow NPC ships to take evasive action and emit chaff when a missile locks on. Missiles are still probably too powerful though. The "evasive action" probably doesn't do much (the ships can't outrun the missiles), but you can see that they react (they try to run on a course 90 degrees from the missile's course). The chaff is somewhat effective, it's not a sure thing that a missile will hit the target now as it is fairly likely to chase chaff instead.

MCMic commented 4 years ago

I also had an idea that maybe when the player ship is hit, damage shouldn't be so random and spread out, but more concentrated on a single system for any given hit. Maybe even randomly select a system for a particular time period (e.g. every 20 or 30 seconds or so, select a new random system) and any hits coming in within that 20 seconds affect that system (and maybe also always hit shields a bit?). It would give the attacks more of a particular "flavor" and make them not all seem so "samey". But I haven't tried this idea, it might be awful.

I like this idea.

Also, I have long thought that I probably should change the way shields work so that you also have "hull integrity", which deteriorates as well, but if shields are working well, then the hull is protected. The situation right now is that shields also serves as hull, so the second shields hit zero, you're dead.

That would make sense.

Currently, I think if you shoot at a torpedo and blow it up, the torpedo doesn't damage anything. I only imagined shooting torpedoes to be a defensive move, you shoot incoming torpedoes to prevent them damaging your ship. I never considered shooting them near the enemy ship. I would think this would be a very difficult thing to accomplish... (I mean, hitting a torpedo near an enemy ship would be difficult, not coding it up).

Hum, ok, I misunderstood this feature then. It’s most likely because I’ve used such feature in FPS like Xonotic before that I was expecting it to work that way. I guess some area damage would still make sense because if I shoot a torpedo coming at me too close to my ship I would expect to get some damage.

MCMic commented 4 years ago

@smcameron If you make chaff more effective you will need to add some kind of cost to it (fuel and/or cooldown and/or power), because it seems I can just spam chaff continuously in the current version.

smcameron commented 4 years ago

@MCMic Yeah, probably so. Although in my experience, players never seem to be on the ball with the chaff (they need comms to tell them a missile is incoming, and they always seem to get killed by a missile so most missions forbid enemy ships from firing missiles (set MISSILE_FIRE_CHANCE = 0).) But certainly you could just spam chaff, so I should at least put a cooldown on it or something.

smcameron commented 4 years ago

There is now a 1.5 second cooldown on player chaff deployment. There is a tweakable varible, CHAFF_COOLDOWN_TIME in 10ths of seconds (default is 15). d4921faeac7fb8f85fedcefb0ed34d1056c78fa7

smcameron commented 4 years ago

Hmm, one problem I can think of with the NPC missile evasion mode is that they do not attack while evading a missile. The player can essentially pause an attack by firing a missile, and the NPC will then attempt to evade the missile as long as it is flying around.

smcameron commented 4 years ago

NPCs can now fire laserbeams at missiles. 90e26e87d6756fa45718280afa3b2e4fc51a0c66

May help with testing the disappearing laserbeams bug #240

smcameron commented 4 years ago

Might have nerfed the missiles too much.

smcameron commented 4 years ago

The time is tweakable via MISSILE_COUNTERMEASURE_DELAY in 10ths of seconds. The effect makes missiles pretty deadly when the distance to target can be traversed within the 2 second window.

At greater distances the missiles are probably still too nerfed.

smcameron commented 4 years ago

Kind of hard to know exactly where the best balance is.

MCMic commented 4 years ago

It's hard to test this without a crew :-/

MCMic commented 4 years ago

Also, the chaff may confuse beginners because it looks like the ship is hit, it looks like explosions of some sort. Not sure how this can be improved though.

smcameron commented 4 years ago

@MCMic wrote: It seems important to me that broken comms is something possible.

One problem with broken comms it that it is hard for the player to distinguish damaged comms from the game being buggy if the effect is that comms doesn't work. Also comms is generally the last resort if you're heavily damaged or out of fuel (and if you're out of fuel you have no power). If you're heavily damaged and you have no comms, then you just die. That's not fun. I figure comms is important enough that it's redundant, and does not require much power so it can run on it's own power supply. (Rationalizing why it works and can't be damaged is easy, but also beside the point.) If it is important that comms may be damaged, then there must be some effect of that damage, and the effect must not be crippling. What is that effect? Corrupting comms messages slightly so that they may still be read is one possibility. However, doing that will cause your interactions with NPCs (eg. starbases) to fail, because I'm not writing an AI intelligent enough to deal with corrupted messages, or simulate dealing with corrupted messages.) I have not been able to think of a reasonable effect for comms damage to have.

(Spoilers for SPACEPOX mission follow):

In one playtesting session of SPACEPOX, the players were heavily damaged with a broken warp drive in the attack which occurs immediately after you obtain the vaccine. They called a tow ship which came and picked them up and dragged them back to BONX station where they delivered the vaccine and completed the mission. It was a novel solution that I had not anticipated. If comms were as damaged as everything else, this would not have worked.

MCMic commented 4 years ago

If you're heavily damaged and you have no comms, then you just die. That's not fun.

Well, there are always ways to lose the game, it’s not fun if you can only win in my opinion.

I think that broken COMMS should be possible and should result in impossibility to send messages until the robot repairs a bit of it. I agree that if you are out of fuels with broken comms you’re screwed, but that sounds expected to me.

Regarding heavily damaged situation, I really like the idea of damage concentrated to a particular system on each hit, and this is part of why I like the idea of broken comms: if everything can break apart, there are more possible combinations of broken stuff to experience.

I was thinking maybe make the shields more complex. Maybe have front, rear, upper, lower, starboard and port shields and be able to direct power between them? Or maybe be able to set a "heading and mark" for shields and a "balance" control to bias the shield protection in the direction of heading and mark. If balance is 0, then shields are a uniform sphere, if balance is +1, then... shields protect more from the direction of heading and mark, and less from the opposite direction. Then science or nav would need to tell engineering about the location of enemies so they could "angle the deflector shields. "

An other idea would be to «place» systems around the ship, and consider that a hit from behind would damage thrust and warp, while a hit from above would damage comms and weapons, … (Kind of inpired by https://daid.github.io/EmptyEpsilon/screenshots/engineering.png visual, I do not know if this is how it works in empty epsilon but that’s what this screen made me think of)

Regarding shields, I think they should absorb some damage depending on their current strengh/power, take some damage to themself, and let the rest go through. As shield get damaged more and more damage is taken by hit by other systems. Once shields are down systems are quite vulnerable. And maybe like you said have a special hull system which only takes damage once shield is down, and blows the ship once low.

It does feel sexy to be able to redirect all power to front shields and stuff like that, because they do it a lot in fictions, but I’m not sure how often we are attacked from several sides, and how quickly this would need the crew to react to be efficient.

smcameron commented 4 years ago

Ok, now NPC ships can target particular systems on the ship, and will choose a new system every 30 seconds. This feature is not turned on by default. To turn it on, "set npc_system_targeting=1" on the Demon screen. You can change the interval between switching systems as well. "set npc_system_targeting_interval = 600" would change it to every minute (600 tenths of a second) up to 5000.

smcameron commented 4 years ago

I've got a patch series that introduces the concept of hull damage. It's unbalanced though. It makes enemies harder to kill (and player ships harder to kill).

In case you might want to play with it, here's a uuencoded tar.bz2 of the patch files (uuencoded because github doesn't allow uploading arbitrary "file types" whatever the fuck a "file type" is, which is of course completely pointless because uuencode exists). Not that I expect anyone to want to play with this hot garbage at this time, lol.

hull-integrity.tar.bz2.txt

MCMic commented 4 years ago

@smcameron Seems a good start. If I understand correctly there is a threshold of shield damage before the hull takes damage, it seems wrong to me that this is related to shield damage and not shield strengh, if my shields are low power I should take a bit of hull damage, no? (or at least if they are off)

How does damage on enemy ship works, they do not have the power system, do they? (it would be cool if hitting them had a chance of disabling their weapon or nav, but as I understand it they only have some kind of lifebar)

smcameron commented 4 years ago

seems wrong to me that this is related to shield damage and not shield strengh, if my shields are low power I should take a bit of hull damage, no?

Good point. I agree.

How does damage on enemy ship work

It's a bit of a muddled mess. The NPC ships do actually have per-system damage, but this doesn't affect anything, and you can't target particular systems. You just needed to knock their shields down to zero, the shields being one of the systems -- or with this patch, their hull integrity.

But it's all both more complicated than I would like, and too simple, ha. This is one of those times where my initial implementation was not very well thought out, I think. But it's so interwoven into everything, now it's hard to change and hard to understand, and really hard to figure out what sort of damage any particular weapon should do at a particular instant and have the whole thing produce a compelling overall experience.

jrwarwick commented 4 years ago

Hello, fellows. Looks like you have a conversation web going on, I hope I'm dropping into the right place. Regarding comms damage: I agree that it is a valuable resource for dramatic tension and creating a sense of limited options sometimes. As a mitigating factor to the unfun-crippling problem, what about a totally independent "Emergency Distress Signal" that is totally independent, but with limited capabilities. You cannot transmit an arbitrary message, only "SOS" followed by your XYZ. "captain, emergency beacon activated. Distress signal automatically transmitting on all standard frequencies." It travels far, works without main system power, its hard to jam, but all it can do is summon assistance, if it is indeed received.

smcameron commented 4 years ago

@jrwarwick Thanks, that's not a bad idea. The main problem I have with comms damage is how to manifest it in a way that is not just annoying. Realistically, if your radio gear is damaged, and you transmit, well maybe you get no response because your transmission was never received, or your receiver isn't working well. But, "no response" is not very satisfying, and difficult to distinguish from "the game is broken." There is the "distortion" idea, where some characters of the received messages are replaced by asterisks, which is implemented if you turn on antenna aiming. But I am not sure adding confusion into what is usually an already confusing situation improves the fun. But supposing I can figure out some way to manifest comms damage that is acceptable, the idea of an invulnerable emergency beacon for summoning the tow truck ship seems like it's not a bad idea, so thanks for that.

MCMic commented 4 years ago

Raw ideas:

But maybe the better solution is to use the antenna feature and make comms power alter this.

smcameron commented 4 years ago

Since I am having trouble figuring out how to approach balancing various things about how enemy AI works, etc. and I came across this interesting reddit post by r/MeaningfulChoices, I will quote it here:

https://www.reddit.com/r/gamedev/comments/f6lmkb/rgamedev_suggestion_box/fi90j4j/

I realize I'm the one who brought it up and therefore should really make my own topic about it, but: here's the quick and dirty version of where to start. It's the thirty second version of a GDC talk I gave a few years ago.

Start from whatever design principles you have - I like to use time. In a real time game, average human reaction time is 0.25 seconds, so you might want the average two units to last 1-2 seconds. It could be turns, days, whatever your metric is. That gives you something to shoot for.

Now pick something completely arbitrary as a place to start. Item power in an RPG scales from 100 to 10k because you want endgame to wipe the floor with start of game monsters, or 100 to 200 because you don't. HP in a battle RPG goes up by about 100 per level because it looks pretty. Whatever it takes. Do the same for however many axes you have, like defining an attack speed of 1.0 per second, for example.

Now you can math out a bunch of average values for your units. Attack has to scale by X to maintain time-to-kill across levels. Or you want high-level units to live slightly longer, so you scale for that. Now it's balanced but not fun, so you tweak. Melee units take X seconds to run up to ranged unit Y, so you need to buff their attack or health by some number to make them still tie in a vacuum. That's the 1v1 part.

You can use that to get soft values for the power level of various abilities as well. An energy shield is equivalent to some amount of extra health. An AoE attack that's intended to be balanced against 2, 3, or 10 enemies goes to a draw at some power number. From there you can add things like RPS; this unit counters that one, so it's balanced to win not just draw.

That's your starting place. Now you write some AI so you can throw groups of units at each other and sim the results. Make it able to do that a hundred times. Look at the report. Tweak values until the matchups all end up the way you want. Now your balance is ready for players to ruin it and cause a dozen more rounds of tweaking.

That's a year's worth of system design work in a post.

Haven't digested all that, but it seems there is likely some wisdom being thrown down.

jrwarwick commented 4 years ago

That's a great mini essay. I too sense considerable wisdom there. I followed the link and that person had lots of nuggets of wisdom shared there on Reddit.

Just throwing more on the pile of ideas here (which is possibly not really very helpful at this point): add in a little more variety in weapon types, then have some strong-against/weak-against/bypasses-that types of properties. Somewhat like in the old X-Wing games where lasers would deplete shields particularly well, but would also damage hull, though not as effectively as missiles and torpedoes, but torpedoes and missiles didn't penetrate shields very well. And ion canons had limited shield bypass and could temporarily disable/damage certain subsystems, but did almost no damage to hulls. So you found yourself tailoring your barrages to enemy type and mission objectives. Which, I think, can help with too much "samey" at least.