Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

generating random maps: water

Discussion in 'The Lab' started by doom_sheep, Feb 17, 2017.

  1. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    786
    Resources:
    0
    Resources:
    0
    I've done a bit of testing on altering terrain pathing through triggers and that seems to be workable, if a little taxing on performance.

    next is making the terrain appear in a reasonable way. cliff level visuals cannot be altered ingame except one way: making the whole map water and raising the parts that should be land by using terrain deformations. I've never worked them before but people have warned me about many of their aspects. we'll see how workable this method is.

    drawing on minimap is rather difficult. destructibles placed by trigger do not have a minimap icon and spamming units everywhere just to color things would ruin everyone's FPS. the only reasonable method I know of is blight. I've done a few things with it and damn is that shit chancy. perhaps it wants me to understand some intricacy or perhaps it's just following some infernal dice-roll on its behavior.

    (a lucky break - blighting a spot that is underwater tends to not actually place any visible blight, but does change the minimap)

    with no other option I've experimented on these two by basically slapping random numbers on my trigger and seeing what it does. behold, the result:

    [​IMG]
    this is not yet connected to anything that alters pathing but I don't anticipate much additional difficulty on that part. we'll see.


    further considerations:
    - the blight tends to randomly make some visibly blighted spots. that behavior can probably be changed or overridden some way. might it be possible to stop blight from making visuals altogether? - blighting the map before raising any of it takes care of that
    - how will changing map size affect the visual to minimap sync? who knows. - seems to work at any map size
    - is there a way to get the height of a point of terrain in order to change the pathing? that might make this all very easy. - yes
    - what's the most optimal unit of size to raise/unblight terrain by?
    - can the terrain deformations be cancelled in order to gen the map again?
    - is blight minimap color changeable to a nicer shade of blue?

    here's my fairly simple trigger:
    • Melee Initialization
      • Events
        • Player - Player 1 (Red) skips a cinematic sequence
      • Conditions
      • Actions
        • Set QPoint[2] = (Point(-3100.00, 2800.00))
        • Environment - Create Blight for Player 1 (Red) across (Playable map area)
        • For each (Integer A) from 1 to 22, do (Actions)
          • Loop - Actions
            • Set QPoint[2] = (QPoint[2] offset by (310.00, 0.00))
            • Set QPoint[3] = QPoint[2]
            • For each (Integer B) from 1 to 22, do (Actions)
              • Loop - Actions
                • Set QPoint[3] = (QPoint[3] offset by (0.00, -310.00))
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Random integer number between 1 and 10) Greater than 6
                  • Then - Actions
                    • Environment - Create a 0.33 second Permanent crater deformation at QPoint[3] with radius 300.00 and depth -100.00
                    • Environment - Remove Blight for Player 1 (Red) from QPoint[3] to a radius of 150.00
                  • Else - Actions
     
    Last edited: Feb 27, 2017
  2. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,333
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    The problem with using terrain deformation is, it is not shown in fog.
     
  3. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    786
    Resources:
    0
    Resources:
    0
    shazam!

    [​IMG]

    I connected it to a system to apply pathing based on terrain height and a rudimentary map gen beyond just rolling dice for water/land. I had heard GetLocationZ causes desync but CanFight assured me he's used it.

    the pather runs after the visual generator. as it's a little heavy I made it run slowly to not fry anyone's PC. spam -fastgen to increase its speed.
     

    Attached Files:

  4. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,037
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    GetLocationZ desyncs only in case if something already modify ground (thunder clap). if the location is visible, height will be modified, else - won't be changed. as long as you don't start your routine while there's chance of casting thunder clap, you're completely fine with that.
    and you can't rly fry any pc out there, there's already tons of limits within jass VM itself. especially you dont need that on the project at labs
     
  5. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    786
    Resources:
    0
    Resources:
    0
    warcraft can easily freeze though.
     
  6. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    786
    Resources:
    0
    Resources:
    0
    I assume there is some necessity for these while the map is generating. desync stuff is trickier to test, but visibly blighted spots at least seemed to appear when I ran the map without them.

    • Visibility - Disable fog of war
    • Visibility - Disable black mask


    you could put players in cinematic mode to prevent them seeing the map as it is generated. - use letterbox mode: cinematic mode screws with random seed.
    afterwards, if you want to hide the map until players explore it, this will reset fog and explored area.

    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Black mask across (Playable map area)
          • Visibility - Destroy (Last created visibility modifier)


    you will also need to uncheck "masked areas are partially visible" under scenario -> map options for it to work.
     
    Last edited: Feb 28, 2017
  7. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    786
    Resources:
    0
    Resources:
    0
    having done some testing on reversability:

    temporary and permanent deformations are very different.

    permanent deformations which I've used from the start only have the drawback of not being killable. they can be "reversed" by making an identical one with the opposite value. this is of course a form of leak but even a big map should not become laggy from a few rounds of this since they are quite light.

    whereas temporary deformations will not spawn for players that have the spot fogged, and will lag heavily. upside: they can be removed. downside: they should really be removed as soon as they are created.