aliens

Author Topic: XCF Alternate Map Scripts (WIP)  (Read 2085 times)

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
XCF Alternate Map Scripts (WIP)
« on: July 15, 2024, 06:25:48 pm »
As it appears there's some demand for this I'm releasing my WIP mod.

The scripts provided will restrict the spawn location of X-Com LZ to the corners of the map in a 20x20 tile area at each corner, the UFO / PoI will spawn somewhere else on the map away from this corner, at the very least with a 10x10 tile zone between both of them if possible. They also contain failsafes in case, somehow, any of the spawn locations are invalid for any reason. The failsafes will use the entire map as per original scripts and they are there to minimize possible map generation crashes from mistakes made in my scripts.

This mod does NOT change how units are spawned, even if you are in a corner, enemies can still spawn nearby, you just won't be completely surrounded, possibly just partially surrounded.

As stated in the title and at the start of this post, this is a WIP and only a few scripts have been updated, namely: JUNGLE, POLAR, MOUNTAIN and FOREST. Terrains and deployments that use those scripts in XCF have been updated to use the new scripts instead. There's many more scripts to go, too many to list. To get an idea, the changes made so far cover little more than 2,5% of the entirety of XCF's scripts.

Feedback will be appreciated.

Edit: 20-07-2024. Updated the mod to v0.2, estimated progress: 9% completed.
Edit: 16-08-2024. Updated the mod to v0.3, estimated progress: 28% completed.
Edit: 02-09-2024. Updated the mod to v0.4. Progress estimation changed:
  • Globe terrain mapScripts: done.
  • Non-Globe terrain mapScripts: ~6 to go.
  • Deployment mapScripts: ~151 to go.
« Last Edit: September 02, 2024, 07:30:11 pm by CrazedHarpooner »

Offline Juku121

  • Commander
  • *****
  • Posts: 1798
  • We're all mad here.
    • View Profile
Re: XCF Alternate Map Scripts (WIP)
« Reply #1 on: July 16, 2024, 12:07:10 am »
Complicated. Makes me really wish for a Xenonauts-style placement algorithm.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: XCF Alternate Map Scripts (WIP)
« Reply #2 on: July 20, 2024, 10:53:22 pm »
Mod has been updated with some more scripts.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • ***
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCF Alternate Map Scripts (WIP)
« Reply #3 on: July 23, 2024, 10:58:11 pm »
Would you perhaps have some idea on how to simplify the cave script? Right now it runs on 4 scripts (CAVE_A to CAVE_D), each of them rather big. I think there should be a way to make it saner, but the fact that all blocks are 20x20 makes it hard.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: XCF Alternate Map Scripts (WIP)
« Reply #4 on: July 24, 2024, 12:03:27 am »
Would you perhaps have some idea on how to simplify the cave script? Right now it runs on 4 scripts (CAVE_A to CAVE_D), each of them rather big. I think there should be a way to make it saner, but the fact that all blocks are 20x20 makes it hard.

This does the trick, all 4 map scritps covered by 1. Most of the work was already there, it just needed to combine the rects into a single command:
Code: [Select]
  - type: CAVE_ABCD
    commands:
    - type: addBlock
      size: 2
      groups: 6
      rects:
        - [0, 0, 2, 2]
        - [4, 0, 2, 2]
        - [0, 4, 2, 2]
        - [4, 4, 2, 2]
    - type: fillArea
      size: 2
      rects:
        - [0, 0, 2, 2]
        - [2, 0, 2, 2]
        - [4, 0, 2, 2]
        - [0, 2, 2, 2]
        - [0, 4, 2, 2]
        - [2, 2, 2, 2]
        - [2, 4, 2, 2]
        - [4, 2, 2, 2]
        - [4, 4, 2, 2]

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • ***
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCF Alternate Map Scripts (WIP)
« Reply #5 on: July 24, 2024, 12:30:04 am »
Splendid. I have been hoping for something like that. Thanks!

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: XCF Alternate Map Scripts (WIP)
« Reply #6 on: August 16, 2024, 06:40:50 pm »
Updated the mod with more scripts and a couple of changes to some blocks to accomodate for some of the scripts.

Tried an extensive version of the scripts that unified all 4 corners and covers all sorts of rectangular maps greater than 50x50 up to 100x100. The SE spawn is particulary problematic as the number of conditional checks grows exponentially if I want to try and cover all sort of map sizes. While this is great for somewhat future-proofing this submod if existing deployments change their map size, this is unlikely and mostly pointless effort on my part besides providing proof of concept.

To expedite this sub mod's completion I've decided to change my approach in future versions past v0.3:
- I will be only performing checks on maps that I know will require them, mostly UFO landings/crashes, but others too.
- The checks will be made only for sizes the corresponding deployments use if there's at least 2 different map sizes defined for the same script.
- I will be shifting the 'corner' spawn deployment to a 'map border' deployment method. Without going into too much detail, this will greatly reduce the checks needed, in particular it would remove almost all the work that is currently needed for SE spawns. In exchange, the scripts will guarantee that at least one side of the 'craft' area is touching a border. The previous method could result in very small craft (10x10) spawning near a corner, but not actually touching a border. Larger craft always touched at least 1 side.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: XCF Alternate Map Scripts (WIP)
« Reply #7 on: September 02, 2024, 07:40:23 pm »
New update (v0.4) with new and modified scripts.

Different approach to unevenly shaped maps. Some terrains have been grouped to use the same script.

Made the necessary changes to allow maps that use STORMMOUNTAIN terrains to spawn craft instead of an entry mapblock.

VAMPIRE_CASTLE is now a little less static. While the back interior already had some randomness, the entrance and x-com spawn point didn't. Now they do... to some extent.