Only last step of BP function seems to be executing?

This is the first I’ve seen this happen. On all my other BP functions, I can see the execution run from the beginning to the end. However, on this one, the execution path only seems to be running on the very last section of the execution path.

Is this normal? I’ve followed the execution paths of every other function, and everything else seems to be running through correctly. I just don’t understand this? How can the last execution path be functioning, when no execution paths are firing up to that point?

If you need any questions answered by me, let me know. I’ve been ripping my hair out just trying to get this simple maze generator working in BP. (I’m using walls on the grid lines with columns on the grid intersections and not just placing 400x400x400 boxes to represent walls.)

Thank you in advance for any insights or answers you can give.

Please help before I go bald and tattoo the Unreal logo on my head.

Hi

Is generate pathways called any where else?

Yeah, it was. Actually, I was attempting to have it call itself recursively. I guess I can’t do that with blueprints, eh? Hmmm… My generation algorithm is kinda based off of recursive calls to itself so it doesn’t have to do any stack management. It just goes into itself until there are no ways to continue, then naturally returns back out to the previous location.

But as soon as I removed the recursive call at the end of Generate Pathways, my execution path flows all the way through this function.

Still kinda odd, though. Execution starts at Construction Script, goes to Create Layout, then to Generate Pathways (this one), then to BuildWalls. So, technically speaking it shouldn’t have even gotten to Generate Pathways because it was never called from Create Layout.

After editing and trying to work around the recursive problem, I’m back to execution oddness. It would appear that execution is starting at the While Loop. Also, there is absolutely NO execution in my Construction Script.

I’ll admit I’m getting super frustrated right now. I’ve never had this problem before and to be this far into something and suddenly be stuck like this is very discouraging. I really need help with this. I will screen shot ANYTHING and do ANYTHING to get some help with this. I hate sounding desperate, but at this point, I AM! I’ve been working on this for far too long and should be WAY farther than this.

I really hate to say this, but I had my original generator up and running in Unity in about an Hour. I’ve been trying to get the same thing implemented here for easily the past two or three weeks with no success. (But I don’t want to use Unity. I’ve chosen the Unreal Engine–been a fan of Unreal ever since the first game came out–and that’s what I’m sticking with.)

Would love that, but even zipped the project takes up about 1.6 GB. I’m still uploading it, though. In the meantime, I just found my original code that I had used in Unity, so I’m going to start creating another BP that mirrors this code.

Whenever my zipped project directory is done uploading, I’ll let you know, but I completely understand the ‘no promises’, but I do thank you for the offer at the very least. I’m also going to post a link here. I’ve got nothing extraordinary or proprietary in here yet. (Except for a couple of models I made, but even those aren’t anything real special.) The project is presently a test bed. There are two levels in it. The level (map) that has the BP in it is called “procedural”.

Is there any way to make the file smaller?

EDIT: Anyway, here’s the link. https://drive.google.com/file/d/0B4z_YiEw7iZpbVVpLU9od1M3NWM/view?usp=sharing

I had ripped apart the BuildWalls function several times to rewrite it. I’d either get no walls, or only four or five. So right now that part is empty again. I’ve been going through the logic of the other functions and that’s when I noticed my execution anomalies. I’ve been trying to work these out before finishing the building function. So right now all you should be seeing are the floors and some crappy, quickly thrown together pillars (that imported at the wrong dimensions because I had forgot to change my Maya grid settings before creating them. )

The walls I’m using (or at least WAS using until I ripped the BP apart) is just the 400x400 walls from the starter content until I get my own walls created. But at the moment, the last stage is incomplete until I work out the other problems I’ve been seeing. It’s hard to figure out what is going on when it would appear that execution starts halfway through the execution chain. But all the BuildWalls function was going to do is cycle through the array and render walls along the South and East sides of the cells if they’re impassable. As you can probably tell, I’m using a single-dimensional array for the grid, so the indexing is along the lines of:

±-±-±-±-±-+
|00|01|02|03|04|
±-±-±-±-±-+
|05|06|07|08|09|
±-±-±-±-±-+
|10|11|…etc…

Also, this isn’t a direct port of the Unity code. I just finally found that version while the file was uploading. But if you don’t see anything obvious with the way the BP is being created, or don’t see any glaring flaws in my logic flow, then don’t spend too much more on it. I really appreciate you taking the to look at it, but maybe going another direction is a better plan? Today is a fresh day, and maybe some great epiphany will smack me straight in the face.

By the way, I clicked on your attachment link, but It took me to an ‘invalid attachment’ page.

UPDATE: I’m doing an exact port of the UnityScript code I wrote as we speak. I’ll let you know how that goes. So far I’m pretty excited with the way this is progressing today. I should have a completed BP in just a couple of hours or so. Very glad I was able to come across the source again. It’s much better than having to reinvent the wheel, especially when you’re working with a system that still has a tendency to flummox you from to .

(Though, I do want to note that I have NO execution paths firing while I’m building and compiling, but I’m not even going to worry about that right now.)

Another update for you. I’ve got the majority of my old Unity function finished. (CreateLevel & ProcessTiles) Now I just need to create the BuildWalls function to actually spawn the meshes. As you can see, it’s a bit more organized now. Can’t trace anything because I’m not seeing ANY execution paths firing at the moment, but I’m not even going to worry about that until I’m done implementing the BuildWalls function.

I really appreciate your help on this one. I’m kinda scared about the whole execution path thing, but we’ll deal with that when the development of this version is completed. And if I need to send another file, at least I know how to cut it WAY down in size. I didn’t know what I could get rid of and what I needed to include.

This is the code I wrote that I’m porting to BP:



#pragma strict

var mazeMaxSize : int = 20;

class mazeBlock {
	var hasBeenProcessed : boolean;	
	var canGoNorth : boolean;
	var canGoSouth : boolean;
	var canGoEast : boolean; 
	var canGoWest : boolean;
	
	function Reset () {
		hasBeenProcessed = false;
		canGoNorth = false;
		canGoSouth = false;
		canGoEast = false;
		canGoWest = false;				
	}
	
};


// Global Variables
var newObject : Transform;
var mazeGrid : mazeBlock,];
var levelSizeX : int;
var levelSizeY : int;


function Start () {

	Debug.Log("Creating Maze");
	CreateMaze (5, 5);
	Debug.Log("Finished Creating");

	BuildMaze();

}

function Update () {

}


function CreateMaze(x : int, y : int) {

	Debug.Log ("Starting CreateMaze");
	
	// set our level size
	levelSizeX = x;
	levelSizeY = y;
	
	mazeGrid = new mazeBlock[mazeMaxSize, mazeMaxSize];
	
	Debug.Log ("Initializing Maze Squares");
	
	//reset all grid squares to init values.
	for (var i : int = 0; i<mazeMaxSize; i++)
		{
		for (var j : int = 0; j<mazeMaxSize; j++)
			{
				mazeGrid[i,j] = new mazeBlock();
				mazeGrid[i,j].Reset();
			}
		}
	
	Debug.Log ("About to process squares");
	
	// start our maze generation by processing the first square	
	ProcessSquare (Random.Range(0, levelSizeX+1),Random.Range(0, levelSizeY+1));
	
	Debug.Log ("Finished!");
}


function ProcessSquare (x: int, y: int) {

	// mark this grid point as processed
	mazeGrid[x,y].hasBeenProcessed=true;
	
	Debug.Log("Processing Square:");
	
	// start our function loop
	do {
		
	// pick a random direction
	var nextDirection = Random.Range(1, 5);
	
	// process the square in the next direction
	switch (nextDirection)
	{
		case 1: //try to go north
			if (y == levelSizeY || mazeGrid[x, y+1].hasBeenProcessed) break; //we can't go north
			mazeGrid [x, y].canGoNorth=true;
			mazeGrid [x, y+1].canGoSouth=true;
			ProcessSquare (x, y+1);
			break;

		case 2: //try to go east
			if (x == levelSizeX || mazeGrid[x+1,y].hasBeenProcessed) break; //we can't go right
			mazeGrid [x, y].canGoEast=true;
			mazeGrid [x+1,y].canGoWest=true;
			ProcessSquare (x+1, y);

			break;

		case 3: //try to go south
			if (y==0 || mazeGrid[x, y-1].hasBeenProcessed) break; // we can't go down
			mazeGrid[x,y].canGoSouth=true;
			mazeGrid[x,y-1].canGoNorth=true;
			ProcessSquare (x, y-1);
				
			break;

		case 4: //try to go west
			if (x==0 || mazeGrid[x-1,y].hasBeenProcessed) break; //we can't go left
			mazeGrid[x,y].canGoWest=true;
			mazeGrid[x-1,y].canGoEast=true;
			ProcessSquare (x-1, y);
				
			break;
			
		default:
			break;
			
	}

	//check to see if all surrounding squares have been processed
	var processedCount=0;
	
	if (y==levelSizeY || mazeGrid[x, y+1].hasBeenProcessed) processedCount++;
	if (x==levelSizeX || mazeGrid[x+1, y].hasBeenProcessed) processedCount++;
	if (y==0 || mazeGrid[x, y-1].hasBeenProcessed) processedCount++;
	if (x==0 || mazeGrid[x-1, y].hasBeenProcessed) processedCount++;

	// if so, exit our loop, and our function
	} while (processedCount < 4);
	
}


function BuildMaze() {

	for (var i : int = 0; i<=levelSizeX; i++)
		for (var j : int = 0; j <=levelSizeY; j++) {
		
			var newPosition : Vector3;
			newPosition.Set (4*i, 4*j, 0);
			Instantiate (newObject, newPosition, newObject.rotation);
			
			if (mazeGrid[i,j].canGoNorth) {
				newPosition.Set ((4*i), (4*j)+2, 0);
				Instantiate(newObject, newPosition, newObject.rotation);
			}
			if (mazeGrid[i,j].canGoEast) {
				newPosition.Set ((4*i)+2, (4*j), 0);
				Instantiate(newObject, newPosition, newObject.rotation);
			}
			
		}

}

Really the only major difference here is in the code I could do a “Do While” loop, where in BP it looks like I only have the option of a normal “While” loop. But I think I’m okay in translating the difference.

It’s way better than what I had gotten. I’m running into some problems on my rewrite right now, though. But trying to figure out right now if the problem is in my ProcessessTiles or my BuildLevel functions. For the test build I’m spacing my floors at double the gridsize, and just adding the floor in between if it’s passable. Right now I’m not getting any floors in between, so I’m ending up with just a grid of 400x400 tiles space 800 apart.

My execution path (Which magically started working in the Build function after I added the mesh) isn’t going past the branch in my build, so I probably have a logic error in my ProcessTiles somewhere. (But then I’m not showing any execution in there anyway, so I don’t know if it’s even processing anything…)

The algorithm is supposed to make a “perfect” maze with no point that is unreachable from any other point.

I’m pretty close on my alternate version, too. I’ll send that one to you when I’m done for comparison. I think I’m having a problem with my processed count and the while loop. I’m messing around with that right now but compiling is taking a long now so I know i just messed something up.

Yeah, it’s DEFINITELY a learning curve to attempt this with a one dimensional array AND doing it in BP. But I’m also getting closer. Still having trouble with the pathing on this side, too.

TECHNICALLY speaking, I should have a complete North wall, and a complete East wall. But I’m only ever getting one or the other. AND there shouldn’t be any inaccessible parts, but I’m still running into that also. BUT I have to agree: besides all the aggravation (and cigarettes), I’m enjoying the challenge of moving to this way of thinking. One thing is certain, I think we’ll both be a whole lot smarter when this is sorted out.

I’m packing it in for the night, too. I’ve fought with this enough today, too.

I brought my development laptop to work to work on it some more and look over my logic, and I’m actually thinking I also may have a flaw in my processing the edges, but I’ve got to double check that. I’m treating (0,0) as being the bottom right corner, and (5,5) as being the top right corner. This gives me an array of 0-24 for my index values. SO:

Given that SizeX and SizeY are the number of tiles in each direction, and index is the current 1D tile number (array index):

if ( index%SizeX == 0 ) then we’re a left side tile and can’t go West

if ( (index+1)%SizeX==0 || (index+1==SizeX*SizeY) ) then we’re a right side tile and can’t go East (This is the worst one.)

if ( index > (SizeX*(SizeY-1) ) then we’re on the top and can’t go North

if ( index < SizeX ) then we’re on the bottom and can’t go South

Now I’ve just got to make sure I’ve implemented that properly in this new BP. The reason I’m suddenly doubting myself on this is because with this new version I’ve been keeping the 2D thinking and converting to a 1D as needed when processing the array. But I’m thinking that this around I’ve flubbed the proper boundary checks because of treating the grid this way. I still need to pour over it to make sure, but there’s a problem SOMEWHERE, and this could be another spot where I’m missing something. This will be where I start when I’m out of work and have a clearer head.

I’m definitely going to post this version for you to download and check out, and I’m looking forward to seeing your solutions, also. Gotta admit, this is just as much fun as it is aggravating.

This is where I think my current version may go astray. But the LocalY and LevelSizeY-1 should be enough for it to trip the branch and catch any problems with an improper checking of the array. But I’m going to add my extra steps in here and see what happens.

I’ve resorted to some creative debugging techniques to try and track what’s going on. I added a GridX and GridY to the cells to store the actual X and Y locations of each of the tiles X and Y coordinates. Then I wrote a TestBuild function that uses a ForEach loop to iterate through the entire array and place a tile with all the walls on the sides that got marked blocked. The results are quite shocking. Now it’s a matter of deciphering the similarities of each compile to try to figure out where the execution path is breaking down. So far I’m not seeing any East walls being placed at all, and originally what should have been 25 cells in the array actually counted up to 27. (That helped track down one problem). This is the “debug” build viewport: Each step is 50 above the previous in execution. And there are certain steps that get missed altogether. Very puzzling.

And this is the “Frankenstein” function I wrote in place of the normal build:

! Definitely the crappiest looking BP I’ve ever written, but it works.

Holy *! HUGE smoking-a-cigarette-epiphany moment!! I just thought of a MAJOR oversight in my computations! I’m still using x and y coordinates and converting them as I need by calculating xy instead of the CORRECT formula of (YSizeX)+X HUGE FACEPALM

I’m an idiot!! That’s such a rookie mistake. I can’t believe I never thought about it before! to go adjust some computations and see what happens. That explains why the paths seem to stop at the edges and some other anomalies I’ve seen! Besides, that’s not even the math I need.

…I…am…a…moron…

I got to make some changes to my own some more last night after realizing my math error. Didn’t fix all my problems yet, though. Still not sure why my eastern walls aren’t being built, and my pathing is stopping early, but it’s behaving QUITE a bit better.

I’m also running into a complexity issue with relatively small mazes taking a long to generate. 5x5s seem to work just fine, but larger mazes like the 10x10 you mentioned are taking forever over here, too.

I’m really close on this one now, I can feel it. I think I may have broken a few things while trying to fix a few other things and I just need to go back and look at the BP flow against my old source code.

BTW, I did download the one you sent me last night, but didn’t have to look at it yet. If work is slow again I should be able to do some work again this morning and check out what is there.

I’m curious how you got yours down to such a small size. I guess I need to figure out a way to only include the used items when zipping it up. But then when I did a test build of my oculus project, the executable and data directory came up to almost 2GB just for a very simple map, also.

That reminds me, I don’t know how you’re able to debug your BPs. Every breakpoint I set or any watches I set don’t seem to do anything. Even in simulation.

Awesome! Can’t wait to see it. Where possible I’ve tried precomputing the math to variables and using those. Thankfully because I’m doing this, that stupid math error only needed to be changed in one spot so far as I could tell. I’m about to try to get moving on it a bit more shortly.

Yep. That’s it! :slight_smile: Very cool! I’m finally getting to sit down and try to work out where mine is going wrong.

I’m dealing with not doubling up the walls by having it only spawn the North and East walls, then just build a row of walls along the West and South sides.