OpenXcom Forum

Contributions => Programming => Topic started by: Ran on March 05, 2013, 08:05:43 pm

Title: Question on alien appearance ratios
Post by: Ran on March 05, 2013, 08:05:43 pm
I've always wondered how the appearance ratios of alien races are calculated.

While they are very different from game to game they are clearly nonrandom and also different from the original game.
https://www.ufopaedia.org/index.php?title=Alien_Appearance_Ratios

Is this set at the start of a new game or have I simply experienced some statistical freak events?

I've started a couple of new games with modified instantly built hyperwave decoders and monitored everything that appeared on the globe for the first few months.
The majority of games starts with either floaters, sectoids or a mixture of both as expected, other races join in later.
But I've also had games with only floaters or only sectoids for the first 4-5 months, in one case it was only snakemen from the beginning to July.
Another combination was only sectoids and etherals but nothing else in 6 months.
Generally, snakemen and especially mutons were rare, I've only seen very very few ships with mutons so far.






Title: Re: Question on alien appearance ratios
Post by: Warboy1982 on March 05, 2013, 10:49:07 pm
i'm pretty sure we copied those values exactly, but their might be some computational error going on here.
maybe it's not enumerating the lists properly or something.
Title: Re: Question on alien appearance ratios
Post by: Ran on March 09, 2013, 12:17:39 am
I've run a game from Jan-Aug at beginner level using custom hyperwave decoder and calculated the appearance ratios for each month:

January
-----------
Sectoid:        0%
Floater:       67%
Snakeman: 33%
Muton:          0%
Ethereal:       0%
Total UFOs:     9

February
-----------
Sectoid:      38%
Floater:       43%
Snakeman:   0%
Muton:          0%
Ethereal:     19%
Total UFOs:     42

March
-----------
Sectoid:      55%
Floater:         4%
Snakeman: 17%
Muton:          0%
Ethereal:     24%
Total UFOs:    29

April
-----------
Sectoid:      33%
Floater:       17%
Snakeman: 12%
Muton:          0%
Ethereal:     38%
Total UFOs:    24

May
-----------
Sectoid:      60%
Floater:       30%
Snakeman: 10%
Muton:          0%
Ethereal:       0%
Total UFOs:    20

June
-----------
Sectoid:        0%
Floater:       34%
Snakeman:   4%
Muton:        48%
Ethereal:     14%
Total UFOs:     29

July
-----------
Sectoid:        0%
Floater:       57%
Snakeman: 20%
Muton:          3%
Ethereal:     10%
Total UFOs:    40

August
----------
Sectoid:        0%
Floater:       38%
Snakeman: 59%
Muton:          3%
Ethereal:       0%
Total UFOs:    32


Unfortunately you actively have to shoot down most UFOs to keep the game going which makes gathering data a lot of work. For proper statistics a multitude of such datasets would be necessary.

If you just monitor, it's a lot less work but the game ends after Feb.
Most games are are as expected but there are some exceptions:

January
-----------
Sectoid:        0%
Floater:       50%
Snakeman: 50%
Muton:          0%
Ethereal:       0%
Total UFOs:     8

February
-----------
Sectoid:        0%
Floater:       47%
Snakeman: 53%
Muton:          0%
Ethereal:       0%
Total UFOs:    19


Actually I think that's a good thing, it gives the game more randomness.
Title: Re: Question on alien appearance ratios
Post by: hmaon on March 09, 2013, 03:25:45 am
You could always hack the game not to end regardless of all factors.
Title: Re: Question on alien appearance ratios
Post by: Ran on March 10, 2013, 01:07:10 am
Well, I'm sure you can, but I'm a n00b when it comes to programming... :(
Title: Re: Question on alien appearance ratios
Post by: karvanit on March 10, 2013, 04:24:40 am
Looking at the Xcom1Ruleset.rul, I see that I have missing races for the Alien Abduction type missions. However the rest of the missions types are correct. Are you sure you have the proper ruleset file?
Title: Re: Question on alien appearance ratios
Post by: Warboy1982 on March 10, 2013, 03:41:29 pm
weird, i see the abduction rates :P
Title: Re: Question on alien appearance ratios
Post by: Volutar on March 10, 2013, 04:04:40 pm
Ran, those numbers almost doesn't mean anything. Each mission type has particular ratios. I.e. hose are mission-dependent values.
Title: Re: Question on alien appearance ratios
Post by: Ran on March 10, 2013, 10:49:50 pm
Yes, I know.
I didn't bother to make results for each mission type as this is way to little data anyhow but still you can see there is something wrong sometimes.
I don't think you should experience only snakemen and floaters in the fist 2 months, nor should there be ethereals in February.

As soon as mindshield works or there is a debug mod in which you can't lose I will gather more data.
Title: Re: Question on alien appearance ratios
Post by: darkestaxe on March 29, 2013, 06:05:09 am
The chances for a given alien type to appear as set before you start the game are month to month based on the appearance ratios you linked. What you need to understand is that only a handful of actual new missions are launched through-out the game.

To illustrate this, look at a save file under 'AlienMissions'. (open it in notepad++, select YAML as the language, hit alt-0, and scroll down and expand just 'AlienMissions'.

In early games you will likely only see a reaserch or terror mission. The reaserch mission will be sectiod and will launch only sectiod UFOs. The terror mission could be sectiod or floater.

By June you will see a retaliation mission for each base you've built and generated some hostility toward and one or two infiltration missions. These missions don't go away until they're completed so if you shoot down terrorships preventing terror sites you will also have a terror mission.

The race of each mission is determined when the mission is started. The aliens will only run one terror mission at a time to If you haven't let a terror site happen since feb then terror mission UFOs are going to be sectiod/floater until you let the aliens complete their mission and start a new one.

If you start a new game and create 8 bases with hyperwave and avengers all in jan, then you will see non-stop sectiod ships. This is because the aliens launched 8 sectiod retaliation missions and probably a couple other sectiod missions and never complet anything, because you shoot them down. If you were to allow each base to be detected and defend each one, you should get all new retaliation missions afterward with races based on when the new missions are started. Retaliation mission race might be dependent on the race of the UFO you shot down to start the retaliation.
Title: Re: Question on alien appearance ratios
Post by: Volutar on March 29, 2013, 06:48:33 am
Retaliation mission isn't generated by its own. It's generated due to first research ufo shoot down (or other UFOs), with some chance. Race of retaliators depends on UFO race you've hit, they are simply revenging. And target of revenge is either base of offender, or base in the destination area of fallen UFO.
Title: Re: Question on alien appearance ratios
Post by: Ran on March 30, 2013, 02:29:36 am
darkestaxe, this is what I would expect but that's not what is always happening.

I've had snakemen-only games with no other races for the first 2 months, retaliation-missions by ethereals in Jan and generally an obscure scarcity of mutons. Some behavior surely was caused by the retaliation bug (all ufos were scanning for xcom bases for retaliation regardless of their mission).
My main game which is near completion is pretty normaI, except that I have not seen a single muton and it's July. Ethereals only popped up recently with infiltration missions. Generally most missions are run by sectoids, followed by snakemen, then floaters.

alienMissions:
  - type: STR_ALIEN_INFILTRATION
    region: STR_EUROPE
    race: STR_FLOATER
    nextWave: 2
    nextUfoCounter: 0
    spawnCountdown: 10500
    liveUfos: 0
    uniqueID: 8
  - type: STR_ALIEN_RETALIATION
    region: STR_NORTH_AMERICA
    race: STR_SECTOID
    nextWave: 3
    nextUfoCounter: 1
    spawnCountdown: 660
    liveUfos: 0
    uniqueID: 18
  - type: STR_ALIEN_HARVEST
    region: STR_NORTH_AMERICA
    race: STR_SECTOID
    nextWave: 4
    nextUfoCounter: 0
    spawnCountdown: 4290
    liveUfos: 0
    uniqueID: 20
  - type: STR_ALIEN_TERROR
    region: STR_NORTH_AFRICA
    race: STR_SECTOID
    nextWave: 1
    nextUfoCounter: 0
    spawnCountdown: 1620
    liveUfos: 0
    uniqueID: 21
  - type: STR_ALIEN_INFILTRATION
    region: STR_AUSTRALASIA
    race: STR_ETHEREAL
    nextWave: 2
    nextUfoCounter: 0
    spawnCountdown: 13740
    liveUfos: 0
    uniqueID: 22
 

Title: Re: Question on alien appearance ratios
Post by: SuperVGA on April 22, 2013, 12:34:48 pm
While they are very different from game to game they are clearly nonrandom and also different from the original game.
https://www.ufopaedia.org/index.php?title=Alien_Appearance_Ratios
I just examined the tables and I'm impressed with the work put into showing and verifying the appearance ratios.

But this has made me really curious on a related thing: Is there any table showing the average frequency of different mission (and perhaps craft) types throughout the game?

For instance:
JAN 1999 - Small Scout 66%, Large Scout 10%, Battleship: 2% etc.
       and Alien Research 48%, Alien Abduction 20% etc?


-Otherwise perhaps I can extract them from the ruleset. (judging by Ran's post, that should be doable)
Title: Re: Question on alien appearance ratios
Post by: Volutar on April 22, 2013, 01:45:28 pm
It depends on region you're getting info of. Because these numbers are different accross different regions. Do you really want avarage? Because retios of appearence also changes accross regions during the game. There are no particular ratios for ship types. Only for mission types. But each mission has pre-defined scenario with particular ships going one after another.
So it's the sequence of dynamic values in spatial and temporal terms, and "avaraging" of them is not very appropriate process.
Title: Re: Question on alien appearance ratios
Post by: SuperVGA on April 22, 2013, 03:22:18 pm
It depends on region you're getting info of. Because these numbers are different accross different regions. Do you really want avarage? Because retios of appearence also changes accross regions during the game. There are no particular ratios for ship types. Only for mission types. But each mission has pre-defined scenario with particular ships going one after another.
So it's the sequence of dynamic values in spatial and temporal terms, and "avaraging" of them is not very appropriate process.
Ah OK - so the missions dictate the ship types?
I would've wanted the average because it would state how many of a particular type there would likely be on the geoscape throughout a month.
Even if it requires many runs to find confidence in those stats, it would be fun to see.
But I understand how there is no way to determine regions/ships ahead of time, as the craft may enter the atmosphere anywhere, I suppose (?).
Title: Re: Question on alien appearance ratios
Post by: Volutar on April 22, 2013, 03:50:20 pm
SuperVGA, it is possible for 1st month, but it will be TOTALLY random after 4th. There's no point in getting stats per multiple regions and multiple games since: rates depends on xcom activity (each downed ufo causes mission postpone), random - which is 0.5..1.5 and randomization increased with each ship. So better forget it. Time periods are highly unpredictable.
Title: Re: Question on alien appearance ratios
Post by: SuperVGA on April 22, 2013, 05:07:58 pm
SuperVGA, it is possible for 1st month, but it will be TOTALLY random after 4th. There's no point in getting stats per multiple regions and multiple games since: rates depends on xcom activity (each downed ufo causes mission postpone), random - which is 0.5..1.5 and randomization increased with each ship. So better forget it. Time periods are highly unpredictable.
Alright, I just didn't realize that there was a progressively altering factor or that x-com activity had an impact. Now I get it.  ;)
With that, it still does makes sense to alter the units involved over time, as it to a higher degree than the craft affects the battlescape difficulty.
Title: Re: Question on alien appearance ratios
Post by: Gemeaux333 on October 26, 2018, 05:53:56 pm
I wondered if it is possible to modify the appearance ratios for aliens types and mission types for TFTD, as these ones are absurd and artificially increase the difficulty of the game ?
Title: Re: Question on alien appearance ratios
Post by: Meridian on October 26, 2018, 06:03:24 pm
I wondered if it is possible to modify the appearance ratios for aliens types and mission types for TFTD, as these ones are absurd and artificially increase the difficulty of the game ?

Yes, very easy.
Edit alienMissions.rul: https://github.com/SupSuper/OpenXcom/blob/master/bin/standard/xcom2/alienMissions.rul
Title: Re: Question on alien appearance ratios
Post by: Gemeaux333 on October 26, 2018, 07:21:30 pm
thanks, although I may nead a few explainations of whatever doesn't relate to race types...

For example : If I want to postpone Alien Infiltration and Base building missions to June or July ?
Title: Re: Question on alien appearance ratios
Post by: Meridian on October 26, 2018, 08:36:15 pm
You would need to change missionScripts.rul then.

That is a bit harder than just alien race ratios, but you can take inspiration from other bigger mods that did it already.
Title: Re: Question on alien appearance ratios
Post by: Gemeaux333 on October 26, 2018, 10:24:47 pm
I would have to type 2 new entries, "firstMonth: 6" for both types of missions, but dont know the type name of these missions

Update : have modified alienMissions.rul but have no effect : Gillmen in January when I removed them... or is this USO case independant of the modifications I made ?