Im developing a little script that randomly generates a map from five modular "cubes", or blocks. Right now there are only five different type of cubes:
deadEnd - blue
corner - green
splitTwo - yellow
splitThree - orange
splitFour - red
Each of the five "cubes" above also have two other forms:
One without a floor, one without a ceiling, and one without both floor and ceiling. This allows traversing throught the "cubes" in the vertical direction.
Each "cube" is its own prefab, and the user can change the prefab to whatever they like. As an example, splitTwo might be some modular corrider.
Some randomly generated maps, two dimension:



You can increase the minimum number of cubes:


You can go crazy if you want:


It also does three dimensions, you cannot see the "elevator" cubes (cubes that allow traversing in the vertical direction) from the pics, but they are randomly places and the user can specify the max number of "elevator" per level:


What features would you guys add on top of these? I haven't touched too much on enemy a.i but from what Ive seen waypoints are placed in a sequence throughout the map, would you guys find that useful? How about ways to break up redundancy? I was thinking that each of the five cube types can have multiple versions, for example the user might have several different corider designs, perhaps in addition to randomly generating the sequence of cubes it can randomly choose which type of each cube it chooses.
The script is developed for the Unity engine at the moment, but I plan to also develop one for ue4 in the future.
Any suggestions?
Also if anyone has any modular pieces that they can share, Id love to test it out and show you guys.
~CD
Replies
I also began modelling some simple modular pieces and quickly generated this random map:
The modular components
Randomly generated map
Seems to handle large maps pretty well so far, hopefully I wont have to implement my own data structures anytime soon.
I stumbled across this wiki awhile back, some of the topics might help you.
http://pcg.wikidot.com/pcg-algorithm:dungeon-generation
If you make a Y-way version, I'll explode, especially if you find a way to merge the Y-ways back into the 90degree kit. If additionally there are snap-points highlighted with a null object where objects like doodads, player activator fields, and clutter can be randomly assigned to applicable blocks... masterwerk.
Thanks for the suggestion. I love the idea of rulesets, I began implementing some simple rulesets for the placement of objects such as on the floor, against the wall, hanging from the ceiling. I hope to include more such as on the corner, in specific "cube" types only, ect. Going to have to start up minecraft again haha, never truly appreciated its rules.
@Eric Chadwick
This is great, I found a cool paper on different algorithms to generate random dungeons, specifically a context free grammar approach which is what I had in mind in the beginning but couldn't work it out on paper. Thanks.
@jdp092
Thanks, hopefully it wont be too long before the first release.
@Thaiauxn
I hope to make the script robust enough so that the existing cube types can be used to create anything, I can think of a way to make a Y split in terms of splitThree and corner types but I will look into dedicated Y types.
I began modelling some props to test out the object placing feature I implemented.
Of coarse you can just add the objects to the cube type prefab and place it manually.
You can also add them manually after the map has been generated.
Thanks, I have some cool stuff I want to show but are not quite done yet.
In the meantime let me show you guys this new feature I implemented.
You can now create "unique rooms" that can be randomly placed when the map is generated.
Here are two rooms I put together that are composed of the existing cubetypes and some props:
And here they are placed within the map:
Maybe it is an interesting read nevertheless?
http://procworld.blogspot.de/2011/03/writing-architecture.html
Thats correct. I am trying to refrain from using code from UnityEngine so that It wont be too hard to add support for Unreal engine 4 later on. Unity is scripted with C# while UE4 uses C++, so either I will have to translate the whole script or just release a standalone app which would output the map to a txt file.
@xXm0RpH3usXx
Nice, more grammars,, he makes it look so simple. Really cool stuff, perhaps I will attempt a cfg approach to generating the map in the future.
Some proposals feature-wise; sorry if it's been mentioned but this would do really well for manual editing.
A very effective way to break up the cube-ness is to have blocks split in half by 45 degrees, used for walls, floors(ramp) and ceilings.
There was a great thread on procedurally-generated content on TIGSource a while back (that I can't dig up at the moment but will try to later if no one else finds it) that went pretty deep (but in an understandable way) on this kind of stuff.
Nevermind, found it: http://forums.tigsource.com/index.php?topic=5174.0
Starts off very 2-D focused, but expands deeper into the thread.
Just thinking from a LD point of view, randomly generated stuff is great but if you could guide it's random generation from point A to B, I imagine that could boost its usability.
Awesome eitherway :thumbup:
Example:
Instead of having -
Orange, Orange Orange
Can you make -
Orange1, Orange2, Orange1
To break up the potential repeats in long straight areas? Or does the algorithm try to avoid these types of situations.
I've been making these things in my free time like, "One day a programmer will make a rule-based procedural with a node interface that can assemble all these into level designs on the fly for a Lore Rich Sci-fi RPG..."
Oh, hey, look! CDeniz just won my internet.
Very promising stuff.
Keep it up! Looks awesome!
Not sure I understand. Is it split from the bottom two adjacent corners to the top two adjacent corner opposite of the bottom pair?
Wish I saw this earlier, some really neat stuff there. Thanks.
Just a very basic gui atm:
Sounds cool, I will add that to the todo list. Thinking maybe generating across a specified curve.
Just finished implementing this, Im thinking of adding rulesets for these aswell. Such as:
Floor 0: only variant 1 types
Floor 1: only variant 2 & variant 3 types
ect.
C# for unity, and when I port it to UE4 C++. I'd like to put it up on the asset store, see how it does,, but who knows.
That looks great. I see why you wanted Y split pieces,, now that I think about it, you can create a Y split as a uniqueRoom, and they will be randomly generated. The current method will need a little work though, I will post a screen when I figure it out.
Awesome. Hopefully in a few months it will be ready for beta testing.
Not too much to show, been working on mostly under the hood stuff the past week. Here is another unique room I put together:
Like I mentioned above, you can now have multiple variants of each cube type:
I look forward to texturing these assets!
Again, mostly under the hood stuff, working on the gui, but you can now specify the combination of cube variants you want for each level.
Ex:
Variant 0 :: Level 0 & Level 1
Variant 1 :: Level 2
Variant 2 & Variant 3 :: Level 3
Also you can scale each level individually. Level 3 in this example is twice the size of the other levels.
Random level of the week:
Would it be possible to assign parameters for the procedural according to a mask? As in, taking a 2D image or 3D volume and using that specific shape to outline where rule set generates objects? Or the inverse?
That way, if you say, had the hull of a ship outlined, it would only generate within the outline, or if you had a cavern with rock pillars, you could outline where the pillars would deny the creation of meshes. That would be an excellent level design tool.
Should be possible, I'll add that to the todo list. I already implemented embedded maps (maps within maps), so it shouldn't be too hard.
there the file to download : https://dl.dropboxusercontent.com/u/14183130/naga_quest/naga_quest_level.rar
have fun !
This is great. It's making something extraordinary I want to do possible. I'd pay a great deal of money for a tool like this.
My only comment left after the Y ways and Volume Masks is: will there be a utility to quickly replace the stock assets with custom geometry?
A GUI would show a thumbnail of the piece when highlighted, and they'd have names like, [project initials][environment kit][hallway/room/corridor/middeck/exterior][middle/corner/1Way,2Way,4Way,YWay][Variant##]... Say, PB_Starship_Hall_1Way_02... along with their [N/D/S/E] Materials. That panel in conjunction with a quick import/export function, so a whitebox obj could be rapidly modifed and textured then just as rapidly replaced, updating the level, would revolutionize the approach I have to modular design.
Cheers
Thanks, I appreciate it.
I can definitely test it out for you, but you are going to have to arrange them into the five different cube types for me since I don't know what goes with each other.
So say you generate the map, and you want all cubetype variant 'q' to be replaced by cubetype variant 'p', is this what you are asking? I already implemented a 'swap' tool, that iterates through rhe cubetype variant that is selected,, should be easy to iterate for each cube of a given variant.
Clarify me if this is not what you had in mind.
Thanks. The prop placer is pretty basic, im still trying out other solutions.
So in addition to unique 'rooms', there is now the option for unique 'halls'.
The rooms which I showed in previous posts can be virtually anything, but they are characterized by having a single entrance since they are generated when one path wants to terminate. The unique halls are identical, except that they may have multiple entrances. The halls are generated when the path wants to grow, however if your hall has only one entrance then it will obviously terminate.
Like I mentioned in previous posts, practically anything can be created in terms of the five cubes:
Y split which has been requested
These don't have to be 'cube' like. Model out an actual 45 degrees bend, create curved spiral, ect.
Also I implemented a paint mode to give more control. You can quickly paint the cubes:
https://www.youtube.com/watch?v=6ZjtGfOIeEo
Edit: Someone embed for me, I cant figure it out.
Originally Posted by allaze-eroler
just wondering, can someone test with my 3D modular with this fantastic plugin ? i'm curious how good it's,
there the file to download : https://dl.dropboxusercontent.com/u/...uest_level.rar
have fun !
oh sure, i will try to make them as 5 rooms but you can check my thread about my game i'm working on : http://www.polycount.com/forum/showthread.php?t=103636 i think you will understand how it work, i haven't yet done with the other 3D model like doors, Window, lamp and treasure, all sort of stuff.
Yes and no. To clarify, it would swap out the model asset with new geometry imported from 3dsmax. It would just be a fast way to visually assess what variants are used for each cube type, and rapidly replace assets as the pipeline updates. That way we could grey-box, then go back and replace the grey box with finished assets, or update assets as they change.
Im working on new features, but in the meantime here is a preview to demonstrate outdoor maps.
I think I understand. If im not mistaken unity already does this. If you import a fbx or ma into unity, then edit them in maya/max later on it gets updated in unity as well. I'll need to verify if it does, and if it updates all the prefabs as well.
Ah, okay, so all the assets are loaded into Unity, THEN they're loaded into this script. That makes sense. Awesome!
The outdoor modular kit is pretty excellent! I had to use modular cliff faces here, and I've been planning modular cliffs ever since in my notebook:
http://media.moddb.com/images/mods/1/16/15844/ScreenShot508.1.jpg
http://media.moddb.com/images/mods/1/16/15844/ScreenShot492.jpg
http://media.moddb.com/images/mods/1/16/15844/ScreenShot376ver2.jpg
It isn't likely that the programme can also generate or interpret heightmaps, or if it is it'd be extremely taxing, but if the model generator could "pinch" the height plain to cover seams, that could really help create dynamic areas. It'd also be nice to see different levels of cliffs with terrain blended in at the edges or to create ramps with gradient slopes. That way the tops of every cliff don't need to be part of one instanced model, but can be varied with some kind of noise and procedural material, and players can navigate between levels freely at choke points.