project-navigation
Personal tools

Author Topic: Medikits  (Read 94795 times)

Offline gerald

  • Rookie
  • ***
  • Posts: 79
    • View Profile
Re: Medikits
« Reply #150 on: August 13, 2009, 04:59:16 pm »
way medikits worked in x-com was ok but i think hitting certain parts of body there was just random i got situation when my soldier crouched behind box and he was shoot in the legs heh when all up half of body was opened to fire weird a bit so if ufo ai no have code for aiming certain parts why no left medkits as they are maybe i no played much yet but they works ok as for me anyway i no found in ver 2..2.1 option to "wake up" unconcious soldiers is that implemented in 2.2.3 so i readed something about in research if remember

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #151 on: August 14, 2009, 05:16:40 am »
On my initial looking at the code, I found something that looks wrong:

In g_combat.c, in the G_Damage function

Code: [Select]
/* Apply armour effects. */
if (damage > 0) {
if (target->i.c[gi.csi->idArmour]) {
const objDef_t *ad = target->i.c[gi.csi->idArmour]->item.t;
Com_DPrintf(DEBUG_GAME, "G_Damage: damage for '%s': %i, dmgweight (%i) protection: %i",
target->chr.name, damage, fd->dmgweight, ad->protection[fd->dmgweight]);
damage = max(1, damage - ad->protection[fd->dmgweight]);
} else {
Com_DPrintf(DEBUG_GAME, "G_Damage: damage for '%s': %i, dmgweight (%i) protection: 0",
target->chr.name, damage, fd->dmgweight);
}
} else if (damage < 0) {
/* Robots can't be healed. */
if (isRobot)
return;
}

The problem I see is:
Code: [Select]
damage = max(1, damage - ad->protection[fd->dmgweight]);
This means no matter how good the armor is, the actor will *always* take damage. Armor can't stop the projectile completely.
This feels like it should be:
Code: [Select]
damage = max(0, damage - ad->protection[fd->dmgweight]);
instead.
Otherwise, we could have actors wandering around with dozens of wounds which would take a lot of medikit uses to fix.
Should I make this change, so that armor can completely block damage if it is good enough?

I am asking again, to a developer or design person, should I make the above change which makes armor possibly 100% effective if the shot is particularly weak? I am currently recoding this function to add wounds to the damage done.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Medikits
« Reply #152 on: August 14, 2009, 08:52:33 am »
I am asking again, to a developer or design person, should I make the above change which makes armor possibly 100% effective if the shot is particularly weak? I am currently recoding this function to add wounds to the damage done.

i think that was intentional - but that's something winter or btaxis can answer better

Offline Winter

  • Captain
  • *****
  • Posts: 829
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Medikits
« Reply #153 on: August 14, 2009, 09:16:55 am »
I am asking again, to a developer or design person, should I make the above change which makes armor possibly 100% effective if the shot is particularly weak? I am currently recoding this function to add wounds to the damage done.

Yes, that's right. Sorry, I didn't actually understand what you were asking the first time.

This thread is about to get a clean-up.

[Update] Done. Please try to keep things on-topic from now on, guys.

Regards,
Winter
« Last Edit: August 14, 2009, 09:28:51 am by Winter »

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #154 on: August 14, 2009, 09:42:19 am »
Yes, that's right. Sorry, I didn't actually understand what you were asking the first time.

So, what is the answer? Yes, that's right, make the change? (My analysis is correct)
Or yes, that's right, don't make the change? (The code is already correct)

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #155 on: August 14, 2009, 10:32:11 am »
Code: [Select]
target->HP = max(target->HP - damage, 0);
if (damage < 0) {
/* The 'attacker' is healing the target. */
/* Update stats here to get info on how many TUs the target received. */
if (target->chr.scoreMission)
target->chr.scoreMission->heal += abs(damage);

/** @todo Do the same for "attacker" but as "applied" healing
* e.g. attacker->chr->scoreMission.healOthers += -damage; ? */

/** @todo Also increase the morale a little bit when
* soldier gets healing and morale is lower than max possible? */
} else {
/* Real damage was dealt. */

/* Update overall splash damage for stats/score. */
if (!mock && damage > 0 && fd->splrad) /**< Check for >0 and splrad to not count this as direct hit. */
G_UpdateHitScore(attacker, target, fd, damage);
}

It appear there is a todo written into the code:
Code: [Select]
/** @todo Also increase the morale a little bit when
* soldier gets healing and morale is lower than max possible? */

Is this todo still wanted? It was not listed in the medikit proposal to do so, but I am currently writing the wound treatment function, so it would be easy to add in at this time. If it is wanted, what should the value be? I would like it to be based on the current wound being treated, or some fixed amount since I can not pass in additional values easily via the script method.

Offline Winter

  • Captain
  • *****
  • Posts: 829
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Medikits
« Reply #156 on: August 14, 2009, 12:46:33 pm »
So, what is the answer? Yes, that's right, make the change? (My analysis is correct)
Or yes, that's right, don't make the change? (The code is already correct)

Yes, please make the change.

Regards,
Winter

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #157 on: September 15, 2009, 02:48:53 pm »
I'm unclear on how much a wound is going to affect accuracy, and turn units.

If a person has a 10 point untreated arm wound, how much will their accuracy suffer?
If a person has a 10 point untreated arm wound, how much will their turn units to shoot increase?

If a person has a 10 point untreated leg wound, how much will their turn units to move increase?

If a person has a 10 point untreated chest wound, how much will their turn units for reaction fire increase?

If a person has a 10 point untreated head wound, how much will their accuracy suffer?

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Medikits
« Reply #158 on: September 16, 2009, 12:10:54 am »
I'm unclear on how much a wound is going to affect accuracy, and turn units.

If a person has a 10 point untreated arm wound, how much will their accuracy suffer?
If a person has a 10 point untreated arm wound, how much will their turn units to shoot increase?

If a person has a 10 point untreated leg wound, how much will their turn units to move increase?

If a person has a 10 point untreated chest wound, how much will their turn units for reaction fire increase?

If a person has a 10 point untreated head wound, how much will their accuracy suffer?

Make them scripted.

-geever

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #159 on: September 16, 2009, 12:24:36 am »
Reading and using scripts goes well beyond my abilities. I've stared at that code for hours and made no progress. This is the main reason I had to stop working on the visibility stuff too.

Ok, I'll have to leave it to someone else then. I'll simply create the functions and put them into the proper places, and someone else can add the scripting. Should be easy if someone else knows how, for now the functions will simply return 0, and so skills will not be affected by wounds. That's the best I can do.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #160 on: October 16, 2009, 08:30:47 am »
Tortoisesvn keeps reverting my files without my telling it to, and thus I keep losing all my changes (I'm assuming). I have recoded things a few times now, only to lose them again. This is really slowing down my medikit updates. Is there a way to fix this? Am I doing something wrong?

For example, my latest changes to g_combat.c have completely vanished again. I get a nice green checkmark by the file, and it's the original file without any of my changes.

It's bugging me a lot now, and I've had to make several copies of my medikit changes, and keep reapplying my changes, again and again. Sadly, g_combat.c changes got completely lost this last time.

What am I doing wrong?

Offline Borsti67

  • Squad Leader
  • ****
  • Posts: 164
    • View Profile
Re: Medikits
« Reply #161 on: October 16, 2009, 09:16:41 am »
may be you're using a wrong checkout mode (if some exist)? On a normal one I see those changes and can interactively apply what I need.
In case there's a bug somewhere, I'd recommend to make a backup of your sources before any SVN-updates.
For debugging, you could make a checkout so you're up-to-date, then change one file so TortoiseSVN will mark it. Now do a checkout again and see what happens - anything in the log?

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #162 on: October 16, 2009, 12:11:24 pm »
I doubt it's a bug, because someone would have noticed it before it got released.

I'm fairly sure it's me doing something wrong.

My changes are easily replaced, sorta. I just hope I don't introduce old bugs where I had fixed them before.

It's slowing me down a bit, but with how little time I spend coding these things, I doubt it'll be missed.

I spend 2 hours tonight trying to catch up to where I was. I haven't succeeded yet, but in another 2 hours I should have g_combat.c caught back up. Not sure how many other files got lost, but most of them are still present.

As far as I know, if you downloaded the latest copy via update, it won't do a thing since you have the same revision as was last reported on the server. It saves the revision numbers in hidden directories for each file. I have noticed that a full update and revert does not seem to fix problems as well as redownloading the entire trunk/latest revision does. This confuses me, since it really should.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #163 on: October 23, 2009, 05:03:10 pm »
I have caught up to where I was coding now, and am starting to advance again.

I wanted to issue a warning about how fast hospitals might be healing now, it may need to be lowered.
As mentioned earlier in these posts, wounds will heal individually, which means:
If you have:
one person with 5 wounds with 5 hit points per wound
versus
one person with 1 wound with 25 hit points in that wound

the person with 5 wounds will heal 5 times faster than the person with 1 wound.

I don't know if this is realistic or not, so let me know if it isn't too.

I really wanted to stress this and make certain it is understood since it is a fairly big change that will likely need balancing, or other code changes.
If you want me to make the code changes to hospitals to lower their rate of healing or something, please let me know.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Medikits
« Reply #164 on: October 23, 2009, 05:19:24 pm »
While I was updating my TODO list in this forum, I noticed I have earlier mentioned that percentage of wound damage is the % it affects skills. I read all the following posts again, and saw no one had issue with that.

So, for now that's how I'll implement it, and someone else can add scripts later if they so desire.

I will try to add the effects of wounds on the body (reduced abilities).
--The amount of reduced abilities will be the current value of the wound as a percentage.
--IE: If the wound currently is 20% of a person's total hp, they will receive a 20% penalty to all associated abilities.