Download

SaxonRahs Tutorial Thread - Random Maze Generation & Solving

This is really cool!

I am currently working on a modular cave system (for the market place) and having this 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 this 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.
Bolla.

Are you getting a “Cast to StaticMeshActor failed” error? I was encountering this 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. This resolved the error that I was encountering and the maze is randomly generated. I only made this 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?

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 :

3aab05c314cfac641393151bff77669e6c9ef82e.jpeg

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

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 this 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 chance to get closed off areas since each wallblock has only 1 side ever built off of.

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?

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?

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

I’ve not had a chance 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.

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

Hey, thanks Alexander! 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.

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