Modding Help Dungeons and why the cripes won't you spawn more pieces

Discussion in 'Starbound Modding' started by G.Xyon, Oct 11, 2015.

  1. G.Xyon

    G.Xyon Space Kumquat

    Hey guys, hope y'all been doing fine.

    I've stopped being lazy and now I'm attempting to spawn dungeons the "normal" way, having them generate pieces and such. So far, it's been fairly "meh" as either certain pieces won't spawn and/or the ending pieces simply never appear. From what I've seen, the generation never meets the max capacity, and it's starting to bother me.

    So, I ask the Dungeon Masters of SB: is there any possible way of making a part have a 100% chance of spawning? I've attempted using both "maxSpawnCount" and the "chance" parameter set to 1, but it doesn't really seem to do much.

    Here's what I got so far:


    Code:
    {
      "metadata": {
      "name": "gyrvillage",
      "species": "gyrusen",
      "rules": [],
      "maxRadius": 100000,
      "maxParts": 30,
      "anchor": [ "plaza" ]
      },
      "tiles": [
    (All the tiles in the world)
    ],
    "parts": [
     
      {
        "name": "arcade",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "arcade" ] ]
        ],
      "def": [ "image", [ "arcade.png", "arcadeobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "bridge",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "bridge" ] ]
        ],
      "def": [ "image", [ "bridge.png", "bridgeobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "farm",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "farm" ] ]
        ],
      "def": [ "image", [ "farm.png", "farmobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "graveyard",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "graveyard" ] ]
        ],
      "def": [ "image", [ "graveyard.png", "graveyardobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "gsfoffice",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "gsfoffice" ] ]
        ],
      "def": [ "image", [ "gsfoffice.png", "gsfofficeobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "hospital",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "hospital" ] ]
        ],
      "def": [ "image", [ "hospital.png", "hospitalobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "plaza",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "plaza" ] ]
        ],
      "def": [ "image", [ "plaza.png", "plazaobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "pool",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "pool" ] ]
        ],
      "def": [ "image", [ "pool.png", "poolobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "shop1",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "shop1" ] ]
        ],
      "def": [ "image", [ "shop1.png", "shop1objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "shop2",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "shop2" ] ]
        ],
      "def": [ "image", [ "shop2.png", "shop2objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "skytower",
        "rules": [
         [ "maxSpawnCount", [1] ],
         [ "doNotConnectToPart", [ "skytower" ] ]
        ],
      "def": [ "image", [ "skytower.png", "skytowerobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "towerentranceleft",
        "rules": [
         [ "ignorePartMaximumRule" ]
        ],
      "def": [ "image", [ "towerentranceleft.png", "towerentranceleftobjects.png" ] ],
        "chance" : 0
      },
       {
        "name": "towerentranceright",
        "rules": [
         [ "ignorePartMaximumRule" ]
        ],
      "def": [ "image", [ "towerentranceright.png", "towerentrancerightobjects.png" ] ],
        "chance" : 0
      },
       {
        "name": "gyrhouseSmall",
        "rules": [
         [ "maxSpawnCount", [2] ],
         [ "doNotConnectToPart", [ "arcade" ] ]
        ],
      "def": [ "image", [ "gyrhouseSmall.png", "gyrhouseSmallobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "gyrhouseMid",
        "rules": [
         [ "maxSpawnCount", [2] ],
         [ "doNotConnectToPart", [ "arcade" ] ]
        ],
      "def": [ "image", [ "gyrhouseMid.png", "gyrhouseMidobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "gyrhouseLarge",
        "rules": [
         [ "maxSpawnCount", [2] ],
         [ "doNotConnectToPart", [ "arcade" ] ]
        ],
      "def": [ "image", [ "gyrhouseLarge.png", "gyrhouseLargeobjects.png" ] ],
        "chance" : 1
      },
       {
        "name": "lamp1",
        "rules": [
         [ "maxSpawnCount", [3] ],
         [ "doNotConnectToPart", [ "lamp1", "lamp2", "lamp3", "lamp4", "lamp5" ] ]
        ],
      "def": [ "image", [ "lamp1.png", "lamp1objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "lamp2",
        "rules": [
         [ "maxSpawnCount", [3] ],
         [ "doNotConnectToPart", [ "lamp1", "lamp2", "lamp3", "lamp4", "lamp5" ] ]
        ],
      "def": [ "image", [ "lamp2.png", "lamp2objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "lamp3",
        "rules": [
         [ "maxSpawnCount", [3] ],
         [ "doNotConnectToPart", [ "lamp1", "lamp2", "lamp3", "lamp4", "lamp5" ] ]
        ],
      "def": [ "image", [ "lamp3.png", "lamp3objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "lamp4",
        "rules": [
         [ "maxSpawnCount", [3] ],
         [ "doNotConnectToPart", [ "lamp1", "lamp2", "lamp3", "lamp4", "lamp5" ] ]
        ],
      "def": [ "image", [ "lamp4.png", "lamp4objects.png" ] ],
        "chance" : 1
      },
       {
        "name": "lamp5",
        "rules": [
         [ "maxSpawnCount", [3] ],
         [ "doNotConnectToPart", [ "lamp1", "lamp2", "lamp3", "lamp4", "lamp5" ] ]
        ],
      "def": [ "image", [ "lamp5.png", "lamp5objects.png" ] ],
        "chance" : 1
      }
      ]
    }
    
     
  2. lazarus78

    lazarus78 The Waste of Time

    Best Answer
    Likely they can never meet your requirements. Your "mustContainSolidBackground" and "mustContainAirBackground" are litereally right next to one another. That is an incredibly small window for them to qualify. Remember those tests are applied BEFORE the dungeon section is placed so its testing the generated landscape to see if it can place that section. Im guessing it rarely meets the requirement.

    Im betting if you remove those 2 points, it will work out better because it will generate the dungeon section regardless of the landscape, which is another point of issue. The pink, based on vanilla dungeons, means "nothing to generate here, use existing tiles", so the tower could generate in a hill. You need something to make the space around it open air to prevent that. Compare yours with other dungeon sections.
     
    The | Suit likes this.
  3. G.Xyon

    G.Xyon Space Kumquat

    Update: Through experimentation I've found that the placement of both "mustContainSolidBackground" and "mustContainAirBackground" brushes plays a grand part of whether a piece is spawnable or not. What triggers this, I'm not all too sure, but so far placing it adjacent to connectors makes it behave rather erratic, and placing it on the lowest point (relative to the ground) of the map seems to work out fairly well (as in, the pieces generate without much issue). This might interfere if you have both included a "maxSpawnCount" and a "chance" with a parameter of 1.

    I've given up on endpieces because I simply don't know how they're supposed to work, so I've resorted on using connectors specifically for these endpieces. Still haven't made them spawn yet.

    I'll keep updating if I find more info.
     
  4. lazarus78

    lazarus78 The Waste of Time

    Sounds like they are not triggering because they never meet the requirements you have set. What do the end caps look like?
     
  5. G.Xyon

    G.Xyon Space Kumquat

    [​IMG]

    Both of them are like this, the other one is just flipped. Do they need a specific form of mapping? I should note that I got it to spawn... once. And it was only one, so I don't know what's up.
     
  6. lazarus78

    lazarus78 The Waste of Time

    Best Answer
    Likely they can never meet your requirements. Your "mustContainSolidBackground" and "mustContainAirBackground" are litereally right next to one another. That is an incredibly small window for them to qualify. Remember those tests are applied BEFORE the dungeon section is placed so its testing the generated landscape to see if it can place that section. Im guessing it rarely meets the requirement.

    Im betting if you remove those 2 points, it will work out better because it will generate the dungeon section regardless of the landscape, which is another point of issue. The pink, based on vanilla dungeons, means "nothing to generate here, use existing tiles", so the tower could generate in a hill. You need something to make the space around it open air to prevent that. Compare yours with other dungeon sections.
     
    The | Suit likes this.
  7. G.Xyon

    G.Xyon Space Kumquat

    Now that you mention it, it explains why haven't been seeing the solid/air background brush too often in the vanilla files. And yeah, I should put some empty space around there as well.

    It's a little late, so I'll update this post in the morning/afternoon and see what worked. Thanks for the help!
     
  8. lazarus78

    lazarus78 The Waste of Time

    If you notice on existing dungeons, only the initial anchor section uses the "mustContain" checks. The end sections of those surface dungeons (Towns) typically have large portions dedicated to blending into the existing terrain.
     
    G.Xyon likes this.
  9. G.Xyon

    G.Xyon Space Kumquat

    Extremely useful observation!

    As well, adding too much Empty Space can also make parts not spawn, for some given reason. Playing with these values and how they're applied to the map can yield some pretty interesting results.

    Thanks for all of your help mate, both removing the "mustContain" checks on the non-anchor pieces and messing around with empty space in the maps helped wonders, things are spawning now!

    I'll keep in touch in case any other issue arises. Cheers!
     
  10. lazarus78

    lazarus78 The Waste of Time

    Glad I could help. Your topic came up at a good time too cus I've been gearing up to do some more dungeon work myself.
     
    G.Xyon likes this.

Share This Page