OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Meridian on January 16, 2016, 09:22:18 pm

Title: [DONE] New experience award system / accuracy training system
Post by: Meridian on January 16, 2016, 09:22:18 pm
OK, here goes nothing:

1. vanilla bravery training unchanged
2. vanilla reactions training unchanged
3. vanilla psi strength and psi skill training unchanged (more options added in OXCE v7.0: https://openxcom.org/forum/index.php/topic,4230.msg137247.html#msg137247)
4. vanilla throwing training completely removed!
5. vanilla melee training moved to new common system... mostly unchanged, you cannot train on mind-controlled aliens anymore though
6. vanilla firing training reworked completely
7. vanilla secondary stat (tu, stamina, hp, strength) training unchanged, but is now triggered also by throwing experience gained

General rules:
a/ you can train accuracy (firing / throwing / melee) only if you HIT the enemy
b/ neutrals don't count
c/ enemies under mind-control don't count
d/ friends under mind-control don't count
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count
f/ you are not limited to firing/throwing/melee only... there is a possibility to override it by 32 new options... more about that later

Default algorithm:
1. if grenade or proxy grenade weapon type => train throwing (+1 for each unit hit)
2. if melee weapon type => train melee (miss is not a hit!)
3. if firearm (or other) train:
3a. if not ranged attack, train melee (e.g. gun butt)
3b. otherwise if arcing shot, train throwing (e.g. flamethrower, javelins, combat bow, grenade launcher, molotov, black powder bomb, stick grenade, acid flask, apple, ...)
3c. otherwise if maxRange > 10, train firing (e.g. panzerfaust, harpoon gun, shotgun, assault rifle, rocket launcher, ...)
3d. otherwise if maxRange between 2 and 10, train throwing (e.g. fuso knives, zapper, ...)
3e. otherwise if maxRange = 1, train melee (e.g. hammer, chainsaw, fusion torch, ...)
3f. otherwise nothing!

Notes:
 - all shotgun pellets fired at the same time count only as one hit only
 - explosive, incendiary, etc. ammo hitting multiple units counts as multiple hits
 - smoke hits too :)
 - stun as well

There is a possibility to skip the default algorithm completely, by adding "experienceTrainingMode" attribute to your weapon.
(this attribute works also when healing fatal wounds using medikits; allies, enemies and neutrals all count)

How it works:
- ignores default algorithm completely
- supports values from 0 to 32 (0 means turned off, i.e. use default algorithm)
- can train all primary skills, but psi strength and psi skill can only be trained if soldier already has psi skill > 0 (without armor buffs!)
- you can only have one override, so weapons with two different attacks are not well suited for that (e.g. rifle's shots and gun butt attack)

A full list of possible overrides:
0 default algorithm -- if nothing is specified
1 train melee
2 train melee 50% chance
3 train melee 33% chance
4 train firing
5 train firing 50% chance
6 train firing 33% chance
7 train throwing
8 train throwing 50% chance
9 train throwing 33% chance
10 train firing and throwing
11 train firing or throwing (coinflip)
12 train reactions
13 train reactions and melee
14 train reactions and firing
15 train reactions and throwing
16 train reactions or melee (coinflip)
17 train reactions or firing (coinflip)
18 train reactions or throwing (coinflip)
19 train bravery
20 train bravery x2
21 train bravery and reactions
22 train bravery or reactions (coinflip)
23 train bravery or reactions (coinflip) x2
24 train psi strength
25 train psi strength x2
26 train psi skill
27 train psi skill x2
28 train psi strength and psi skill
29 train psi strength and psi skill x2
30 train psi strength or psi skill (coinflip)
31 train psi strength or psi skill (coinflip) x2
32 train nothing

Cheers,
Meridian
Title: Re: New experience award system / accuracy training system
Post by: eisenefaust on January 17, 2016, 01:31:23 am
Hi Meridian, thanks for putting in so much effort into this.
Two quick questions for you though, with override 12 through 18 and 21 would it be possible for you train reactions with an active action rather than on the the opponents turn?
Would mortar have a default override of 10?
Thanks
Title: Re: New experience award system / accuracy training system
Post by: Meridian on January 17, 2016, 11:03:57 am
Two quick questions for you though:
1: With override 12 through 18 and 21 would it be possible for you train reactions with an active action rather than on the the opponents turn?
2: Would mortar have a default override of 10?

1: Yes, as I said this training is applicable only when you hit the enemy. For example you can redefine the Cutlass to train Melee+Reactions on every hit (instead of just Melee)
2: I don't have control over PirateZ code, you'll have to ask Dioxine.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on January 17, 2016, 11:37:29 am
Would mortar have a default override of 10?

In your dreams maybe...
Title: Re: New experience award system / accuracy training system
Post by: eisenefaust on January 17, 2016, 11:10:49 pm
In your dreams maybe...
or 11 maybe for the coin flip?
The point is I think it's rather odd for any weapon to utilize multiple stats for accuracy or damage and no chance or raising some that it uses.
What do you think Dioxine?
Title: Re: New experience award system / accuracy training system
Post by: hellrazor on January 17, 2016, 11:21:06 pm
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count <--

No more Improvisation? Come on! Let me Blow up those pipes.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on January 17, 2016, 11:30:37 pm
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count <--

No more Improvisation? Come on! Let me Blow up those pipes.

You would still get the entry in the soldier diaries ;-) If it was in OXCE.
Title: Re: New experience award system / accuracy training system
Post by: Eddie on February 25, 2016, 07:52:43 pm
I would like to suggest a new mechanism for bravery increases.

In normal play, meaning not specifically playing to train a stat, I've only gotten one stat increase so far. And that was because of repeated enemy voodoo use to panic this one gal.
To train bravery, I put an unconscius enemy in a place whithout weapons where I can trap him (cave for example) and then revive him there. Finish rest of the map, then wait 10 turns so low bravery gals panic a lot and then finish off the trapped enemy. This only works for gals with bravery <60 though.
Another method is flag abuse. Have two gals alternate using your flag. Flag use drops your morale under 50 and restores moral for the other gal so she can use the flag next turn.
Both these methods are not fun to do, but bravery is an important stat in XPiratez and stat increases are needed.

Here is my suggestion:
Instead of the resisted panic counter to give a stat increase chance, use the kill counter. Each kill gives a 10% chance to increase bravery. 3 kills, 30% chance to get a bravery increase at the end of the mission. Actual percentages need to be playtested and there could be diminishing returns depending on bravery stat. Like percentage per kill = (10% - bravery/10). But you get the idea I hope.
This mechanic would also force you to make more decisions. Economy wise, you want to stun every enemy to get more money. But to get bravery stat increases, you would need to kill them instead of stunning them. So now decide, stat increase or money?

Edit: fixed typos
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on February 25, 2016, 08:26:25 pm
Kills increasing bravery could make sense. A gal who kills lots should be confident.

By opposition, should getting injured give a chance of reducing bravery? If you get injured a lot, you wouldn't be very confident... thjat could create an interesting dynamic bravery.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on February 25, 2016, 09:30:36 pm
Well, the opposite can be easily argued. I can't see what killing people has to do with Bravery? It already increases Morale, so it would be a geometrical effect. Conversely, one could argue that getting injured and going back to fight should increase Bravery, as the soldier finds new confidence to fight.
Naturally the issue of Bravery training should be resolved at some point (added Braver training to healing, but medical items do not support training... yet), but privately, I pretty much ignore Bravery - if it's too low, soldier will panic and eventually their Bravery will rise. So unlike with Reactions, I think training bravery by mechanics abuse is a waste of time.
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on February 25, 2016, 09:44:11 pm
I was just thinking along simple lines:

If you kill most of what you meet, you can be confident that upon meeting more opposition, you'll kill 'em too. (until you meet something significantly stronger than what you met previously!)

If you get injured often in the field, you probably won't like being there and be likely to want to run away.

But in general I agree, many of my best soldiers have very low bravery (see capt'n's log) and they do totally fine. The only time it's an issue is when hunting for the last few enemies on a map, by which point the only question is "how long is it going to take for me to win?"
Title: Re: New experience award system / accuracy training system
Post by: Eddie on April 26, 2016, 12:38:22 am
I may have encountered a bug. I had a gal with combat shotgun on a mission and she had 3 shots with hits, but she got no accuracy experiance from the mission. Is this how it is supposed to be?
Title: Re: New experience award system / accuracy training system
Post by: Solarius Scorch on April 26, 2016, 12:41:19 am
I may have encountered a bug. I had a gal with combat shotgun on a mission and she had 3 shots with hits, but she got no accuracy experiance from the mission. Is this how it is supposed to be?

AFAIK only the first pellet can award experience. So it's possible that while other pellets hit, the first one missed and therefore no exp.
Title: Re: New experience award system / accuracy training system
Post by: Eddie on April 26, 2016, 12:55:07 am
Thanks, thats what I thought. I suppose there is no other way to code this?

Maybe this would work: The hitlog can already tell if shotgun pellet hits are from the same shot or not. So this "shot + any number of hits" data could be used for a more accurate xp calculation
Title: Re: New experience award system / accuracy training system
Post by: sambojin on April 26, 2016, 02:11:59 am
I'm still a bit iffy on grenade launchers, flamers and assault cannons training throwing as the default (I can understand why, to save making two arcing lists, but it doesn't make sense). There's plenty of ways of training throwing now, so I don't really think bows need any more help.

And for bravery training, it's fine. Want more self confidence in your ability to take on anything without whimping out? Turn up in a skimpy outfit, or nothing at all, and survive a few missions. By the end of it that gal won't be scared of anything. Boob-swing induced combat stress is very character building, even to the scaredy cats.

Q: Does the "first pellet" thing only apply to shotguns, or does it apply to auto-fire weapons too? And funny ones like flamers?
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 02:24:55 am
The "1st pellet gives xp" was implemented for shotguns, which have good accuracy and if every pellet counted, could grant the equivalent of 8 hits even though that was only one snap/aimed shot. Autoshots count hit for every shots, so miniguns and HMGs are really good for training (if you can hit anything with them multiple times...).

Doing a bit of research in the ruleset:
Flamethrower: Uses Firing, xpMode 9 = trains throwing 33% chance (I assume to reduce the training since autoshots have 8 shots so could yield lots of xp)
Grenade Launcher: Uses firing, xpMode 4 = trains firing (yay!)
Assault Cannon: Uses Firing, xpMode 4 = trains firing (yay!)

So it looks pretty good. I'd agree that a flamethrower is more of a gun than akin to throwing a rock.. but if "arc projection" is the skill represented by throwing (ie being able to tell how to fire a weapon on an arcing shot), then the grenade launcher and assault cannon should train it. As is, it is maybe not too consistent. It could be cool to see more of the xpMode 11, 50/50 throwing and firing, to represent learning about the arc and the aim, leaving only properly throw items (knives, ninja stars, grenades, molotovs and bombs) as training throwing 100% of the time. Even a bow is aimed similarly enough to a gun that I could see it training either.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on April 26, 2016, 03:08:16 pm
I'm still a bit iffy on grenade launchers, flamers and assault cannons training throwing as the default (I can understand why, to save making two arcing lists, but it doesn't make sense). There's plenty of ways of training throwing now, so I don't really think bows need any more help.

It's quite silly to complain about bugs that exist only in your imagination; GLs and Cannons train Firing, not Throwing. However, I've changed flamethrowers to 33% train firing, since they use Firing for attack. It's indeed more sensible.

Also, no inconsistency, Arthanor. Throwing is the skill bow is using, so Throwing it trains, NOT firing. Let's not get distracted by the semantics of the word 'throwing'. It is one of 3 attack skills we have, we don't have any more to burn, and their irl semantic fields are not really that important; important is, what they represent in-game. IF everything was training everything, why would we need separate Throwing and Firing? We could add bows under Firing and be done with it, but IMO that would be really boring compared to how it's working now, as in "useless throwing skill is now important".
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 04:26:02 pm
If you flip the flamethrower to training firing, then I think it all makes sense.

I was merely suggesting one way the use of both skills could be rationalized: Firing = proper aiming, Throwing = arcing shots. It is maybe less diverse (since it would have bows and other aimed arcing weapons train both firing and throwing), but it is a rationalization.

I understand that you prefer of more strongly divided way with weapons being either one or the other, and with the change to the flamethrower, I agree that works too. It just seemed odd before (and the defaults are probably what was confusing sambojin. Not everyone goes to dig in the ruleset when they have questions, and.. I guess not everyone asks questions when they have them, it's easy to just assume and criticize).
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on April 26, 2016, 06:06:29 pm
My definition for Throwing in Piratez would be, 'skill to use muscle-propelled weapons that usually, but not neccesarily, have arcing shots; a primitive alternative to Firing'. That's why it's used in some melee weapons, for instance. However I'm not sure about the Mortar. It uses Firing/2 + Throwing/2 but does to not conform to the above definition. I'd preferably use Firing/2 + Intelligence/2, but there is no such stat in XCom... Any suggestions?
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 06:48:07 pm
Interesting challenge. The stats are very physical.. If not throwing:

I could see bravery, to represent the ability to keep your cool under fire/when your friends are under fire, communicate well to get the positions from spotters and then make the right calculations and minute adjustments to engage something you can't see.

Or reactions, which is a measure of your ability to act/react in combat to mean also an ability to think in combat.
Title: Re: New experience award system / accuracy training system
Post by: ivandogovich on April 26, 2016, 07:01:32 pm
Just to chime in:  I for one don't see a real issue with tying Throwing skill in general to "Arcing" weapons, but in terms of skill required as well as skill trained.  Its just a bit more abstracted from the "muscle powered tossing" Throwing sense.    I still think its nice to have the variation overall.
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 08:15:58 pm
Neither do I, it's more of a matter of everything being consistent, and what definition to be consistent about. Now we have one which Dioxine has provided, and it is an easy one to make consistent with the flamethrower being fixed.
Title: Re: New experience award system / accuracy training system
Post by: bluberd on April 28, 2016, 01:47:29 pm
My definition for Throwing in Piratez would be, 'skill to use muscle-propelled weapons that usually, but not neccesarily, have arcing shots; a primitive alternative to Firing'. That's why it's used in some melee weapons, for instance. However I'm not sure about the Mortar. It uses Firing/2 + Throwing/2 but does to not conform to the above definition. I'd preferably use Firing/2 + Intelligence/2, but there is no such stat in XCom... Any suggestions?

I would put mortar under throwing skill completely. I know it might seem strange, but look: mortar is available from the very start of the game, meaning you do not have very experienced gals. In the beggining of xcom I tend to buy a lot of soldiers, check their statistics, looking mainly for TU/firing/bravery/reactions in that order and then sack the crappy ones. Piratez adds melee somewhat in that equation but in general throwing is somewhat of a less useful skill. Obviously in the beggining your soldiers shoot like crap, so one dedicated soldier with high throwing skill is pretty usefull, but then when your other soldiers shoot better, you use less granades. In Piratez you have bows/blowpipes, so your dedicated throwing gal stays pretty useful somewhat longer, but when lasers/gauss are somewhat common I see no use for bow and dart pistols are better than blowpipes.
Dojo helps a lot with low throwing and in general I find throwing at the level of 50 to be enough for assault troops to safely use granades in combat situations, so not so much use for a dedicated thrower.
So in the mid game I see no use for high throwing skill. Correct me if I'm wrong, but there is no interesting throwing usage beside hellerium granades.

I know we could discuss logic behind every skill but we need to think of game balancing as well. You have set of just a few skills, let's make them useful. I've seen that issue multiple times with pen and paper RPG games, game balancing mechanics with character skills is tedious task

Also: If you really want to get into skill set for different weapons, quasi real life, logic and all, then light weapons like pistols might use also reaction (firing is aiming reaction is coordination of motor skills and perception); for example (firing+reaction)/2 - to reflect the fact of poor aim for non-shoulder weapons (takes way longer to aim) and the fact that in the combat situation there is no time to aim well with them. I know it is somewhat included in the accurancy of the pistols and the low TU cost, but the skill is somewhat different in real life to shoot for example dual hand mp5k and mk5 with a stock.
Same with throwing knifes - I know throwing is crucial, but with knifes you need to throw fast and flat and in combat there is no time to aim (I guess, I never used knife in a bar fight ;D).
Really heavy weapons might use (firing+throwing)/2 cause bipodded/tripodded heavy weapons, espacially at long distances have less in common with handheld firearms.
But then you are complicating the mechanics even more, you already need to calculate damage bonus and think which gal is the best to use specific weapon. Making the game mechanics more real-life means you need whole military chain of command to think of at every stage of the game - I know it is supposed to be mentally stimulating, but too much micromanagement is making players miserable.
Title: Re: New experience award system / accuracy training system
Post by: legionof1 on April 28, 2016, 02:49:00 pm
I will disagree with throwing becoming useless midgame. The more advanced bows have excellent stat scaleing. A longbow can get 82 base dmg before outfits are considered. With amazon base becomes 87. Brute armor reaches 94 base. Future bows top out at 107 PLASMA dmg. Do not discount archer support or being able to use the archer gals to throw flares or smoke all the way across a map. All from the safety of the landing craft.

Oh and longbows are a mere 3 tiers deep in the tree from the start point. Future bows are not particularly deep either if you can manage a few merc captain captures. Oh and no special buildings for ammo production unlike comparable damage weapons.
Title: Re: New experience award system / accuracy training system
Post by: yrizoud on April 28, 2016, 04:50:59 pm
I think he means there is a "gap" mid-game when throwing becomes comparatively less interesting.
Dioxine takes care to put throwing weapons at different states of technology and power, but since there are considerably more firearms than throwing weapons, it is very likely that during a campaign there are moments when the available "throwing tech" stagnates, while better and better firearms become available.
IMO it's not an issue since throwing weapons keep unique advantages, and thus a mixed team is better than a specialized one.
Title: Re: New experience award system / accuracy training system
Post by: bluberd on April 28, 2016, 05:05:12 pm
I will disagree with throwing becoming useless midgame. The more advanced bows have excellent stat scaleing. A longbow can get 82 base dmg before outfits are considered. With amazon base becomes 87. Brute armor reaches 94 base. Future bows top out at 107 PLASMA dmg. Do not discount archer support or being able to use the archer gals to throw flares or smoke all the way across a map. All from the safety of the landing craft.

aww, there you go, had no idea.
I used longbow for a quite a time, but at some point it stopped to be good and I have never seen plasma bow O_O. case is I have plenty plasma weapons in storage and cannot research them in any way.
When I get bigger transport the throwing gals will get in, but at 6-8 gals, throwers were not crucial as long as assaulters can throw granade somewhat accurate at 10-15 tiles.
Title: Re: New experience award system / accuracy training system
Post by: legionof1 on April 28, 2016, 05:25:00 pm
Bow do suffer against heavily armored foes more then guns do because of the 60+ pierce and plasma dmg rule. A 60+ hit from those 2 types will always remove some armor even if they fail to do hp dmg.
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 06:43:02 am
Can you add more overrides? I wanted strength gains from using certain weapons (like melee weapons).

Example:
33 train strength
34 train strength x2
35 train strength 50%
36 train strength 33%
37 train strength and melee
38 train strength or melee (coinflip)
39 train strength and reactions
40 train strength or reactions (coinflip)

Then I also wanted some options higher than 50% chance:

41 train firing accuracy 67% chance
42 train throwing accuracy 67% chance
43 train melee 67% chance
44 train reactions 67% chance
45 train bravery 67% chance
46 train strength 67% chance
47 train psionic strength 67% chance
48 train psionic skill 67% chance

And some lopsided combos...

49 train firing accuracy or throwing accuracy (67/33)
50 train firing accuracy or throwing accuracy (33/67)
51 train melee or reactions (67/33)
52 train melee or reactions (33/67)
53 train melee or strength (67/33)
53 train melee or strength (33/67)
55 train melee or reactions or strength (33/33/33)
56 train psionic strength or psionic skill (67/33)
56 train psionic strength or psionic skill (33/67)
Title: Re: New experience award system / accuracy training system
Post by: Ethereal_Medic on March 13, 2018, 08:54:18 am
I don't understand what those examples mean to be honest.
If you ramp up experience gain for stats any further, the purpose of recruiting warriors and veterans becomes pointless.
Those costly options for hiring troopers is meant to give you 'decent' and 'good' soldiers which require less to no further training to become awesome.

I guess there's a reason for non-trainable voodoo-power. Those with <30 V-Power either sit in the barracks or wear armor with +50% voodoo defence.
Training v-skill for those voodoo-wimps is still worth it and it does reduce the efficency of enemy panic-attacks.
It's not recommended to give them rocket-launchers, grenades and other mass-destruction tools.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 09:47:50 am
Can you add more overrides? I wanted strength gains from using certain weapons (like melee weapons).

Yankes added scripting possibility for experience gain, you can define all these options via a script.

Except for strength, which is not a primary skill and cannot be trained directly.
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 06:55:42 pm
If you ramp up experience gain for stats any further, the purpose of recruiting warriors and veterans becomes pointless.
I can't speak for Piratez specifically, but in general it is useful to the modder to have options to give soldiers more or less experience. If a weapon is very slow and cumbersome, it may make sense to have that weapon grant a lot of exp per use. But a very fast weapon might need to give less exp. If you feel your soldiers are skilling up too fast, then you might suggest to Dioxine to adjust that. The discussion should never approach the subject of removing a modder's feature, as modders should always be given more tools, not have them taken away.


Yankes added scripting possibility for experience gain, you can define all these options via a script.

Except for strength, which is not a primary skill and cannot be trained directly.
Can you give me an example of how to script it?
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 07:02:47 pm
Can you give me an example of how to script it?

No, I have close to no idea how scripts work... but maybe @Ohartenstein could help... I'll ping him.
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on March 13, 2018, 07:27:30 pm
I'll start off by saying I don't get yet all the intricacies of the awardExperience script, but here's the complete documentation from the verbose debug log (https://github.com/ohartenstein23/Yankes-Scripting/blob/master/yankesScript.txt#L2277).  At it's most basic, the script will run whenever experience is awarded to your unit, modifying the experience gain by a multiplier, and then returning it.  The following example just outputs the experience type and multiplier values to the openxcom.log file, so you can see what's going on:

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          debug_log 1 experience_multipler;
          debug_log 2 experience_type;

          return experience_multipler;
And no, "experience_multipler" is not a typo in the script, that's just what the variable is called.

An autoshot from a rifle on an alien looks like this in openxcom.log:
Code: [Select]
[13-03-2018_12-14-25] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-25] [DEBUG] Script debug log at     0x46: 2 4
[13-03-2018_12-14-26] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-26] [DEBUG] Script debug log at     0x46: 2 4
[13-03-2018_12-14-27] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-27] [DEBUG] Script debug log at     0x46: 2 4
Note that the experience_type variable corresponds to the types Meridian wrote down in the first post of this thread; type 4 is firing accuracy experience, trained at 100% of normal rate.

If you want to simply double experience gain for all actions, that can be done by this:
Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          mul experience_multipler 2;

          return experience_multipler;

Or if you wanted to replace 100% firing accuracy training with your request for 67% firing accuracy training, you could do it like this:
Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          if eq experience_mode 4;
            muldiv experience_multipler 67 100;
          end;

          return experience_multipler;

You can write more complex logic based on a large number of variables; I'd recommend looking at some of the script example Yankes and I have written (https://openxcom.org/forum/index.php/topic,5245.0.html) to get an idea of how to set ruleset tags on an item to influence the logic in scripts.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 08:02:44 pm
Hmm, looks like I overestimated what the script can do... this would mean only the second group of your requests (the 67% chances) is doable.

Maybe worth asking Yankes if we even understand it correctly... and if yes, if he plans on extending it...
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 08:08:54 pm
So I guess I could add a script to change a given exp gain mode that I don't use into one I do use.

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          if eq experience_mode 4;
            muldiv experience_multipler 2 3;
          end;

          return experience_multipler;

muldiv experience_multipler 2 3 should make more sense, it's not supposed to be exactly 67% but rather exactly 2/3rds, but it should make little difference either way.


Can you give an example of changing the ratio for 2 attribute types? Say I wanted to get melee 75% of the time and reactions 25% of the time. Or what if it's training melee AND reactions? Could I have it give 1 melee, plus 50% of the time 1 additional melee, or 50% of the time 1 reactions?
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on March 13, 2018, 08:15:50 pm
It doesn't matter terribly much whether you use muldiv 67 100 or muldiv 2 3, as the decimal part will just be truncated in either case due to integer math.  Also, what Meridian just said is that you can't change the ratio of two types of experience, only the changes of granting experience to the types already chosen; in the case of melee or reactions on a coin flip, that flip is already done by the time the script runs, and the script doesn't know which was chosen.  If it's training both and you want +1 experience and a 50% chance at additional +1, then you just need to have experience_multipler be 150 when you return it.
Title: Re: New experience award system / accuracy training system
Post by: FG on June 14, 2018, 06:14:29 pm
So, both these lines do the same thing?
> set experience_multipler 200;
> mul experience_multipler 2;

e.g.

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          set experience_multipler 200;

          return experience_multipler;
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on June 14, 2018, 06:18:50 pm
Close, but not quite.  For some experience training modes, the experience_multiplier is not equal to 100, for example, any of the ones that train at a 50% rate.
Title: Re: New experience award system / accuracy training system
Post by: FG on June 14, 2018, 06:29:54 pm
Close, but not quite.  For some experience training modes, the experience_multiplier is not equal to 100, for example, any of the ones that train at a 50% rate.
Oh, i see. thx for clarifying :)
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ethereal on July 30, 2018, 12:45:34 pm
In General, I did not understand anything, I did not find a script template, but the problem remained.

Not enough options for Training Mode;

?? train firing and melee (100%)
?? train firing or melee (coinflip)
?? train throwing and melee (100%)
?? train throwing or melee (coinflip)

Please explain to noob how to do this.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ashghan on May 28, 2019, 07:42:02 pm
I know this is a bit of a necro, but this seems a good topic to ask the question - is there a way to set a training mode separate for secondary melee attack? Ie. I want my gun to train firing when shooting, but stabbing with the bayonet should train melee. What I'm looking for is something like MELEEexperienceTrainingMode: XX setting, separate from experienceTrainingMode: (and overriding it in melee combat).
Title: Re: [DONE] New experience award system / accuracy training system
Post by: ohartenstein23 on May 28, 2019, 09:43:39 pm
I know this is a bit of a necro, but this seems a good topic to ask the question - is there a way to set a training mode separate for secondary melee attack? Ie. I want my gun to train firing when shooting, but stabbing with the bayonet should train melee. What I'm looking for is something like MELEEexperienceTrainingMode: XX setting, separate from experienceTrainingMode: (and overriding it in melee combat).

What you're describing is the default behavior for firearms in OXCE - if a gun has a "hit" attack, it will train melee.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ashghan on May 29, 2019, 07:07:35 pm
I admit - I chose my previous example poorly. The default work like this, yes.  But if you use the  experienceTrainingMode: to override the default behaviour, then any attack made with that weapon gives the same type of training. So if I override a rifle to type 14 experience training Firing + Reactions, it's gunbutt melee attack will also give fire + react not melee. My question is - would be possible to apply different types of experience to different attacks. Ideally something like - Aimed (Firing), Snap (Reactions), Gunbutt (Melee) - or whatever other skill defined by use.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on March 07, 2021, 11:50:23 am
Since OXCE v7.0, the psiamp experience training was extended.

Note: the vanilla psiamp training stays unchanged (+1 psi skill exp on attack failure, +3 psi skill exp on attack success).

The following rules now apply for modding:

1. only naturally psi capable soldiers can gain psi skill exp or psi strength exp (both in default and in custom training mode)
- naturally psi capable means `base psi skill > 0` (ignoring armor bonuses and soldier bonuses)
- Note: if the psiamp trains non-psi skills, the soldier doesn't need to be naturally psi capable

2. custom experience training (`experienceTrainingMode > 0`) works only on successful psi attacks
- since oxce 7.0, panic attack and mindcontrol attack support custom training too
- Note: "oxce psi use" attack supported custom training already before oxce 7.0

3. psi strength experience for victims/targets is only awarded when using a psiamp, which requires psi skill (`psiRequired: true`)

See the exact algorithm on the attached picture.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: spectrefps on May 19, 2021, 07:11:52 pm
Heya! Does that "only first pellet counts" rule still apply to shotguns/shotgun-like weapons for the purposes of skill training (counting as a HIT)? I re-read the Notes part of the main post (not sure if that part was also updated in March), and the description in the Notes section sounds like "if any pellets in the attack hit, treat the whole attack as a HIT and award a training point for the whole attack" (and if I understand that correctly, a MISS would only occur if ALL pellets managed to miss an enemy?). If so, that is pretty awesome and makes shotguns pretty good for training terrible shots (without allowing them to exploit the multiple-XP per shot bug! Unless they are shooting grenade shots too now >:D).

I saw the comment from back in 2018 asking about the 'only 1st pellet counting' rule (and your explanation why), but that was from years back, so I'm not sure if that system/rules were updated again since then. But based on the notes, it sounds like you were able to have the game treat the whole "group" of pellets as a single 'normal' attack for determining Hit/Miss and giving training XP?
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Yankes on May 19, 2021, 10:48:53 pm
Shoot gun exp work that you can grain max 1 point in each exp type per shoot. But each hit can grain this exp point. In case of 100% chance then effective first hit matter, but if you have 2% per hit then every hit matter as they effective "sum up" to max 1 exp.

code that implement this is simple calculate max before hit, then hits happens and each one try add exp, after all shoots hits, result exp is cap by value calculated before hits.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on May 19, 2021, 10:49:13 pm
Yes, it was changed in July 2017 in OpenXcom: https://github.com/OpenXcom/OpenXcom/commit/dea958d1cf8f119ca85dcd04c200bff58cdb2cb4
and a bit later in OXCE too

All pellets count, but together they can give you only one experience point (per skill).
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on May 19, 2021, 10:49:43 pm
ninjad by Yankes by 5 seconds... figures :)
Title: Re: [DONE] New experience award system / accuracy training system
Post by: spectrefps on May 20, 2021, 03:53:46 am
OH wow thanks both of you!! (I'm excited to get not just 1 but TWO devs to reply to me! :D) Ok so shotguns sound pretty forgiving to train rookies (or just absolute pants shooters) even if most of the scatter misses their mark, as long as any pellet manages to successfully hit the enemy (which I figure is the main saving grace of shotguns vs rifles/cannons?).

Good to know, and this info gives me a good reason to not just slap rifles or cannons on everyone! XD Typically I'd always just use 'normal' single-hit guns on everyone whenever possible (my idea being "Kill FAST = safer mission"), and thus while playing throu X-COM Files I was wary of the shotgun weapons until recently (especially since armor would affect EACH pellet, if I understood ufopedia's damage/armor page correctly :O). But their wide spread and many "hits" per attack should prove handy for my troops that aren't "ready" for bigger guns yet (for fear of decimating their comrades with friendly fire XD). I think shotguns may start to grow on me! :D

Also I like the idea of an inexperienced trooper still being able to contribute by catching a sectoid with a lucky scattershot, when they'd miss or be useless otherwise with a normal rifle. Even if they can't really hurt anything with armor, they can still rough up the little greys for the rest of the team to finish.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: spectrefps on June 01, 2021, 10:33:39 pm
Heya! Got 2 more questions:

1: If I understand the first post correctly, incendiary damage *does* give XP now? I remember learning a while back (from the UFOpedia site! :D) that fire damage was "weird" in original x-com, both in how it did damage, and how it handled XP. Apparently, it only gave xp for *reaction* shots that hit, but not "normal" hits... So you've managed to change it to work like "normal" weapon hits too then (giving xp for normal shots that hit, not just reaction fire)? If so, THAT IS AWESOME! That xp-weirdness in the original seemed like another (small) disadvantage to using that ammo/damage, so I feel that fixing that bug/issue helps bring it more in line with other damage/ammo types (plus no more missing out on xp for issuing fire-ammo to troopers! Alien roasting time! >:D).

2: For incendiary-damage, does the*power* value actually affect the "direct-hit power" of the shot/ammo now (with the latest OXCE) or is it still like original x-com (where "power" only changed the *radius* for incendiary, according to the Ufopedia site)? It seemed kind of odd when a big cannon shot did so little "hitting damage" with incendiary (5-10 for a direct-hit, if I understood it correctly?). I'd imagine even getting hit by just a big rock of that size/speed would do more damage (and flatten that cursed sectoid! :P).
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ethereal on August 06, 2021, 01:46:55 pm
What happens to TrainingMode: 5? After a dozen hits from weapons with TrainingMode: 5, I find this picture in the save file:

Code: [Select]
      expBravery: 0
      expReactions: 0
      expFiring: 0
      expThrowing: 0
      expPsiSkill: 0
      expPsiStrength: 0
      expMana: 0
      expMelee: 0

And the recruit at the end of the first battle does not get any experience, leading extremely active combat operations.
There is a suspicion that TrainingMode: 2\3\6\8\9 they work in the same way - a little worse than just useless. Apparently, these chances work without a accumulating component.

There is no save file left, but this situation can be easily modeled and checked without a save file.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on August 06, 2021, 03:47:20 pm
There is no TrainingMode, there is only experienceTrainingMode.

Test on STR_PISTOL:

Code: [Select]
items:
  - type: STR_PISTOL
    experienceTrainingMode: 5

After using all 12 rounds in the clip, save file contains:

Code: [Select]
      expFiring: 4
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ethereal on August 06, 2021, 06:29:15 pm
Strange. Is it always like this? In addition, we are talking about 50%, which means there should be expFiring: 6.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on August 06, 2021, 07:53:56 pm
It's a 50% roll every time.
So it can be anywhere between 0 and 12... 6 is just the most probable outcome.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Leprechaun on August 09, 2021, 07:42:46 am
If I understand correctly, each event that constitutes training has a set percentage chance of increasing the corresponding skill.

I was a member of the 5th Army Rifle team, and as such, I did a lot of quality shooting, However, having already been pretty good, it was hard for me to get better, whereas I could easily add 15 to 30 points (7% to 14%) to the scores of relatively untrained shooters through an hour or so of coaching. What I'm suggesting is that the better you are, the harder it is to get still better.

Pseudo code might look something like this:

For each event which might produce an increase in skill:
      If ( Rnd(100) < (MaxSkill - CurrentSkill) then CurrentSkill++

The higher your current skill is, the less likely you can increase it.

There was an earlier discussion from 5 years ago about whether bravery could increase by killing things.

Even though I was scared of heights, I went to Airborne school, thinking that would be the way to overcome it. Jumping from the 34 foot tower, I had my eyes shut every time and was dogged for it. I finally was so mad I psyched myself into thinking I would plant my feet in the Instructor's chest. Of course, I didn't get within 6 feet of him, but I was able to keep my eyes open. I had 82 parachute jumps over 21 years, and I'm still scared of heights.

I suggest that Bravery increase (limited as above by how close you are to MaxBravery) for each time you are wounded or are psychically attacked. In each case, if you survive, you know it's possible to do things you rightly should be afraid of, which is what bravery is all about. Killing things doesn't increase bravery, any more than shooting targets increases bravery.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: The Reaver of Darkness on August 18, 2021, 04:16:55 pm
The simple (yet not highly effective) way is to use training centers and set the training caps lower than their max. That way they train faster while the training center is still helping them.

If you find a way to do what you're suggesting, let me know.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Leprechaun on November 08, 2021, 10:28:10 pm
Sorry, I thought I had done that in the pseudo code I posted above.

Let's consider a hypothetical rating of IQ. Let's further say that the average for humans is 100, that a moron is below 70, and that Einstein is at 160. Let's also agree that we aren't allowing any morons into the Agent team, so 70 is the absolute floor for IQ.

How difficult is it for the Moron to increase his IQ? Relatively easy. If he just memorizes that 2+2=4, his IQ might be 71 instead of 70. Likewise how easy is it for Einstein to increase his IQ? What book does he read; who knows enough more than he does to give him a boost?

Programmatically, I might say that the minimum IQ is 70 and the absolute human maximum is 170. (Gotta give Einstein at least some hope for improvement.) For each event where the subject might gain an IQ point:

IF (CurrentIQ-70 < RND(100)) CurrentIQ++;

In English, if the subject's current IQ minus 70 is less than a random number between 1 and 100, then increment his IQ by one.

Examples: Consider a subject with an IQ of 100 who does something that MIGHT raise his IQ. 100 minus 70 is 30. A random number from 1 to 100 has a 70% chance of being greater than or equal to 30, so the subject has a 70% chance of gaining a point.

Consider Einstein. 160 minus 70 is 90. A random number from 1 to 100 has a 10% chance of being greater than or equal to 90, so Einstein has a 10% chance of gaining a point.

The closer you get to perfection, the harder it is to get better.

It just seems to me (and it's been my current experience) that if you send your players to the same training, they tend to look like carbon copies of eachother, hitting the training max value. With a system like I have suggested, there will be some variation, even if you are able to keep the same avatars alive for the entire game.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Meridian on April 23, 2023, 11:30:35 am
This feature is now optional (since OXCE v7.9).

By default it is turned ON... but later in OXCE v8.0+ it will likely be turned OFF by default.
Modders please update your mods already now during the transition period.

Code: [Select]
constants:
  extendedExperienceAwardSystem: true

For people who want to turn it off and return to vanilla days, here's the summary of differences:

If turned off:
1. throwing anything anywhere gives throwing exp
2. throwing exp doesn't trigger primary stats increase
3. grenades and proxies give firing exp by default
4. firearms give firing exp by default, regardless of max range or arcing
5. you can train on mind-controlled enemies