Impossible data

Let me start by saying i think the problem is here
i noticed the for loop runs complete more often than it ought to so i added the check to see if it has gone through the whole array

check if exists no make room else don’t make room

The main loop

So what’s supposed to happen is we spawn a room, around that room ( just forward atm ) we see if theres a room there… if there is get the actors of room again… and run the check if theres already a room in which case don’t make a room, move on to the next room and check if theres already a room in front of it… repeat up to Max rooms

simple version, should make 10 rooms in a row spawning each off the last ones location if it’s not already a taken location

Works just fine when we only use forward vector like pictured above
But as soon as we allow it to consider another dimension
in this case right

It spawns them inside ones that already exist as tho the check never happened…
we get data that should be impossible

It should be impossible for there to be duplicate data like this, no value should repeat

i have a key that i press that triggers “StartGenerator” btw

Seeing a few things that aren’t right or could make a next issue.

  1. When you compare a vector containing float components (X, Y, Z) it could be that === returns “not equal” for vectors that look equal to the eye. That’s a float precision problem and the reason why nodes like “is nearly equal” exist for floats and vectors.

  2. That loop comparing array index to length of the same array can never be true, because we start counting indexes at 0. an array with length 10 would have max index 9. Blueprints for some reason also accepts a function with one path without return value.

  3. Once you position a room of X size at a center location, you currently check if that center location is taken but you don’t mention the space the room actually takes. One room could overlap another still.

  4. I feel like you should look at existing partitioning patterns first and see if any fits your need, so you avoid overcomplicating all these checks. With a partitioning algorithms you cut up available space into rooms, instead of the other way around. There are many, but take a look at Binary Space partitioning just to get the idea.
    0:35 / 10:15 Binary Space Partitioning Algorithm - P13 - Unity Procedural Generation of a 2D Dungeon

1 Like

i originally had it as a == but in this case they should never move from these positions… but if i have a problem ill try switching back to regular ==

it does almost exactly what i want it to do… currently the spacing is 150 which is bigger than the block size of 100 but thats to see whats going on

the block closest to the pov is “self” every other cube is “room” however some of them get placed at the same spot beacuse of the data being wrong somewhere

somehow it’s passing every check ive tried to make and still spawns it inside the other one…

i don’t know how this is possible as its supposed to run through the location of each one and if its the same Not add it… but it adds it anyway which should be impossible?

recolored main to orange to make it easier to see
heres 10 rooms in white… but theve come all stacked in this run

Putting these here in case i changed something and didn’t realize but it should be the same images as above




The data at [1] and [2] are duplicates [4] somehow when it does the check where its supposed to compare the place it’s about to spawn one to the places its already spawned one it skips that check or something which should be impossible and adds it to the array of existing locations

Tis why i say the problem is probably the 1st image of my post :slight_smile:


Even swapping out to the == with a massive 10 error tolerance it’s the same results which is why i say problem is in the logics not the maths

Found another issue that is messing with our minds. See the green nodes? They are called Blueprint Pure nodes. Every time you access a value from them they execute again (not just once!). Only the blue nodes execute once.

Your nodes are executing the random generator multiple times, once for the test then twice after the test. Create a local variable to copy its output to, then use the local variable to read the value from.

i mean i see where your at but the vectors in question are the same and should never be let through the branch statement to be added to the array “spawned Rooms”

ill give that a try in case i am just missing something but it should be getting the forward or right vector of each room and seeing if its already made something there

If location to check matches anything in “SpawnedRooms” don’t make new room

Well, for the check it sends a vector with a 50/50 it is right or forward. After the check it gets a random one again. So it can get the same vector multiple times. on the spawn actor node it gets a random one again.

Your saying if A A A = A A A its not the same?

example how is [1] [2] and [4] any different?

can you recreate this and show me what you mean beacuse even swapping them to variables its still the same

It’s explained here, this is normal behavior for pure nodes to re execute.

https://youtu.be/H-dA7tGQnBc?t=145

The way to prevent re execution is to store the output of the pure node in a variable, then use only that variable afterwards to connect to other nodes.

how is [1] [2] and [4] any different? you’re giving me bad advice here without explaining i get what your saying but its not applying to the problem at hand in the way it checks the vectors

The way I see it you are checking for a random vector in that array, then adding a different random vector in. How is explaining why that happens bad advice :rofl:

Because 1080 2040 270 = 1080 2040 270 should spit out true as it found the same thing

what your saying would give something like 1080 2040 270 = 2040 1080 270 or something which would make sense

can you post a pic of your new node setup, the vector stored in a variable right here:

Where do you want the set connected to? before check already exist or some point after? it shoudnt be hard to recreate in its entirety either if you wanted to prove me wrong

assuming this is what you meant same reasult

You set the variable correctly. Then use the output pin on the variable node to connect everything else (the check, the add to array, the spawn nodes).

please re create it or download this and show me… im so confused what you mean or your wrong and i’d like to believe its me being confused