Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Roujin

Pages: [1]
1
Are you familiar with git? You should put your changes up there so that others can use it.
You mean GitHub? No, haven't used it yet.
Obviously I used git (TortoiseGit to be specific) to clone the code base and make the patch.

Others can already use it though, if they want - just have to download and apply the the patch, right? :)

Why not simply show only the improved stats?
[...]

Hmm, showing only the improved stats is an idea I didn't think about.
I guess it would look a bit unorganized though.
Also a lot of repetition of the stat names (TU, STA, ...) and if one soldier gains stats in all or most categories, it definitely won't fit in the line.

[...]
Can you at least dump the dots?

I had tried several combinations before I decided for this one: with/without dots, yellow or green, zero or dash for unchanged stats.
Just removing the dots looks too empty imo (screenshot 08).
Removing the dots but adding dash for unchanged stats was a close contender though (screenshot 07). Do you think that one is better than the dots?
(note: old screenshots with wrong stat order)


We already have Soldier Diaries in so why not also put Infoscreens into the Soldier Diaries, to see Statincreases for the Soldier in the Mission that occured.
And maybe a overview for Missions, to see this infofield, not only after battle but also in the diary screen.

Sure, that would be a nice addition. :)
Maybe I'll add it some time.

2
Long time no see :)

I noticed the news post about "Soldier Diaries" being adopted into master a few days ago, and figured I would rebase my patch here to current master and see if there is any interest in it.
Unfortunately because I'm a git noob I didn't manage to preserve the patch queue and have only a single patch now. (updated in first post)

Here's a new screenshot from a TFTD game :)

3
Programming / Re: New Feature: Infinite base sizes, POLL
« on: July 27, 2014, 02:21:07 am »
Funny that you mention that piece of code of all things.

I changed exactly that piece of code (toward more clean/understandable code, as far as I'm concerned) in this patch of mine which aims to make the whole stat gain logic accessible via ruleset.

Unfortunately the devs seem not to be fond of my patch either.
Of course, it's their codebase to maintain. I can understand that. They don't want every crappy piece of code someone contributed in their codebase.
But on the other hand I can understand that people are turned off to contribute if there is such a reluctance to merge in some new feature - or added flexibility for modders - only on grounds that it would be one more thing to maintain.

4
what about the "showing what soldier increased in stats"-window
SupSuper said that it's interesting (or something along the lines) and that he'd look at it when he finds the time. Warboy seems to be a critic of changes that depart from original xcom, so maybe making the screen optional and off-by-default might be a requirement before he agrees.

Even if it's not put into trunk, you can still use this you know, you'll just have to checkout, apply the patch, and compile the game yourself. ;)

5
Programming / Re: Exposing stat increase calculation to ruleset
« on: June 29, 2014, 06:45:18 am »
Here's some more documentation about how it works:

Each stat can have the following variables:
Code: [Select]
requirement: list of the exp requirement for each "tier".
chance: list of chances for each tier to get a stat increase at all
valueMin: list of minimum stat change
valueMax: list of maximum stat change
tierFactorMin: list of minimum stat change factor multiplied by tier
tierFactorMax: list of maximum stat change factor multiplied by tier
remainderFactorMin: list of minimum stat change factor multiplied by how much can still be gained in that stat
remainderFactorMin: list of maximum stat change factor multiplied by how much can still be gained in that stat
enablesSecondary: true or false - whether this stat counts into secondary stats

For secondary stats (health, tu, stamina, strength), enablesSecondary is obviously not useful, but otherwise, all these values are available for all of the stats.
All these values have sensible default values (mostly 0), and you can also just write a single number instead of a list of numbers, if you want every entry to be the same - except for requirement, that one has to be a list.



Here's an example:
Code: [Select]
    statGain:
      primary:
        firing:
          requirement: [1, 2, 4, 8]
          chance: [0.5, 0.75, 1, 1]
          valueMin: 0
          valueMax: [2, 2, 3, 4]
          tierFactorMin: 0.5
          tierFactorMax: 1
          enablesSecondary: false
(actually valueMin could be left out here because it defaults to 0)

This changes the firing accuracy skill to the following:
If a soldier scored 1 hit, he has a 50% chance of gaining points at all.
If he does, he gets between 0 (0 + 0.5*1 rounded down) and 3 (2 + 1*1 rounded down) points.
--
If he scored 2 to 3 hits, he has a 75% chance of gaining points at all.
If he does, he gets between 1 (0 + 0.5*2 rounded down) and 4 (2 + 1*2 rounded down) points.
--
If he scored 4 to 7 hits, he has a 100% chance...
to get between 1 (0 + 0.5*3 rounded down) and 6 (3 + 1*3 rounded down) points.
--
If he scored 8+ hits, he has a 100% chance...
to get between 2 (0 + 0.5*4 rounded down) and 8 (4 + 1*4 rounded down) points.
--
Finally, the line "enablesSecondary: false" means that exp gained for hitting targets will not trigger secondary stats (tu, health, stamina, strength) to increase, in contrast to original xcom behavior.


I hope this helps anyone who is willing to try my patch out ;)

6
Programming / Re: Exposing stat increase calculation to ruleset
« on: June 29, 2014, 06:28:09 am »
Well, I implemented it. Here's a patch.
However I talked to the devs on the IRC and they don't seem to be all that hyped on exposing all this to rulesets. :P So don't count on it actually getting into trunk.

Anyway, here's the patch.

7
Programming / Re: Exposing stat increase calculation to ruleset
« on: June 28, 2014, 11:27:06 pm »
I've revised the values a bit, mainly regarding bravery. I got rid of the "ChanceDivisor", in favor of just having a float-type chance in there. True, elevenths cannot be exactly specified as decimal numbers, but I think it is close enough. When I give the chances as
Code: [Select]
          chance: [0.0909, 0.1818, 0.2727, 0.3636, 0.4545, 0.5454, 0.6363, 0.7272, 0.8181, 0.9090, 1]
... the deviation from "true" 1/11th, 2/11ths etc. are just in the range of 0.000001 to 0.00001. I would say that this is acceptable. If not, just write some more 090909s into the rule file ;)

I also changed the value arrays for the primary stats to a "tierFactorMin" and "tierFactorMax", to more closely mimic the current computation.
But it still stands that the computation we have does NOT correspond to original xcom (according to ufopaedia).
I hope some dev reads this topic and can give some clarification on this (should it be fixed, or is it on purpose?).


So currently the rule variables look like this:
Code: [Select]
soldiers:
  - type: XCOM
     (... existing variables ...)
     statGain:
      primary:
        (bravery/reactions/firing/throwing/psiStrength/psiSkill/melee):
          requirement: (list of integers)
          chance: (number or list of numbers, default 1)
          valueMin: (number or list of numbers, default 0)
          valueMax: (number or list of numbers, default 0)
          tierFactorMin: (number or list of numbers, default 0)
          tierFactorMax: (number or list of numbers, default 0)
          remainderFactorMin: (number or list of numbers, default 0)
          remainderFactorMax: (number or list of numbers, default 0)
          enablesSecondary: (boolean, default true)
      secondary:
        (tu/stamina/health/strength):
          (same as above, except enablesSecondary)

Then the stat gain computation would be done like this (pseudocode):
Code: [Select]
tier = (highest index in requirement, so that requirement[index] <= experience)
if (RNG(0.0, 1,0) > chance[tier]) gain = 0;
else
  remainder = statcap - statcurrent;
  gain = RNG((int) (valueMin[tier] + tierFactorMin[tier] * (tier+1) + remainderFactorMin[tier] * remainder),
             (int) (valueMax[tier] + tierFactorMax[tier] * (tier+1) + remainderFactorMax[tier] * remainder));
endif

That way, the computations of bravery, all other primary stats, and the secondary stats are unified.
Only the default ruleset will specify what is currently hardcoded - namely that that chance is only used for bravery (it is always 1 for all other stats), or that the secondary skills (and only them) are calculated with regards to the remaining points to be gained until the stat cap; or that you always have the same secondary skill gain, regardless of how much primary-skill-experience you gained... modders will have free reign to change all that :)

now it only remains to be actually implemented  :P


PS: default ruleset will look like this:
Code: [Select]
    statGain:
      primary:
        bravery:
          requirement: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
          chance: [0.0909, 0.1818, 0.2727, 0.3636, 0.4545, 0.5454, 0.6363, 0.7272, 0.8181, 0.9090, 1]
          valueMin: 10
          valueMax: 10
        reactions:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
        firing:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
        throwing:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
          enablesSecondary: false
        psiStrength:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
        psiSkill:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
        melee:
          requirement: [1, 3, 6, 11]
          tierFactorMin: 0.5
          tierFactorMax: 1.5
      secondary:
        tu:
          requirement: [1]
          valueMax: 2
          remainderFactorMax: 0.1
        stamina:
          requirement: [1]
          valueMax: 2
          remainderFactorMax: 0.1
        health:
          requirement: [1]
          valueMax: 2
          remainderFactorMax: 0.1
        strength:
          requirement: [1]
          valueMax: 2
          remainderFactorMax: 0.1

8
Since Aldorn asked about this being a possibility / how difficult this would be in this post, I decided to investigate that for a bit.

Turns out that it wouldn't be all that hard from a coding standpoint.
However, it is a bit more challenging to come up with what values exactly to set in the ruleset, so that we can
a) match exactly the original / current calculation of stat gains.
and
b) give modders all the freedom they need wrt. changing the behavior.

This is what I have come up with for now (feedback appreciated):
Code: [Select]
    statGain:
      primary:
        bravery:
          requirement: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
          chance: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
          chanceDivisor: 11
          valueMin: 10
          valueMax: 10
        reactions:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
        firing:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
        throwing:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
          enablesSecondary: false
        psiStrength:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
        psiSkill:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
        melee:
          requirement: [1, 3, 6, 11]
          valueMin: [0, 1, 1, 2]
          valueMax: [1, 3, 4, 6]
      secondary:
        tu:
          requirement: [1]
          valueMin: 0
          valueMax: 2
          remainderShareMin: 0
          remainderShareMax: 0.1
        stamina:
          requirement: [1]
          valueMin: 0
          valueMax: 2
          remainderShareMin: 0
          remainderShareMax: 0.1
        health:
          requirement: [1]
          valueMin: 0
          valueMax: 2
          remainderShareMin: 0
          remainderShareMax: 0.1
        strength:
          requirement: [1]
          valueMin: 0
          valueMax: 2
          remainderShareMin: 0
          remainderShareMax: 0.1

If I am not mistaken, this set of values should suffice to emulate the original xcom / current* behavior, while at the same time allowing modders all the freedom with regards to how exactly experience gain translates to stat gain. Note that it is not possible to change WHAT actions cause the experience gain in for one category; that would be a different topic altogether. Only the translation from experience (= successful actions taken) to stat gain is.

* there actually is a slight deviation in current trunk code to what ufopaedia has to say about original xcom calculation.
Code says:
Code: [Select]
return (int)(tier/2.0 + RNG::generate(0.0, tier));
... where tier can be either of 1.0, 2.0, 3.0, or 4.0. Zhis will result in the following chances:
edit - I missed some facts.. turns out the code is off even more than I thought.
Keep in mind that double->int conversion is rounding DOWN, not rounding to nearest int.

tier 1: random between 0.5 and 1.5 -> 50% for each of 0, 1
tier 2: random between 1.0 and 3.0 -> 50% for each of 1, 2
tier 3: random between 1.5 and 4.5 -> 1/6 for 1, 2/6 for 2, 2/6 for 3, 1/6 for 4
tier 4: random between 2.0 and 6.0 -> 25% for each of 2,3,4,5
(note that rounding is done after the random number generation, not to both the min and max value)

I don't know if this is deliberate or an oversight while coding.
It strikes me now that this may also be case in original xcom, just not explained so well in the wiki.
In this case I may revise the ruleset variables for primary stats a bit more...

edit: I once more thought about the code above and think now that it's most definitely a bug.
For example for tier 2 (3-5 successful actions), a random number is generated between 1.0 and 3.0. It is then converted to int (=rounded DOWN), which results in 1 in 50% of the cases and 2 in the other 50%. To be precise there is (maybe) a tiiiiiny tiny chance that the RNG hits exactly 3.0, but that's near impossible. So this code definitely needs a fix.

9
Programming / Re: Showing Soldier stat increases after mission
« on: June 28, 2014, 05:00:31 pm »
I have now investigated that topic for a bit and I would say that it would not be very difficult, code-wise (also the part about exposing it to the ruleset).

The more challenging feat would be coming up with a set of values to be set in the ruleset that can
a) match exactly the original / current calculation of stat gains.
and
b) give modders all the freedom they need wrt. changing the behavior.

I have come up with something there, but I will open a new topic for that, since it does not really belong into this one. ;)
edit: here is the thread: https://openxcom.org/forum/index.php?topic=2474.0

10
Programming / Re: Showing Soldier stat increases after mission
« on: June 28, 2014, 02:49:21 pm »
Well, I did see the part of the code where the stat gains are calculated. To change that in code would be easy.
You are referring to linking this with the rulesets though, right? Being able to set some thresholds in a ruleset, that are then used in the stat gain calculation.
I don't have any idea about how these rulesets work yet, so I cannot estimate how easy or hard this is to do. ;)


11
This is my first post here, so hello everyone. :)
I'm a long time fan of the xcom series and have also been involved with some other open source projects like OpenTTD and CorsixTH (thanks for the plug in your recent news post ;)).

First off congratulations on your 1.0 release.
When I got the news of this, I just had to try it out, and ended up sinking a week into the game straight up. So addicting :D
At some point in the game I started being more interested in detail mechanics like how my soldiers gain stats. So I looked that up on the wiki and then thought that it would be nice to have a statistic at the end of a mission that shows which soldier(s) earned how many stat points.

So I figured I could just implement it myself, and contribute it, if you find it a good thing to add.

I added an additional button "STATS" to the debriefing screen, you can use that to toggle between the usual scores and a list of all soldiers that have earned stats, with exactly how many they earned per stat.
Since it is a bit problematic to fit all that data on the screen, I could not use the usual stat names "HEALTH", "STRENGTH" etc., but had to introduce abbreviations HP, STR, etc.
To help clarify what each of these means I made them display a tooltip with the full name if you hover over them.


Find attached a screenshot and the patch.

(edit Dec 08, 2015: rebased to current master)


Pages: [1]