I’m building a dungeon generator. its already working alright but I need a little extra functionality out of it that unreal doesn’t seem to have on offer, at least not that i have found yet. at the moment I’m generating box variables based on randomly generated values. checking to see if any of the previously generated boxes intersect that new one and then based on the results do X, Y or Z. the problem is this limits me to only using boxes aligned to each others axis. what I really want to be able to do is generate various shapes at various rotations and still be able to check them against each other for accidental intersections. I haven’t been able to find a way of doing that.
is there a way of generating basic primitives like a box, sphere and cylinder but only as a data variable (like the box variable) for the calculation of the dungeon and use that to test for intersections, overlaps and the like?
I’ve been checking the forums, documentation, YouTube and googling every conceivable term I can think of to get this information but none of it seems to lead to an answer I can use.
any help on this one would be great thanks.
if you need more information or a clarification let me know i would really like to get this issue solved.
What do you mean “Only using boxes aligned to each others’ axis”?
If they overlap they overlap… shouldn’t have anything to do with axes. I’ve done this before and built a random dungeon generator, what we used was each room would have as many boxes as necessary, and when asking “Can I build here?” it checks for overlap of ONLY THOSE INVISIBLE BOXES using a custom collision channel only meant for that purpose!
so the problem is coming from the variable itself. the box variable is a struct variable that only has a min vector, max vector and an is valid Boolean. the min and max vectors represent opposing corners of a box shape.
the problem that I’m coming up on is that using that built in box variable and all of the built in functions is great and simplifies the process a lot. it just cant be rotated by the blueprint functions at all and will always have a 0,0,0 rotation.
so trying to generate a hallway at a 45 degree angle for instance, can be done with this method but the box variable i save wouldn’t be representative of the hallway that would be running diagonally through it. because of that i would likely get a lot of false positives when testing for intersections. the same would be true of a rounded room.
I hope that makes sense. I’m not sure I’m explaining this well.
I guess what I need is to have other shape variables like the box variable, that have built in functions to test for an intersection with another shape. also the ability to apply rotation to that box variable. I’m hoping something like that already exists and I just don’t know what to look for to get it. the major thing that I’m looking to avoid is spawning things into the level one at a time to test for intersections and than make corrections based on the results as that spawn despawn can start to wear dosn the performance a lot.
So, mine was room-based. I had 47 different constructed rooms (spawning up to 200 in a dungeon) that, directly after spawning, would check with the box if it was overlapping. If they overlapped, destroy that new room and find a new spot for it.
However, the ONLY thing that spawned initially as part of the base actor was the base wall and floor geometry, and the overlap detection boxes (which were removed once all rooms were spawned).
Once all rooms are spawned successfully, then on a ForEach with all rooms in an array, have them populate their columns, ceilings, find all empty doorways and replace them with walls, etc. Then on another ForEach, spawn decor. Lastly, a ForEach loop to have them spawn pawns.
Honestly it was pretty fast. I’d say “It was only THIS LONG” but I mean that’s going to vary depending on your computer. But loading screens still exist in modern gaming- and this is a perfect example of how and when it’s appropriate to use one.
I know that wasn’t a direct answer to your question, sorry. It’s more of a “I hope you can get some inspiration for your issue, a way around or through you didn’t think of” type post.
I appreciate the input, its not really the solution to the question no but it has helped me shake up the thought process a little bit. I have a couple different ideas for work arounds to the solution brewing now. only thing is none of those are quite as appealing as the solution I’m looking for lol. I can make my own variable types that represent the shape information and how it is spawned. from there I think I might be able to make my own blueprint functions that work in a similar way to the ones that are in the editor already. even with that I think all I really need is to make one function that detects if two shapes overlap each other and sends out a true or false bool. after that its just a matter of a few minor alterations to the blueprint to properly use and store that data.
that’s where I think I’m headed with this, if you know of some good tutorials, forums or helpful documentation for making custom script functions or possibly modify existing ones that would be great. same go’s for anyone reading this, got any helpful tips to get me started down the right path that would be great because google and YouTube are of little help anymore for finding stuff that I’m actually looking for.
I have an update. I found what I was looking for I just had no clue what to call it or where to look for it. I didn’t know what I didn’t know.
so as it turns out the geometry scripting nodes make exactly what I was looking for, I was having trouble finding it because I was using the wrong words when searching for this stuff. after reading through the node descriptions for all of the new geometry script nodes, in the interest of understanding what my limitations might be for creating procedural geometry. I found this little guy
this is exactly what I needed, this is going to do a lot of heavy lifting for me.
I’m going to have to make a bunch of changes to the data that I’m generating and saving but this is a huge improvement.