Before I fix room generation I dont think I will deal with custom rooms but perhaps I could turn this generation bug into secret rooms. I cant think of a cool way to do it , perhaps adding a script to wall torches that enables the player to pull on them to check if there is a room within reach , activating a secret passage to the rooms if there is one…
Of course I want to fix the algorithm to have more control on the shape of rooms , so keeping the torch idea in mind , for truly secret rooms to generate would simply require another type of room besides the placeholder room1 and room2 types so I did have this in mind. I plan on making treasure rooms , trap rooms , secret rooms , prisons containing mobs , as well as incorporating various types of hallways like tight hallways , well lit vs dark hallways to influence torch generation , perhaps secret mob spawning hallways as well , once I add basic mobs chasing you around.
Also some gameplaywise tiles should be added to the generator , for now we have the goal tile which isnt in the demo because It did nothing special but shine light and did not generate anywhere particularly hard to find , but I think about implementing some unique item / mobs spawning tiles.
Basically I will work on the asset until the package is a complete game as well as a level generator. VR support was flawless on my OSVR which means it should work on any HMD. I cant wait to implement monsters chasing you around because the torches really make a spooky VR atmosphere. Gotta fix that level generation first !
Just a heads up , looks like unity is taking a while to process my asset update once again so you may get a double update with the last map update if I end up finishing the next version before they release the current one. I worked on simple AI as well as trying out new room generation algorithms since after clean up I noticed a couple problems with the current one.
Im also adding something very important : seeded generation. Seed will be a parameter you can use to re-create the same dungeons multiple times. Im already using seeds in my generation process I just wasnt using a single global seed which means dungeons were not recreate-able as of yet.
Basically if by Friday night the current update has not released I will tell unity to disregard the previous version and just update the asset with everything new , which should then release by the next week.
I have uploaded a quick video of the new version which includes seeded map and item generation. I’ve sent the update for review a couple minutes ago , so perhaps you will get the new version later tonight.
As you can see below those are two new parameters , I have also replaced the ceiling with the floor tile in the demo scene since the textures look better ( at least to me ) , You can still use two seperate tiles for floor and ceilings by linking the ceiling in its appropriate slot again.
I have seen my friend use my asset on his computer ( which is newer and more powerful than mine ) and there was lag that seemed unbearable with the newer version which was found to be caused by torch and candle particle effects , so I thought I would make a post about performance to help people who may be having some trouble getting a smooth experience with the asset.
If you are experiencing low performances or constant lag first try updating graphics drivers , the main culprit in any low performance in rendering. Perhaps the particle effects require updated drivers to run smoothly. Second , you should make sure there is no overly complicated geometry within your building blocks. If you import a high poly model and splatter it all over the map it will have some substantial performance impacts on rendering times.
To be sure here , most performance problems I have encountered stemmed from the rendering and not from the generation / position culling from the buffer. In the latest version I added a map which uses a bit of CPU to get player position from the game world and also a Debug.Log call was added to directly print out the coordinates of the player while the map is open. Any Debug.Log call will slow down update logic so you may remove it if you are noticing some lag with the map open , I wasnt having any problems so I left it there for debug purposes.
If you are having issues with position culling there is are a couple options , first the extra parameter you can use which turns on iterative position culling. This means a maximum of N blocks will be loaded each iteration to reduce each spike , you can go as far as a single block loaded each iteration. This “animates” the map loading so if you look at it from above you will see a scanning point of blocks being loaded. Second parameter you can use is the pooling timer , which is best combined with iterative culling for a larger buffer size. Say you know for sure your player cannot run faster than your iterative generation process can load blocks , you may turn on a delay in between each iteration to decrease the amount of update loops actually calling the culling method.
Reducing Map Size and Buffer Size is also a good idea if you are not using occlusion culling , which is off in the demo scene since I cant figure out yet how to turn on static building blocks without screwing their textures. Once I figure out how to turn it on there should not be any more problems with particle effects , since right now a room full of candles will render even if its occluded. You can see that clearly if you rotate around a corridor and watch the amount of triangles increase in the stat window even though you can only see walls.
Anyhow , my buddy had no further problems after updating the drivers so I would say this is more of a case by case problem , if you have issues I have not addressed let me know on this forum post or directly by email and I’ll look into it as soon as possible !
Quick update for the asset , UI has been improved as I have figured how to make use of the Custom Editors. A script will be added to your Editor folder called DungeonGeneratorUI and enables me to format the script using dropdowns , stacking parameters like toggles and game object slots. This will also enable me to later on make possible gui placement of custom objects and dungeon generation rules , once I figure out a good way to do it.
If you dont want to use this UI you can simply delete the script from the Editor folder and the regular editor will draw. You may want to do this while adding your own objects to the script if you dont want to have to go edit the custom editor script and add a slot and toggle. The editor code has been lightly commented near the object toggles if you want to do it anyway.
Update should go live tonight, if it takes a while again I will nudge the asset store team will a little update to metadata to try and get it validated faster.
Just sent another update , added auto map rotation by request as well as some extra settings for map generation , this time focusing on the layout. You can find those in the new section “Advanced Map Options” , each option is a slider which can increase or decrease the chance of corridor branching , corridor ending , room entrances or staircases. You can go from 10 to 200% (0.1f to 2f) of my default value which are safe values to use in any combination as you can see in the above video.
just a question, if i build custom prefab rooms would i be limited to an height of 1 cube/unity on can i make them higher ? and if yes how does will it fit with multi-floors dungeons generation ?
Floors are currently being offset based on values that make sure the layout generates correctly , being the height of a wall + floor + ceiling , if you want to build custom sized rooms you will need to add a new type of tile to the generation process , say “Custom Room 1” , which makes sure you have enough space in above and below levels by removing any non empty tile in the way.
As you can see in screenshots featuring the map the level is at its core a tile map. To make sure the layout is easy to handle with a tile map I made the walls a 3x3x3 cube and capped off empty areas with 3x1x3 slabs. If you want to place your custom room you will need to make sure the entrance generates in the right direction and that the room translates to its correct position. This requires a bit of trial and error , which is why I simply use tile sized prefabs to create the main layout and then add objects by translating them from the center of the current empty area.
All in all if you make sure your prefab room uses tile size increments for its general size and if you make sure the level knows there is a prefab in the way you should not have any problems adding them to the procedurally generated dungeon.
Sorry about the long delay for this version, seems like the asset store team is again taking forever to process the latest update. To try and compensate I have been working on translation sliders for each building block to enable quick position fixes without dealing with code. Each slot and toggle will also have an Edit… button which will prop open a bunch of extra settings to edit the position of each building block.
Walls , Ceilings and Floor blocks dont require anything special , A simple Vector3 is enough. For other blocks however I am using Vector4 , which has an extra W component. We use this component as the Directional translation parameter. Those blocks , like torches , barrels , drawers and paintings , require an extra translation parameter TOWARDS the wall they should be against. My functions for generation of building blocks uses this parameter universally to translate towards a randomly or environmentally defined direction.
Cells behave in the opposite way drawers do as they translate towards the only empty area around. Still in this version if you are going to add your own features to dungeons you will need to edit some code so find an object with rather similar behavior to what you are trying to achieve and edit the translation parameters until you place your objects correctly.
Anyhow , I have no ETA on this next update as I dont even know when the current update is going to release , most likely this week.
Also forgot to mention that the next update will unify the translation parameters and scale them based on the size of walls you are using , keeping my 3x3x3 walls in mind as the “right” way to scale the dungeon , translations will now follow the size of walls so if you use smaller or bigger walls the objects should still be in their right place ( although they will still require scaling ). However , Walls will still require to be cubes for the moment.
Quick video demo for the new update , as you can see editing the position of each object is quite easy using the new interface. Almost entirely removes the need for code if you are not using custom objects yet , the only thing you need to consider is how the W parameter for directional translation works. Like in torches and cells , most likely I rotate the object towards some direction and W translates in this direction , so its very simple to go edit anyway.
Sent the update about a minute ago so if we are blessed it should release this week.
New tutorial out for the next version , still has relevant information for the current version concerning adding conditions for objects to generate. No words from the asset store team yet so I assume the new version will be out some time this week.
The 1.6 update has been released on the asset store ! For those who dont know , this update introduces an easy way to fix the translation parameters of each object within the generator. Check the video and screenshot 2 posts earlier for more information on how this works.
Next up for me to work on is the GUI for editing generation rules and an easy way to add and remove custom objects from the process without any code. As the previous tutorial described there is still a need to edit code I wish to completely get rid of , to make this asset completely beginner friendly.
I have been informed of a couple issues with the new version and will soon be sending an update addressing those issues. Mainly an issue while building scenes and the fact that the map was removed by mistake. The update will feature the fire pit model I showed how to create and add in the latest tutorial.
I have also made progress towards adding custom objects to the generation process. As you can see below , this integrates with the rest of the interface in the same drop down as the hard coded slots , but you can add and remove them on the fly. I may end up using a reorderable list for its ease of use , but in any case I am having issues with the [SerializeField] attribute not saving the list of custom objects after exiting unity. I will most likely try to fix this before sending the next update so you guys can start adding custom objects.
The playable demo has been updated with the map , here is a download link for those who want to try it out. Custom objects I talked about in the previous post have been fixed and opened the way for more customization of the generation process within the UI , this update will be sent tomorrow after some cleaning up and should release some time next week.
Next update I will be adding translation direction types to the Custom Objects that have a Translation Type of Vector4 to control the direction of the W parameter easily. Directions would include towards wall ( like torches , drawers , barrels ) , towards openings ( like cells ) , towards inward and outward corners and a couple more types I will add for ease of use.
We are getting closer to a complete UI experience !