Author Topic: Mission zones examples  (Read 13314 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Mission zones examples
« on: December 06, 2019, 07:27:16 pm »
A sample mod would be welcome. Thank you.

I'll put something together on Saturday or Sunday and upload it here.

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Mission zones examples
« Reply #1 on: December 07, 2019, 01:08:59 am »
@meridian

Do you just add them in like Mission sites?

Code: [Select]
    missionZones:
      -  #MZ 21 - Water_only_Base_TEST
        - [340.8, 40.8, 16.8, 16.8, -1]

I did one of the above for each region all with different values, i then:

Quote
  - id: P29 # NEW Water BASES BY REGION - USES POINTS
    groundTimer: 1000
    waypoints:
      - [7, 1, 100]
      - [7, 3, 50]
      # - [7, 0, 25]
      # - [7, 1, 16]
      # - [7, 0, 100]
      - [7, 3, 50]
      - [21, 1, 100]

Tried to do the above to get my UFOs to endup at the desired point to spawn the alien base but it doesnt look like its working.


Im happy to do the extra work to avoide base CLUMPING like i am currently getting so please let me know if im on the wrong track with this :) :P

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #2 on: December 07, 2019, 10:05:26 am »
@luke

1/ you cannot just add a new mission zone like that, you need to copy the old ones too.... in your example, you have deleted all mission zones and redefined mission zone 0

2/ defining texture -1 is not needed

3/ changing trajectories is not needed, they are used only for UFO waypoints, not for alien base spawning

4/ alien base spawning is done via spawnZone attribute under alienMissions.rul

For illustration, attached screenshot shows where aliens can build a base in north africa:
- blue borders is STR_NORTH_AFRICA region
- pink borders is mission zone 4 for that region
« Last Edit: December 07, 2019, 11:25:45 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #3 on: December 07, 2019, 11:19:46 am »
@apollyon

Here is a sample for North Africa, added mission zones 6, 7, 8 and 9.
(mission zones 0-5 were shortened just so that the example is not that long)

Mission zone 6 = desert only (1 area, pink color)
Mission zone 7 = jungle only (3 areas, orange color)
Mission zone 8 = grass only (1 area, white color)
Mission zone 9 = water only (2 areas, green color)
Blue color are entire region borders.

Code: [Select]
regions:
  - type: STR_NORTH_AFRICA
    missionZones:
      - # 0 = shortened to just one area
        - [348.5, 384.5, -34.5, -25]
      - # 1 = shortened to just one area
        - [354.25, 365.125, -34.5, -32.875]
      - # 2 = shortened to just one area
        - [348.625, 358.75, -27.125, -20.125]
      - # 3 = shortened to just one area
        - [3.125, 3.125, -6.5, -6.5, -1, STR_LAGOS]
      - # 4 = shortened to just one area
        - [5.625, 9, -6.125, -5]
      - # 5 = shortened to just one area
        - [0, 359.875, -90, -80]
      - # 6 = desert only
        - [348, 392, -26, -19]   # 392 (=360+32) ... means 32 degrees... value 392 is used instead of 32, because right value (392) must be higher than left value (348)
      - # 7 = jungle only
        - [6, 9, -6, -5]
        - [350, 356, -8, -6]
        - [10, 25, -3, -1]
      - # 8 = grass only
        - [348, 392, -14, -9]   # 392 (=360+32) ... means 32 degrees
      - # 9 = water only (just for illustration, would not work in vanilla, because there is no texture there)
        - [336, 368, -4, -1]   # 368 (=360+8) ... means 8 degrees
        - [336, 340, -34, -5]

And below is just a vanilla alien base mission, important attributes here are spawnZone and siteType.

Code: [Select]
alienMissions:
  - type: STR_ALIEN_BASE
    points: 50
    objective: 2
    siteType: STR_ALIEN_BASE_ASSAULT
    spawnZone: 4 #Mission zone for alien bases

If you change spawnZone from 4 to for example 6... the alien bases from this mission will be created only on the desert.
And of course, you can change the siteType to your new shiny alien deployments you have already created.

Code: [Select]
alienMissions:
  - type: STR_ALIEN_BASE_DESERT_ONLY
    points: 50
    objective: 2
    siteType: STR_ALIEN_BASE_ASSAULT_CUSTOM_DESERT
    spawnZone: 6    # desert mission zone
« Last Edit: December 12, 2019, 06:05:21 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #4 on: December 07, 2019, 11:24:55 am »
Post by Luke83, moved by Meridian

1/ you cannot just add a new mission zone like that, you need to copy the old ones too.... in your example, you have deleted all mission zones and redefined mission zone 0
Haha, yes, its the 21st MZ in my list, i displayed it like that for explanation purposes only . See it actually looks like this in Ruleset

Code: [Select]
missionZones:
      - []
      - []
      - []
      - []
      - []
      - []
      - []
      - []
      -   #mission zone 8 - Alien Citys - water
         - [6.38, 6.38, -1.79, -1.79, -1, Tenas]
         - [345.17, 345.17, 27.7, 27.7, -1, Aquirus]
         - [320.0, 320.0, 30.49, 30.49, -1, Njordore]
         - [346.82, 346.82, -0.49, -0.49, -1, Typhdor]
      - [] #mission zone 9 - Alien Citys - LAND
#MZ10 - water by sea (North Pacific,South Pacific,Indian,North Atlantic & South Atlantic)
      - - - 313.66509969238
          - 323.66509969238
          - 35.833719688838
          - 45.833719688838
        - - 325.585389973176
          - 335.585389973176
          - 11.365755428256
          - 21.365755428256
        - - 355.1597325403413
          - 5.159732540341281
          - 24.893022165611
          - 34.893022165611
        - - 350.664327216808
          - 0.6643272168079761
          - 8.409869312656
          - 18.409869312656
        - - 334.36848291900003
          - 344.368482919
          - 32.010747261205
          - 42.010747261205
      - [] #MZ 11 -
      -  #MZ 12 - NUKEZONE
        - [0.072, -0.26, 4.16, -15.0, -1, NUKE1]
        - [0.643, -0.039, 36.89, -2.27, -1, Nuke2]
        - [1.643, -0.025, 76.99, -14.8, -1, Nuke3]
        - [1.845, -0.004, 105.7, 2.32, -1, Nuke4]
      - [] #MZ 13 - XENO
      - [] #MZ 14 - Ocaen Sand
      - [] #MZ 15 - Grass
      - [] #MZ 16 - Desert Sand
      - [] #MZ 17 - Forrests
      - [] #MZ 18 - Mountain
      - [] #MZ 19 - Snow
      - [] #MZ 20 - IceBurgs     
      - - - 313.66509969238
          - 323.66509969238
          - 35.833719688838
          - 45.833719688838
        - - 325.585389973176
          - 335.585389973176
          - 11.365755428256
          - 21.365755428256
        - - 355.1597325403413
          - 5.159732540341281
          - 24.893022165611
          - 34.893022165611
        - - 350.664327216808
          - 0.6643272168079761
          - 8.409869312656
          - 18.409869312656
        - - 334.36848291900003
          - 344.368482919
          - 32.010747261205
          - 42.010747261205
      -  #MZ 21 - Water_only_Base_TEST
        - [340.8, 40.8, 16.8, 16.8, -1]



4/ alien base spawning is done via spawnZone attribute under alienMissions.rul

For illustration, attached screenshot shows where aliens can build a base in north africa:
- blue borders is STR_NORTH_AFRICA region
- pink borders is mission zone 4 for that region

Right so its because we have these little MZ boxes that we get  CLUSTERING of Bases on globe, so we just need to define Extra Locations on the globe ( i assume i only need the 4 Coordinate points to make up a BOX to add it to the MZ list? I ask as i see some have 6 or more, i am wondering how it knows which 4 make up a set???

Code: [Select]
      -
        - [0, 359.875, -90, -80]
        - [0, 359.875, 80, 90]
        - [180, 200, 0, 10]
        - [282.25, 322.875, 9.375, 38.375]
        - [53.125, 89.125, 4.5, 41.25]
        - [354.5, 393.375, -56.625, -46.375]
        - [238.625, 258.625, -53.375, -33.375]
        - [7.5, 38.625, 4.125, 18.625]
        - [91.875, 124.25, -30.75, -17.5]
        - [62.125, 101.375, -66.625, -57.125]


Apollyon, sorry for taking over your Diary :)
« Last Edit: December 07, 2019, 11:41:14 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #5 on: December 07, 2019, 11:31:43 am »
Right so its because we have these little MZ boxes that we get  CLUSTERING of Bases on globe, so we just need to define Extra Locations on the globe

Yes.

( i assume i only need the 4 Coordinate points to make up a BOX to add it to the MZ list? I ask as i see some have 6 or more, i am wondering how it knows which 4 make up a set???

Yes, first 4 is enough to define a box.

5th number is a texture ID override.
6th value is a city name.
Both are optional.
« Last Edit: December 07, 2019, 11:33:16 am by Meridian »

wcho035

  • Guest
Re: Mission zones examples
« Reply #6 on: December 07, 2019, 11:46:07 am »
Meridian, thank you for the tutorial. Really appreciate this.

This answer one basic question I have, so the coordinates are not a fix location but inside a square spawning area.

That means I have to generate hundreds of these coordinates in the globe. Like Luke had encountered, in the past, I have clustering issue with this method.

If I am to say this is not daunting, I will be lying. Unfortunately, Luke will be using two different globe for his mods. One will be his mod and the other for general release.

The new Spawnzone will be 5 or 6 in my mod, if it is land or sea. If the bases spawning using the same coordinates. I wonder what the result would be. Anyway, I need testing to find answer for this.


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #7 on: December 07, 2019, 11:57:06 am »
This answer one basic question I have, so the coordinates are not a fix location but inside a square spawning area.

If the square is small enough, they become fixed coordinates.

For example [0, 100, 40, 80] is a big square.
For example [20, 20, 60, 60] is just a fixed point.

That means I have to generate hundreds of these coordinates in the globe. Like Luke had encountered, in the past, I have clustering issue with this method.

If you replace squares with points, it won't (directly) help with clustering.... actually you can get even worse clustering, because RNG could easily pick the exactly same point multiple times.

To avoid clustering, best way is to make more/bigger squares. RNG will have more options to choose from.
(in my opinion, up to 10 large squares per region should be more than enough)

The new Spawnzone will be 5 or 6 in my mod, if it is land or sea. If the bases spawning using the same coordinates. I wonder what the result would be. Anyway, I need testing to find answer for this.

Spawnzone 5 is already used by vanilla, don't use that please.

You can define custom zones from 6 to infinity.
« Last Edit: December 07, 2019, 12:09:36 pm by Meridian »

wcho035

  • Guest
Re: Mission zones examples
« Reply #8 on: December 07, 2019, 12:11:39 pm »
I think I have enough information to give this a shot. I will let you know how it goes. Thanks Meridian.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #9 on: December 07, 2019, 12:14:51 pm »
Real world coordinates.

Longitude goes from 0 (prime meridian) to 359.
Latitude goes from -90 at north pole, through 0 at equator, to 90 at south pole.

You can also easily find out a coordinate in debug mode, by just clicking on the globe, see attached (I clicked near London, longitude 0, latitude -51).

wcho035

  • Guest
Re: Mission zones examples
« Reply #10 on: December 07, 2019, 08:44:05 pm »
I have given this a good honest try tonight Meridian, however, I have encounter some anomalies.

There are bases in game that's spawning outside of the missionzone. I just can't figure out why.

Please check screenshot.

Wierdspawn is the in game screenshot. Circle in red.

testland is my land missionzone area.

testsea is my sea missionzone area.

Those two bases spawn in a place neither my land or sea missionzone yet covered. I tested the battlescape mission for the base spawn near the mexico, highlight in red 1, it is a farm map instead of an underwater map.

So, I am at a loss as to why. I had used regionweight instead of missionzone 6 and 7 as suggested because I want to isolated this base generation from the other type and their respective missionzones completely.

Below are snippet from my Region.rul

  - type: SEASPAWNS
    missionZones:
      -
        - [184.75739359788, 274.613881262233, -7.2152083519448, 58.483014136636]
        - [53.92031369938098, 99.983170864964, 1.9373401729753, 58.952620625928]
        - [326.422418969555, 7.409762904452691, 3.645104510856, 58.523326761397]
        - [309.860217900914, 343.902122677988, -56.993921982435, -41.117011925817]
        - [294.00811363881, 339.798136121454, -39.544049296503, -12.991163898289]
        - [130.42586604067, 183.96842691473, -30.566285955406, -1.332762133742]      
        - [8.972336515979805, 52.313259332168, 35.667417401477, 58.029782041193]   
        - [148.52943671583, 230.83540802436, -49.187071196022, -31.344774958656]   
        - [184.24236865251, 204.47029137963, -30.643228609459, -7.9957972802132]
        - [211.30376932388, 242.39275040942, -30.726901173324, -7.2815245860444]   
        - [100.72180705587999, 136.38307911105, 37.7399259228, 60.102290562516]      
  - type: LANDSPAWNS
    missionZones:
      -
        - [285.363853093182, 306.499913750242, -5.255325532646, 13.371200328457]
        - [306.82334287398, 318.480992042274, 3.2779793932029, 22.210866577903]
        - [290.058569789841, 306.107341295131, 13.892174541526, 33.240275958795]
        - [287.738782890411, 292.679810358713, 33.789656560634, 47.52889712754]
        - [234.32610744586, 265.111885891314, -68.294120411242, -49.495907312637]
        - [239.55221769901, 267.05719683366704, -49.222380380641, -36.369145896139]
        - [251.55766146553, 262.939035772446, -36.256529164139, -24.506788375383]
        - [267.534358877109, 277.534358877109, -40.548190798446, -30.548190798446]
        - [210.22775266855, 233.86498297138002, -69.007091710542, -59.886913020402]
        - [284.354439767635, 294.354439767635, -55.612284068763, -45.612284068763]   
        - [55.304042959321976, 117.98512983529997, -67.895802534357, -28.059855742259]
        - [34.69175681493198, 54.72974344516501, -63.226261480028, -46.964031288692]
        - [24.213945640515988, 34.21394564051599, -56.697701607696, -46.697701607696]
        - [351.4087936583636, 13.642775788655001, -31.762792829359, -7.0192759031104]
        - [14.15145274672301, 32.777978607828004, -28.93956618391, 19.173993529693]
        - [17.288371241671996, 30.111597887123025, 19.839516412509, 30.623746036245]
        - [32.737211355493, 38.558060133654976, -14.703892584475, 11.242868656747]
        - [37.23295395496302, 47.23295395496302, -40.6307932868, -25.9017537463]
        - [42.19375970574902, 50.38571403321703, -25.468837562645, -15.210545323712]
        - [14.424160054201025, 23.80724448998501, -53.164847180009, -45.940967218983]
        - [4.784854363316413, 13.319679898302013, -53.164847180009, -45.786738327929]
        - [18.916350222319977, 27.074517813104023, -47.110312596074, -42.083260100958]
        - [118.28113442896, 134.54986126172003, -67.911553442704, -45.044166785995]
        - [135.59150224486, 154.65379223073, -69.894125726583, -59.894125726583   ]
        - [94.84252356380301, 104.8425235638, -27.34215674843, -17.34215674843]
        - [73.69718026342701, 83.69718026342701, -27.342156748429, -17.342156748429]
        - [115.76995101631002, 142.48655590367002, 20.688653122227, 31.238541440889]
        - [139.52512638254, 150.7348806836, 22.448295741946, 36.07755864512]    


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #11 on: December 07, 2019, 09:20:00 pm »
There are bases in game that's spawning outside of the missionzone. I just can't figure out why.

Please check screenshot.

Don't know, I would need to be able to try it to say more.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #12 on: December 08, 2019, 04:28:06 pm »
There are bases in game that's spawning outside of the missionzone. I just can't figure out why.
Please check screenshot.

I have removed all mission scripts from your mod except the one you wanted to test: missionScriptsBasegenMarsec.rul

I tried creating a new game 13x times and every time all alien bases were inside the two regions: SEASPAWNS and LANDSPAWNS

As far as I can say, everything works perfectly.

The extra bases spawned outside of those regions must come from different mission script files, you should check those for any errors (I would recommend checking each separately, not all together):

Code: [Select]
missionScriptsAPOC.rul
missionScriptsBasegenBandit.rul
missionScriptsBasegenChurch.rul
missionScriptsBasegenCities.rul
missionScriptsBasegenCoporate.rul
missionScriptsBasegenMerc.rul
missionScriptsBasegenNazi.rul
missionScriptsBasegenWildWest.rul
missionScriptsHumans.rul
missionScriptsTFTD.rul
missionScriptsUFO.rul
RandomMissiongenerator.rul

EDIT: issue was with incorrect MZ areas (crossing prime meridian)
« Last Edit: December 08, 2019, 06:28:03 pm by Meridian »

wcho035

  • Guest
Re: Mission zones examples
« Reply #13 on: December 08, 2019, 04:47:12 pm »
Most of the code are copies of each other. I highly doubt they are causing the problem.  I can test it tomorrow. Again.. I suppose.

Also the terrain spawn incorrectly for sea? Any reasonable explanation for this one?
« Last Edit: December 08, 2019, 04:49:51 pm by Precentor Apollyon »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Mission zones examples
« Reply #14 on: December 08, 2019, 04:55:30 pm »
Also the terrain spawn incorrectly for sea? Any reasonable explanation for this one?

I didn't check anything else, let's do one issue at a time to not lose focus.
« Last Edit: December 08, 2019, 06:25:57 pm by Meridian »