OpenXcom Forum

Modding => Work In Progress => Topic started by: bladum on November 25, 2014, 08:44:59 pm

Title: new approach to item levels
Post by: bladum on November 25, 2014, 08:44:59 pm
alienItemLevels:
  - [0, 0, 0, 0, 1, 1, 1, 1, 2, 3] 
  - [0, 0, 0, 1, 1, 1, 1, 2, 2, 3] 
  - [0, 0, 0, 1, 1, 1, 2, 2, 3, 3]   
  - [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
  - [0, 0, 1, 1, 2, 2, 3, 3, 4, 5]
  - [0, 0, 1, 2, 2, 3, 3, 4, 4, 5]   
  - [0, 1, 2, 2, 3, 3, 4, 4, 5, 5]
  - [0, 1, 2, 2, 3, 4, 4, 5, 5, 6]
  - [0, 1, 2, 3, 4, 4, 5, 5, 6, 7] 
  - [0, 1, 2, 3, 4, 4, 5, 6, 6, 7]   
  - [0, 1, 2, 3, 4, 5, 6, 6, 7, 7]

0 and 1 is the same level but 2 variants
2 and 3 is the same level but 2 variants
4 and 5 is the same level but 2 variants
6 and 7 is the same level but 2 variants

For example:

        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_PLASMA_PISTOL_CLIP
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_ALIEN_GRENADE   
          - 
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_PLASMA_RIFLE_CLIP
          - 
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_ALIEN_GRENADE 
          - 
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP   
            - STR_HEAVY_PLASMA_CLIP
          - 
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP   
            - STR_ALIEN_GRENADE   
          - 
            - STR_PLASMA_MINIGUN
            - STR_PLASMA_MINIGUN_CLIP
            - STR_PLASMA_MINIGUN_CLIP     
          - 
            - STR_PLASMA_SNIPER_RIFLE
            - STR_PLASMA_SNIPER_RIFLE_CLIP
            - STR_PLASMA_SNIPER_RIFLE_CLIP 
Title: Re: new approach to item levels
Post by: Warboy1982 on November 25, 2014, 11:40:29 pm
what about it?
are you asking if it's possible?
it is, and it won't cause any issues, as long as you have 8 sets defined for each deployment
Title: Re: new approach to item levels
Post by: bladum on November 25, 2014, 11:52:39 pm
sorry, i did not post full question :)

Is it possible to make this array dynamic in size not just const size of 10 ?
Title: Re: new approach to item levels
Post by: volutar on November 27, 2014, 07:44:08 am
Quote
Is it possible to make this array dynamic in size not just const size of 10 ?

You can freely add more MONTHS to that structure (each row means month).

But as for number of values in each month - it's limited with 10.
Code: [Select]
int itemLevel = _game->getRuleset()->getAlienItemLevels().at(month).at(RNG::generate(0,9));Each value represents 10% of probability chart. There wasn't need to make it other way.

Though we could make that:
Code: [Select]
alienItemLevels:
  - [0, 0, 0, 0, 0, 0, 0, 1, 1, 2]
  - [0, 0, 0, 0, 0, 1, 1, 1, 2, 2]
  - [0, 0, 0, 1, 1, 1, 1, 2, 2, 2]
  - [0, 0, 1, 1, 1, 1, 2, 2, 2, 2]
  - [0, 0, 1, 1, 1, 2, 2, 2, 2, 2]
  - [0, 1, 1, 1, 2, 2, 2, 2, 2, 2]
  - [1, 1, 1, 2, 2, 2, 2, 2, 2, 2]
  - [1, 1, 1, 2, 2, 2, 2, 2, 2, 2]
  - [1, 1, 2, 2, 2, 2, 2, 2, 2, 2]
  - [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
looks slightly shorter and more flexible:
Code: [Select]
alienItemLevels:
  - [70, 20, 10]
  - [50, 30, 20]
  - [30, 40, 30]
  - [20, 40, 40]
  - [20, 30, 50]
  - [10, 30, 60]
  - [0, 30, 70]
  - [0, 30, 70]
  - [0, 20, 80]
  - [0, 0, 100]
Working the similar way as for race probability.

And I don't think it would be too hard to add fallback logic, if number of sets is less than number of levels (fallback to maximum available set).

But there was no point of doing that. Making game as moddable as hell is the 51th priority task.
Title: Re: new approach to item levels
Post by: bladum on November 27, 2014, 11:40:17 am
Thanks for replay.

I know the source code limitation. But that was not the point to make mods. You can make game more varied even in vanilla without need to add new weapons. Just create a 5 versions of tier 1 weapons for aliens. Its impossible to make this in current implementation.

plasma_pistol
plasma_pistol + clip
plasma_pistol + clip + clip
plasma_pistol + grenade + grenade
plasma_pistol + grenade + clip

PS: can we move this to suggestions :)

Tom
Title: Re: new approach to item levels
Post by: volutar on November 27, 2014, 12:09:11 pm
Oh you totally can make 3 versions for each level. so there will be need of 9 sets.
and array will look like
0,1,2,0,1,2,0,1,2,0
0,1,2,0,1,2,0,3,4,5
0,1,2,0,3,4,5,3,4,5
1,2,3,4,5,6,7,8,6,7
3,4,5,6,7,8,6,7,8,6
6,7,8,6,7,8,6,7,8,6

0,1,2 - tier 0
3,4,5 - tier 1
5,6,7 - tier 2
Title: Re: new approach to item levels
Post by: bladum on November 27, 2014, 12:17:38 pm
great, but you loose low level tiers at the end and this is because there are just 10 items in the array.

Even with 3 tiers and 3 variations for each there is no room left to make aliens progression during the game.
Title: Re: new approach to item levels
Post by: robin on November 27, 2014, 12:18:54 pm
You can freely add more MONTHS to that structure (each row means month).
Is it possible to add more months to "alienMissions" as well?
(I mean this part:)
Code: [Select]
    raceWeights:
      0:
          STR_
      1:
          STR_
      3:
          STR_
      5:
          STR_
      7:
          STR_
Title: Re: new approach to item levels
Post by: Arthanor on November 27, 2014, 12:45:18 pm
great, but you loose low level tiers at the end and this is because there are just 10 items in the array.

Even with 3 tiers and 3 variations for each there is no room left to make aliens progression during the game.

You can comfortable fit 3 variations of 3 levels in 10 subsets. And you still have one free. The last row of the example is to show how the "late game, all tier 3" itemLevels would look like. If you don't want them, you don't have to use them.

10% chance of occurring is already pretty small. If something has less than 10% chance of happening (say 5% if you could use 20 numbers), is it even worth using it? It would be easy to only keep one of the variants of a tier at the end (say pistol + 2x grenades), so you can have a chance of a weak alien but it's small. Smaller, actually, than having all 3 variants in a 20 numbers system (= 15% chance of a weak alien).

Btw, are items levels assigned on a per alien basis? Or per crew? a 10% chance of having a pistol alien in the end game is fine. a 10% chance of all aliens in a given crew having pistols? That'd be weird (and unfair to the aliens..)
Title: Re: new approach to item levels
Post by: Falko on November 27, 2014, 01:45:37 pm
great, but you loose low level tiers at the end and this is because there are just 10 items in the array.
- [0, 3, ....]
- [1, 3, ....]
- [2, 3, ....]
- [0, 4, ....]
- [1, 4, ....]
- [2, 4, ....]
- [0, 5, ....]
- [1, 5, ....]
- [2, 5, ....]
.....
copy paste some variation of this 500 times and you have lowlevel variation for all the game years
Title: Re: new approach to item levels
Post by: bladum on November 27, 2014, 01:47:38 pm
that would be great idea, to actually split variety over dozen of months.
Title: Re: new approach to item levels
Post by: Solarius Scorch on November 27, 2014, 07:47:42 pm
Is it possible to add more months to "alienMissions" as well?
(I mean this part:)
Code: [Select]
    raceWeights:
      0:
          STR_
      1:
          STR_
      3:
          STR_
      5:
          STR_
      7:
          STR_

Yeah, I did this in the FMP and it works just fine. Or at least it doesn't crash the game, I haven't done enough testing... :)

Btw, are items levels assigned on a per alien basis? Or per crew? a 10% chance of having a pistol alien in the end game is fine. a 10% chance of all aliens in a given crew having pistols? That'd be weird (and unfair to the aliens..)

Alien levels are per rank. In a given mission you define equipment options for all Soldiers, then for all Navigators, and so on. So each member of a rank has the same range of gear to choose from, but of course two Soldiers can have different gear from this range.
Title: Re: new approach to item levels
Post by: Arthanor on November 28, 2014, 01:00:38 am
Alien levels are per rank. In a given mission you define equipment options for all Soldiers, then for all Navigators, and so on. So each member of a rank has the same range of gear to choose from, but of course two Soldiers can have different gear from this range.

I know the item selection is per rank, but what I was wondering is who gets the "item level". I guess what you're saying is that each alien rolls individually for his own item level? So poor alien soldier A can get stuck with a plasma pistol by getting a 1, while alien soldier B got his heavy plasma by rolling a 10.

That's good. I was afraid item levels were on a mission/rank/crew basis, which means a bunch of aliens could be stuck with the same level of gear instead of it being random.
Title: Re: new approach to item levels
Post by: Solarius Scorch on November 29, 2014, 02:36:28 pm
I know the item selection is per rank, but what I was wondering is who gets the "item level". I guess what you're saying is that each alien rolls individually for his own item level? So poor alien soldier A can get stuck with a plasma pistol by getting a 1, while alien soldier B got his heavy plasma by rolling a 10.

Yes, precisely. If you make the table vary a lot for a given mission/rank/month, that is.

That's good. I was afraid item levels were on a mission/rank/crew basis, which means a bunch of aliens could be stuck with the same level of gear instead of it being random.

No, while each mission has its own set for each rank, the same rank in the same mission does not have to have the same weapon.
Title: Re: new approach to item levels
Post by: bladum on November 29, 2014, 03:26:16 pm
Btw

Wouldn't be nice to have option to set default items per rank ?

Imagine 10 ufos with every rank defined like below... even in vanilla this is really big chunk of text

Code: [Select]
 
- type: STR_UFO_SCOUT # max 1-2 alien
    width: 40
    length: 40
    height: 4
    data:
      - alienRank: 4
        lowQty: 1
        highQty: 2
        dQty: 0
        percentageOutsideUfo: 30
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_PLASMA_PISTOL_CLIP 
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_ALIEN_GRENADE     
            - STR_MIND_PROBE
          - 
            - STR_PLASMA_SHOTGUN   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP   
          - 
            - STR_PLASMA_SHOTGUN
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_GRENADE         
            - STR_MIND_PROBE     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_GRENADE   
            - STR_MIND_PROBE     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_MINE     
            - STR_MIND_PROBE   


I can imagine that new feature could be added to have

Code: [Select]
- type: STR_UFO_SCOUT # max 1-2 alien
    width: 40
    length: 40
    height: 4
    data:
      - alienRank: 4
        lowQty: 1
        highQty: 2
        dQty: 0
        percentageOutsideUfo: 30
        itemDefaultSets: STR_NAVIGATOR_ITEM_SET
        #   itemSets: if not defined itemDefaultSet please use this as normal


And then

Code: [Select]
itemDefaultSets:
       - STR_NAVIGATOR_ITEM_SET:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_PLASMA_PISTOL_CLIP 
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_ALIEN_GRENADE     
            - STR_MIND_PROBE
          - 
            - STR_PLASMA_SHOTGUN   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP   
          - 
            - STR_PLASMA_SHOTGUN
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_GRENADE         
            - STR_MIND_PROBE     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_GRENADE   
            - STR_MIND_PROBE     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP     
          - 
            - STR_PLASMA_SHOTGUN         
            - STR_PLASMA_SHOTGUN_CLIP   
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_PLASMA_SHOTGUN_CLIP
            - STR_ALIEN_MINE     
            - STR_MIND_PROBE   
Title: Re: new approach to item levels
Post by: Yankes on November 29, 2014, 03:44:22 pm
Yaml have option to "copy" values around.

e.q.
Code: [Select]
valueA: &LabelName
  - A
  - B
  - C
valueB: *LabelName #valieA == valueB
Title: Re: new approach to item levels
Post by: bladum on November 29, 2014, 03:54:16 pm
Thanks ! have no idea about this ;)
Title: Re: new approach to item levels
Post by: robin on January 03, 2015, 04:38:20 pm
Yaml have option to "copy" values around.

e.q.
Code: [Select]
valueA: &LabelName
  - A
  - B
  - C
valueB: *LabelName #valieA == valueB

This is the best thing!