Announcement

Collapse
No announcement yet.

Construction script behaves differently in editor than in Simulate (hex map)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Construction script behaves differently in editor than in Simulate (hex map)

    I'm building a map from hex tiles. Each hex has its type: one of five letters or 'A', which means it's type will be chosen automatically in Blueprint - a mix of its nearest neighbours.
    For debug purposes, currently I'm printing either the type (D,F,M,S,R) or (for A) an array of neighbours.

    I encountered a problem. Everything works OK straight after compiling the Blueprint, but gives strange results while in Simulate mode or after opening the project again.

    What could be the cause of the problem? Is it possible that the errors result from querying all members of hex's own class?
    I attach 3 screenshots and the project.

    Oskar

    Project (3 MB): http://oskarswierad.com/p/screeny/HexMapGen2_2.zip



    http://oskarswierad.com/p/screeny/He...ngSimulate.png

    http://oskarswierad.com/p/screeny/HexesBlueprint.png

    Also, often this error shows up, but vanishes just after compilation:
    http://i.imgur.com/ZF3bv42.png
    Last edited by Oskar Świerad; 05-03-2014, 08:42 AM. Reason: resolved
    Tech Art Aid tutorials - shaders, procedural techniques, optimization

    #2
    After lots of playing with your idea (which is great and i will steal it for my personal selfish gain in future):

    I think culprit here may be "get distance to" you are comparing component distance from local root to world coordinates.
    I recreated your idea in totally new network, same "feature" appears. but when i move all hexes together result varies, and should not because relative distance is same.

    PS. Anyway this is a bug in blueprints. This may be reason i could not get my maze example to work correctly for last two weeks.

    My network, same behavior, not using "distance to" because i was trying all methods to calculate distance i could think of:

    Click image for larger version

Name:	feature_in_location.jpg
Views:	1
Size:	128.5 KB
ID:	1050419
    Attached Files
    Last edited by Nawrot; 05-02-2014, 08:01 PM. Reason: 20th iteraction in investigation

    Comment


      #3
      Thanks for a thorough investigation!

      Yesterday you wrote about a possibility that all blueprints in Simulate are constructed "at the same time", so they don't know about the ones still to be created.
      So I did a simple check: "Hex, tell me how many hexes exist in the world?". It seems that, actually, all of them:

      http://oskarswierad.com/p/screeny/HexesHowMany.png

      So at least the unchanged parts of hexes - variables and world positions - should be available and the system should work. (If all blueprints are recreated from scratch on the beginning of Simulate/Play, then my system has no chances to work in a stable manner, but the screenshot above contradicts that).

      But when the blueprint collects the neighbours' types and distances into an array, the errors remain.

      A more predictable option will be to write a plugin, but I'd like to avoid it for now.
      Last edited by Oskar Świerad; 05-03-2014, 08:43 AM.
      Tech Art Aid tutorials - shaders, procedural techniques, optimization

      Comment


        #4
        Ok i found solution, there is something fishy going with determining neighbor location trough reference. And that is probably same thing that messed my maze generation.
        But everything is fine and dandy when that neighbor gets self location and stores it in variable.
        So to fix that whole problem make vector variable to store self location, then for distance use that variable for hex you are processing and for neighbor.

        PS. investigated further.
        In some cases get actor reference> cast to actor > get actor location or get world location returns 0,0,0 vector even if i can read variables from them (referenced actors) correctly
        But when you simulate and drag actor it will update variables correctly. If you attach actor to actor (by dragging it in list of actors in level) parent actor cannot get locations of its child objects,
        probably because parent is spawned first.

        This indeed looks like some BPs at construction time do not have neighbors yet, so they set 0,0,0 there. Probably optimization thing or "feature" that is hard to fix.
        Last edited by Nawrot; 05-03-2014, 07:55 AM.

        Comment


          #5
          Perfect! Thanks. Still a bug probably, so I filed a bug report, but that's the solution.
          Last edited by Oskar Świerad; 05-03-2014, 06:38 AM.
          Tech Art Aid tutorials - shaders, procedural techniques, optimization

          Comment


            #6
            Here's the project in new version, working like it should:
            http://oskarswierad.com/p/ue4/hexgen...2014-05-03.zip (1.2 MB)

            Now, the farther the other hex is, the lower is its contribution to the automatic hex's type. SearchDistance was increased to about 4 hexes.

            Blueprint's SearchPower variable defines how much are instant neighbours promoted.
            For example, when power is 1, two distant Military terrains can overweigh a single adjacent Scientific terrain.
            But with power of 2 (like on the picture below), Scientific wins (slightly).



            Last edited by Oskar Świerad; 05-03-2014, 09:09 AM.
            Tech Art Aid tutorials - shaders, procedural techniques, optimization

            Comment

            Working...
            X