aliens

Author Topic: throwing experience for weapons which rely on throwing skill  (Read 19935 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: throwing experience for weapons which rely on throwing skill
« Reply #15 on: January 13, 2016, 02:33:37 pm »
Awesome! How about rules 1-3? I'd like the condition to hit the enemy with these to be in, best would be optional - so you either play as intended - no experience without scoring actual hits - or have even easier time upgrading Throwing, as you wanted (mind you, that even smoke grenades will grant you Throwing when you hit the enemy with the smoke cloud).

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #16 on: January 13, 2016, 02:38:30 pm »
Awesome! How about rules 1-3? I'd like the condition to hit the enemy with these to be in, best would be optional - so you either play as intended - no experience without scoring actual hits - or have even easier time upgrading Throwing, as you wanted (mind you, that even smoke grenades will grant you Throwing when you hit the enemy with the smoke cloud).

I don't see a way how to easily do it.
I would have to change a lot in the source code... unless someone has an idea how to do it in the current framework.

EDIT: the events of throwing a grenade and grenade exploding are just too disconnected... but I will try for rule 3 (weapons with immediate effect like molotovs, etc.)
« Last Edit: January 13, 2016, 02:57:07 pm by Meridian »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: throwing experience for weapons which rely on throwing skill
« Reply #17 on: January 13, 2016, 02:56:47 pm »
All righty then, so your solution seems the best we can have. Deeper modifications, in addition to being difficult, can lead to further bugs... So, how about this:

- Rule 3. is fine.
- For rule 1 & 2, the explosive needs to be primed for 0 or 1 (else someone just could replace training flares with HE grenades pre-primed for 23 turns...). There's scarcely any practical reason to prime them for more than 1 turn, anyway (well, in 95% cases, you prime them for 0...).

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #18 on: January 13, 2016, 06:50:33 pm »
EDIT: the events of throwing a grenade and grenade exploding are just too disconnected... but I will try for rule 3 (weapons with immediate effect like molotovs, etc.)

I couldn't make this work either.

- For rule 1 & 2, the explosive needs to be primed for 0 or 1 (else someone just could replace training flares with HE grenades pre-primed for 23 turns...). There's scarcely any practical reason to prime them for more than 1 turn, anyway (well, in 95% cases, you prime them for 0...).

This doesn't help against spam.
You can prime it for 0 and have two soldiers throw it to each other like a hot potato.
You can even throw it on the tile you're standing on and constantly pick it up.

I think we've done enough for now... let's test how it works out.

Offline eisenefaust

  • Sergeant
  • **
  • Posts: 15
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #19 on: January 13, 2016, 10:04:00 pm »
Maybe I wasn't describing my thoughts accurately.
What I was thinking was when reading in the ruleset for accuracy you use that to determine experience points. You could also do something for calculating bonus damage. I haven't taken a close look at the source code, but if those places are too far separated from experience gain, then add a tracking variable in the weapon class that's built up during ruleset parsing from the accuracy and bonus damage. No special cases, no need to have lots of extra handlers per weapon.
What do you guys think?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #20 on: January 13, 2016, 11:01:36 pm »
Maybe I wasn't describing my thoughts accurately.
What I was thinking was when reading in the ruleset for accuracy you use that to determine experience points. You could also do something for calculating bonus damage. I haven't taken a close look at the source code, but if those places are too far separated from experience gain, then add a tracking variable in the weapon class that's built up during ruleset parsing from the accuracy and bonus damage. No special cases, no need to have lots of extra handlers per weapon.
What do you guys think?

I assume you are referring to projectile weapons (the ones that "hit").
The ruleset is available at all times, no problem there... but there are logical difficulties.
For example, what if your theoretical weapon has accuracy = firing*0.5 + throwing*0.5 ? Which experience point would you award?

If you're talking about grenades/proxies/etc. (things that don't "hit"), there is a whole number of other issues... mostly code being rather complex (and shared with other things that can "explode"), requiring a lot of reading/understanding before I can even think of making a change.

Offline eisenefaust

  • Sergeant
  • **
  • Posts: 15
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #21 on: January 13, 2016, 11:27:38 pm »
If it had both firing and throwing like the mortar then it increases both. How about iterating over the accuracy and bonus damage modifiers when damage is dealt. Anything that affects accuracy or damage gets awarded experience. Since only handling at damage dealt (would have to be before armor and resistances), this removes training via flares all together. This would also handle primed things, proximity, and guns all the same.
 I suppose I also assume which actor tried to deal damage is tied tightly to the damage already or else proximity and primed grenades awarding experience properly is more convoluted than I thought.
Thoughts?
« Last Edit: January 14, 2016, 11:21:04 am by eisenefaust »

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #22 on: January 13, 2016, 11:33:29 pm »
I think better is made proper skill grain system. Each action would have separate list what it grain. Additional we could made it percent value that will determine what effective it would be.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #23 on: January 13, 2016, 11:39:40 pm »
If it had both firing and throwing like the mortar then it increases both. How about iterating over the accuracy and bonus damage modifiers when damage is dealt. Anything that affects accuracy or damage gets awarded experience. Since only handling at damage dealt (would have to be before armor and resistances), this removes training via flares all together. This would also handle primed things, proximity, and guns all the same.
 I suppose I also assume which actor tried to deal damage is tired tightly to the damage already or else proximity and primed grenades awarding experience properly is more convoluted than I thought.
Thoughts?

Training both is too much in my opinion.

Dealing damage with grenades (in vanilla) doesn't award any throwing experience at all... if I understand the code correctly. Only the act of throwing the grenade (or anything else) does.

For the rest, everything is possible... the question is if you can do it and if it is worth it... I won't be looking at that at the moment.
« Last Edit: January 14, 2016, 12:06:15 am by Meridian »

Offline eisenefaust

  • Sergeant
  • **
  • Posts: 15
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #24 on: January 13, 2016, 11:47:25 pm »
From: https://www.ufopaedia.org/index.php?title=Grenade

Quote
Throwing Grenades improve Throwing Accuracy, and also Firing Accuracy when enemies are caught by explosions. All enemies (if not mind controlled) caught in the blast will give experience toward firing accuracy, even if undamaged (i.e., their armor absorbed it) - see Experience.

All in all. I like Yankes idea. And this seems to me to be a feature that should be brought into OXCE to support other mods.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #25 on: January 13, 2016, 11:58:17 pm »
All in all. I like Yankes idea. And this seems to me to be a feature that should be brought into OXCE to support other mods.

And what does "each action" mean exactly?
If it's just the battle action (e.g. BA_THROW or BA_AUTOSHOT) that's far away from being enough.
And from the other side, is exploding grenade even an action?.... in my opinion not, as it doesn't require anyone to (directly) act (in game's terms).... it just happens.

I am not against improvements, but it needs to be very carefully and precisely defined... and if possible should be easy to understand.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #26 on: January 14, 2016, 12:22:59 am »
And what does "each action" mean exactly?
If it's just the battle action (e.g. BA_THROW or BA_AUTOSHOT) that's far away from being enough.
And from the other side, is exploding grenade even an action?.... in my opinion not, as it doesn't require anyone to (directly) act (in game's terms).... it just happens.

I am not against improvements, but it needs to be very carefully and precisely defined... and if possible should be easy to understand.
Basic would be current place where skill grain is awarded. Next event like grenade or proxy explosion. Question is that values would be shared (between places) or if there should be special cases (in one place).

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #27 on: January 14, 2016, 12:41:03 am »
For example, what if your theoretical weapon has accuracy = firing*0.5 + throwing*0.5 ? Which experience point would you award?
From looking at the file, Piratez does include a mortar which uses 0.5 throwing and 0.5 shooting.
No matter what you decide to code in case of a tie, the mod itself can choose to set one of the accuracyMultipliers to 0.5 and 0.501, to explicity state the tie-breaker.

About the existing experience given by grenades/proxies : It works because battle items have a _previousOwner field, it points to who threw or dropped it.
 If/when item sets off, this field is passed to the new ExplosionBState()as the last (optional) argument. In turn, when ExplosionBState::explode() calls TileEngine::explode(), it passes this unit as the last (optional) argument.
There are two cases where TileEngine::explode() receives a unit : when a fired weapon causes AOE, and when an explosive item which was carried by someone sets off. It's tricky because at this point in the code, there's no longer any track of HOW the damage was caused.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #28 on: January 14, 2016, 10:21:59 am »
About the existing experience given by grenades/proxies : It works because battle items have a _previousOwner field, it points to who threw or dropped it.
 If/when item sets off, this field is passed to the new ExplosionBState()as the last (optional) argument. In turn, when ExplosionBState::explode() calls TileEngine::explode(), it passes this unit as the last (optional) argument.
There are two cases where TileEngine::explode() receives a unit : when a fired weapon causes AOE, and when an explosive item which was carried by someone sets off. It's tricky because at this point in the code, there's no longer any track of HOW the damage was caused.

Yes, that's exactly how far I got as well.
And since there was no track of what weapon caused the damage, I gave up.

But reading this now, my changes will probably have some funny effects... like soldier throws a proxy... which goes off 5 turns later, in the meantime the soldier is already holding something else in their active hand (e.g. hammer) and I will therefore give them melee experience.

I'll have to test it... if so, I may as well do the big changes I wanted to avoid.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: throwing experience for weapons which rely on throwing skill
« Reply #29 on: January 14, 2016, 08:41:18 pm »
I think proper solution is propagate unit action instead only unit. In case of proxy & grenade create dummy one with filled unit and battle action (throw or custom new BA?).
Another thing is replacing ammo with weapon when passing to explosion function (currently melee weapons with ammo work that way).
This is important step for other future possibilities like weapon giving boost to damage (only problem is when ammo is used and unloaded, if done to fast it will be lost for damage function).

With this two steps you will always have correct battle action and weapon that cause it. This will require lot of work and testing but in long run it will simplify code and create new opportunists for new functionality.