SaxonRahs Tutorial Thread - Random Maze Generation & Solving

is really cool!

I am currently working on a modular cave system (for the market place) and having as a feature would be really awesome :slight_smile:

Good news everybody, well kinda! The reason the ai hasnt been working was because of an overlooked Realtime NavMesh bug in the 4.1 release, hopefully it will be included in the 4.2 release.

:slight_smile: Thanks Luos! I’m working on some Cellular Automaton too, you might like that a bunch more for the cave system!

UE4 Closes after freezing

I cannot get the Maze to generate, when I enter the game ( using alt+p) it freezes, and after a few secs, UE4 closes abruptly.

I’ve been working on like 2 hours ,and i think my error relies when i set the tileX and tileY,(but as I cannot debug it, i’m not really sure),

to generate the maze i do :

EventBeginPlay->GenerateMaze(with tileX = 23, and tileY = 23)

I hope someone knows how to fix this.

If you need more info about my error ,tell me.

Thanks in advance.

EDIT:

I’ve managed to debug it, UE4 crashes here:



AStaticMeshActor* BlockTile = SpawnBP<AStaticMeshActor>(GetWorld(), TileBlockBP, GenSpawnLoc, GenSpawnRot);


TileBlockBP has a correct pointer,(it isnt null)

EDIT2:

It looks like SpawnBP isnt even called, when I call SpawnBP UE4 toggles a breakpoint here:



int32 Error = GetLastError();


And the breakpoints at the SpawnBP dont get called.
I don’t know why :frowning: , please help
Help is appreciated.

Are you getting a “Cast to StaticMeshActor failed” error? I was encountering when extending the maze generator from Actor. I never tried to extend from HUD since SaxonRah suggested extending from Actor.

I ended up changing all AStaticMeshActor from the example code to AActor. resolved the error that I was encountering and the maze is randomly generated. I only made change as one of the various troubleshooting attempts, so I don’t have a reason to back up my decision.

Hello SaxonRah,

Very nice work you have here. I scripted a couple of Dungeon Generators in unrealscript. I see you have Maze Solver as well. That leads me to the following questions. Do you have any thoughts on Cheat prevention/Anti-cheat mechanism for games generating mazes such as the those posted in the top thread?

[=Locke;64694]
Are you getting a “Cast to StaticMeshActor failed” error? I was encountering when extending the maze generator from Actor. I never tried to extend from HUD since SaxonRah suggested extending from Actor.

I ended up changing all AStaticMeshActor from the example code to AActor. resolved the error that I was encountering and the maze is randomly generated. I only made change as one of the various troubleshooting attempts, so I don’t have a reason to back up my decision.
[/]

Thanks a lot !! :smiley: it fixed it, but I’ve found a better way to fix it, just Reparent the blueprints to StaticMeshActor.

Now i have a maze generated, but it’s filled with closed loops and impossible-to enter areas :

(The starting tile is the bottom left one :S )
But I dont know why it happens :confused:

[=Bolla;65253]
Thanks a lot !! :smiley: it fixed it, but I’ve found a better way to fix it, just Reparent the blueprints to StaticMeshActor.
[/]

I knew there was a better solution. :slight_smile:

I ran into some issues of areas not being accessible when my mesh length and width sizes didn’t match the float offset within the GenMaze function. I’ve got meshes that are approximately 500 length and width for all Tile pieces except TilePillarBP. The code had an offset of 400. I just changed the offset to 500 and made sure all of my meshes were the same size. I also changed the GenSpawnLoc X and Y values, under the Starting Tile Spawn, to offset instead of a static value.

If all of your Tile pieces are the same length and width, I’d verify that the code isn’t missing any of the original logic. I haven’t changed any of the original logic.

Thanks for your answer Locke, but it stills doesnt work , (I am using the floor 400x400 template).

I’m going to use the depth search method, so i dont have those little ‘spots’ by using method.

[=Bolla;67386]
Thanks for your answer Locke, but it stills doesnt work , (I am using the floor 400x400 template).

I’m going to use the depth search method, so i dont have those little ‘spots’ by using method.
[/]

You did something to the logic of the generation code, the code that was written uses every other block in both x and y then chooses a single direction to build off of. There is 0 to get closed off areas since each wallblock has only 1 side ever built off of.

[=TechLord;65195]
Hello SaxonRah,

Very nice work you have here. I scripted a couple of Dungeon Generators in unrealscript. I see you have Maze Solver as well. That leads me to the following questions. Do you have any thoughts on Cheat prevention/Anti-cheat mechanism for games generating mazes such as the those posted in the top thread?
[/]
Make everything you don’t want someone to modify, replicated. So you force a local host that way its atleast way harder to cheat.

[=SaxonRah;69172]

Make everything you don’t want someone to modify, replicated. So you force a local host that way its atleast way harder to cheat.
[/]

Just an idea here, but wouldn’t you want to locally only have the area around the player, and the full map on the server? I’m not sure how that would work, but replicating specific tiles maybe?

[=dmacesic;69446]
Just an idea here, but wouldn’t you want to locally only have the area around the player, and the full map on the server? I’m not sure how that would work, but replicating specific tiles maybe?
[/]
I’ve yet to figure out blueprint culling I’d love some input on that from anyone.

I was thinking don’t render any of the tiles by default on client and map is on server. but then you have 2 boxes called tilecull in the player-print and each tile-print that triggers a collision with one another and you simply toggle the rendering of the tiles that are collided with the player?

[=SaxonRah;56417]
[SIZE=2]Good news everybody, well kinda! The reason the ai hasnt been working was because of an overlooked Realtime NavMesh bug in the 4.1 release, hopefully it will be included in the 4.2 release.

[/]

So has it been fixed in 4.2 ?!?!?!?!

I’ve not had a to check myself yet :slight_smile:

Rama

[=Rama;69620]
So has it been fixed in 4.2 ?!?!?!?!

I’ve not had a to check myself yet :slight_smile:

Rama
[/]
I don’t think so i tried but it didnt work, i think i may be doing something wrong,
someone told me to try the github, b/c that will have the fix but im lazy atm, ill have to check that out soon!

I’ve gotten blueprint culling to work. I call it TiledVision. Enjoy a video of it in action. and enjoy the blueprint

&stc=1

I mistype the image. Each tile has a Box called VisionBox to the tiles extents i am using 400x400x400 and the player has a sphere.

I’ve been using the github version for awhile now and I still haven’t tried to test dynamic navmeshes. I think that will be today’s task.

[=SaxonRah;80254]
I’ve gotten blueprint culling to work. I call it TiledVision. Enjoy a video of it in action. and enjoy the blueprint

[/]

Nicely done! I assume that from a first-person perspective it looks seamless.

PS: I would have called it TileVision instead of TiledVision :smiley:

EDIT: Someone else is doing automapping, but with a different approach.

Yeah it sure does look good in FPS mode! One thing i would do for a first person view that way you are only drawing what needs to be seen is to use some other geometry like a cone in front of the player instead of a huge sphere that way you would only render whats in front of you. Also i made the sphere intentionally smaller so you guys would see the effect, really you would match the screen size and use a box instead.

Edit:I’ll have to check that out!

Wow SaxonRah, that TiledVision BP was much simpler that I thought it would be. Very cool! :slight_smile:

I love the dungeon generation with rooms - that’s awesome. I’m making a dungeon crawler game, so that would be great for my purposes.

Yay! Dynamic NavMeshes work again in the github version of 4.2 :slight_smile:

Yay! Dynamic NavMeshes work again in the github version of 4.2 :slight_smile:
<3 I am one happy dude! Thank You Epic

[= ;80380]
Wow SaxonRah, that TiledVision BP was much simpler that I thought it would be. Very cool! :slight_smile:
[/]

Hey, thanks ! I thought it would be far more complex as well, but you guys have made such an amazing engine. You can do so many things so simply, that would be very hard in other engines.

[=n00854180t;80627]
I love the dungeon generation with rooms - that’s awesome. I’m making a dungeon crawler game, so that would be great for my purposes.
[/]

Unfortunately i’m not releasing the dungeon generator code, at-least not yet anyways. BUT WAIT, just you wait till the UE marketplace is released. I’ve got a plugin in the works with pretty much everything exposed you can imagine. I’m sure you and else will find it very useful!

The dungeon generator code is something quite fun to make as well, I wouldn’t recommend skipping out on it if your serious about going that route. Making the rules that govern how your world comes to be is something fascinating, and coming up with a method all of your own will give you a real stamp on your game. For mine, I’m working with the C++ FPS template, unfortunately I haven’t had a good grasp of the Unreal methods and classes, luckily they just posted the C++ tutorials, and I’ll get to go through those and learn a bit more.

I’ll probably do something where blocks will only appear when a ray trace from a player can hit them. I think I’ll have to have collision meshes stay in place for mobs, and I’ll do something similar to the player vision, but add in the ability to “hear” the player.