Download

Only last step of BP function seems to be executing?

This is the first time 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.

b104c2008ebb8a680c835c7ebd8ecf30ffd1fe2f.jpeg

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

-Marc

Hi

Is generate pathways called any where else?

Narg

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.

executionpath3.jpg

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.)

I can’t promise anything, but I would be willing to take a look at the project. I won’t share your files and they get deleted immediately, but I like to try and help when I can. If you want me to do so, zip it up and shove it on Google Drive, then PM me. I will get to it and see if I can be of any help.

No promises though.

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. vrmaze.zip - Google Drive

Did you delete your Intermediate/Saved/Binaries folders first?

I am downloading it now, I will take a look at it here around lunch and see what I can get it to do.

If I start the game in PIE, it shows the same results, it appears the WhileLoop is taking off before everything else, but a breakpoint shows that isn’t the case:

What should be happening right now, that isn’t? Is this a complete port of your Unity code? I noticed you only had one mesh defined, and you hadn’t hooked up the others.

I hooked up the Current Index node to see what would happen, just ignore that.

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. lol)

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 time on it. I really appreciate you taking the time 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 time to time.

(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.)

generate.jpg

As you can see, it is firing correctly, and it does iterate correctly as well. There is a logic error somewhere here. Let me try to do what you have described. It might be a little later tonight before I get back to you if that is ok.

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.

2890550a8cda4761d0918b1df00410d553002eec.jpeg

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.

I will try to replicate it myself as well. It IS firing the code before. Right click on a node, and place a breakpoint. I will play with this for a while and see what I come up with.

I’ve made some progress by rewriting it while using some of your original work. I need a little more time though to make sure what I am doing is feasible.

This is starting to look about right.

new.jpg

Outer walls are done, I need to do a door check and have it swap walls when a no resolution dead-end is present.

a2.jpg

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.

procedural3.jpg

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…)

99e596b01318c76344f6732b550db29de9a81486.jpeg

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

Yeah, so what I would do now is a trace loop of some sort, and make sure all parts are reachable by other points, and have it remove some meshes. I will keep working on it, when you want me to send you the assets, let me know.

Edit: Also, I am going to treat square 0,0 as the begin point for the maze trace. It really doesn’t matter, but I thought you should know.