Loading [MathJax]/extensions/Safe.js

Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3]   Go Down

Author Topic: Work on the old Random Failure Mod...  (Read 1041 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6232
Re: Work on the old Random Failure Mod...
« Reply #24 on: March 20, 2025, 09:25:46 PM »

I can query FM.actor.getArmy(), which returns 1 for red and 2 for blue. Do I presume that these are absolute values, meaning 1=red is always Allied and 2=blue is always Axis? And how does this work across all modules, from DOF to JTA? This is the first time I'm looking into such matters...   :-|

If the red/blue paradigm holds, then in this way a bias can be applied so as to represent the deterioration of equipment fielded by one side versus the other over time. Furthermore, this can be refined by use of a check against the actual mission date (in the same way a default skin for a plane can be chosen.). I suppose use of the actual country name could be applied as yet a further refinement, although there are a LOT of countries to potentially consider.  o_O

BTW, does anyone know if the mission date must be represented as the hex equivalent? Or could one specify, e.g, 19430915 (or is it 430915?) for 1943, Sep 15?
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6232
Re: Work on the old Random Failure Mod...
« Reply #25 on: March 20, 2025, 11:42:06 PM »

I just made up this algorithm to convert the reported mission date into a decimal year. Am I unnecessarily 'reinventing the wheel'? Is there already an easy means to get the decimal year? Anyway, my code is of Neanderthalic crudity and certainly could be made more elegant!  ;)

Anyway, I now have the means by which to apply a timeline for, e.g., the systematic degradation in quality of equipment. For example, if a period of time is defined from 1944.25 to 1945.5, the chance of failures could be made to increase linearly from the baseline probability to, say, triple the baseline probability by the end of the period of time so defined.

Mission date format yyyymmdd to yyyy.yy:
Code: [Select]
int j = Mission.getMissionDate(false);
double j_y = Math.floor ((double) j / 10000D);
double j_m = (double) j - j_y * 10000D;
j_m = Math.floor (j_m / 100D);
double j_d = (double) j - (Math.floor ((double) j / 100D) * 100D);
float fYear = (float) (j_y + (j_m - 1D) / 12D + (j_d - 1D) / 365D);
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6232
Re: Work on the old Random Failure Mod...
« Reply #26 on: March 21, 2025, 12:07:58 AM »

Silly me! I just did a little digging and found that I can directly obtain the year, month and day with:

  int y = Mission.curYear();
  int m = Mission.curMonth();
  int d = Mission.curDay();

If I need only the decimal year, a single line does the trick:

  float fDecimalYear = ((float) Mission.curYear() + (float) (Mission.curMonth() - 1) / 12F + (float) (Mission.curDay() - 1) / 365F);

The subtraction of 1 from the day is needed to keep Dec 31 from rolling into the next year (i.e., 1943/12/31 would otherwise be 1944.0016). And 1943/1/1 becomes 1943.0.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

GeraltNotRivia

  • member
  • Offline Offline
  • Posts: 50
Re: Work on the old Random Failure Mod...
« Reply #27 on: March 21, 2025, 05:02:55 AM »

Quote
I can query FM.actor.getArmy(), which returns 1 for red and 2 for blue. Do I presume that these are absolute values, meaning 1=red is always Allied and 2=blue is always Axis? And how does this work across all modules, from DOF to JTA? This is the first time I'm looking into such matters...

Excellent!  8)

I would assume that 2 is always blue side and 1 red side, so no matter of module, it works always same.

Quote
Furthermore, this can be refined by use of a check against the actual mission date (in the same way a default skin for a plane can be chosen.)

If this is optional and there is still possibility to change values, then yes it would work, but I think this is too much of hassle. It wouldn't work well with DOF and JTW, and can have too much work to add specific value per time period for this setting to have any valuable differences in big picture. Mission makers would still want to change setting to their own liking. I would. ;)
Logged

Whiskey_Sierra_972

  • Modder
  • member
  • Offline Offline
  • Posts: 6795
  • In memory of my beloved hero: Saburo SAKAI!
Re: Work on the old Random Failure Mod...
« Reply #28 on: March 21, 2025, 09:55:05 AM »

From all entries of the .ini files 1 is always red while 2 is always blue....
Logged
Pages: 1 2 [3]   Go Up
 

Page created in 0.038 seconds with 21 queries.