Home Technical Talk

Modular builder script

polygon
Offline / Send Message
CDeniz polygon
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:
uJbamQq.png
8uG5YNB.png
sm6GnBg.png

You can increase the minimum number of cubes:
b67ewZi.png
Ehh13Iq.png

You can go crazy if you want:
fn5EZMj.png
58dhtxk.png

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:
prBs9KT.png
jPKS6O4.png

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

  • CDeniz
    Offline / Send Message
    CDeniz polygon
    I added a lot of new features, mainly inverted maps (the negative space of the randomly generated map), and embedded maps (generate maps randomly inside a randomly generated map). Im in the process of implementing a feature that randomly generates objects inside each cube.

    I also began modelling some simple modular pieces and quickly generated this random map:
    The modular components
    ENpj3Bv.png

    Randomly generated map
    YNvxBgb.png
    m0xRC9z.png
    wFkA2xy.png
    Seems to handle large maps pretty well so far, hopefully I wont have to implement my own data structures anytime soon.
    SLR7AsD.png
  • Eric Chadwick
    This is very cool!

    I stumbled across this wiki awhile back, some of the topics might help you.
    http://pcg.wikidot.com/pcg-algorithm:dungeon-generation
  • jdp092
    Offline / Send Message
    jdp092 polycounter lvl 4
    This is looking great, I'm interested to see what results you get once completed! It's something I've been interested in doing for a while to test the usability of my art as I love building modular kits etc and now that I've seen your take on it I'm excited to finish my current project so I can play around with the concept. Anyway, keep up the great work and I'll be subscribing to the thread for future updates!
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    This is fantastic!

    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.
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    @perna
    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.
    5M8ofSX.png
    GLEsoZ1.png
    MnQkJ4K.png

    Of coarse you can just add the objects to the cube type prefab and place it manually.
    Fd4F0FW.png

    You can also add them manually after the map has been generated.
    OjY7p0b.png
  • pwnguin
    Great work! I can't wait to see more.
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    @pwguin
    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:
    zjYnyX9.pngrgReTc1.png

    And here they are placed within the map:
    axGk2F7.png
    LyZZIIL.png
    kMgChW5.png
  • xXm0RpH3usXx
    Offline / Send Message
    xXm0RpH3usXx polycounter lvl 13
    I dont know how relevant this is for you, as i unfortunatly am not so good at scripting /etc.
    Maybe it is an interesting read nevertheless?
    http://procworld.blogspot.de/2011/03/writing-architecture.html
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    @perna
    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.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    Just popping in to say this is fantastic looking! I can imagine alot of uses for it, especially with the current craze of random generation. Keep at it!
  • AimBiZ
    Offline / Send Message
    AimBiZ polycounter lvl 14
    Want to give some praise as well. Very impressed by this.

    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.
  • abmurray
    This...this is extremely relevant to my interests. Nice work!

    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.
  • PeterK
    Offline / Send Message
    PeterK greentooth
    Pretty fantastic stuff!
  • Mask_Salesman
    Offline / Send Message
    Mask_Salesman polycounter lvl 13
    Very cool. To influence the direction it generates towards, have you thought about or implemented something like objective landmarks?
    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:
  • Gannon
    Offline / Send Message
    Gannon interpolator
    I didn't see it mentioned as I read some of the comments but is there the possibility of variants?

    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.
  • Shanthosa
  • deadpixl
    Offline / Send Message
    deadpixl polycounter lvl 9
    I need to subscribe to this, this would be perfect for a project I'd like to do in the future.
  • dissonance
    What language/program are you writing this in? Do you plan on opensourcing it at any point?
  • killnpc
    Offline / Send Message
    killnpc polycounter
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    I'm really excited for this script. I've been atom smashing some modular kit pieces together using Joel Burgess's & Tor Frick's lessons, combined with my own nutty experiences since last October, and I've whiteboxed a ton of pieces to use with a script just like this.

    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.
  • Skiffy
    Offline / Send Message
    Skiffy polycounter lvl 15
    This is very interesting stuff indeed. If this ever gets into alpha / Beta for unity for other folks to test count me in. I would be curious to see this in the Asset store as an extension.

    Very promising stuff.
  • pheonix561
    Gorgeous work! I've been interested in seeing how games in unity are developed lately, so seeing someone undertake a project like this is always inspiring.
  • badmouse
    Offline / Send Message
    badmouse polycounter lvl 8
    A video of this in action will be cool! great work pal!
  • Christian Nordgren
    Offline / Send Message
    Christian Nordgren polycounter lvl 11
    Rougelikes <3

    Keep it up! Looks awesome!
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    I appreciate all the feedback guys. Sorry for the late reply, I started summer courses last week so my hands are a little tied.
    AimBiZ wrote: »
    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.
    Not sure I understand. Is it split from the bottom two adjacent corners to the top two adjacent corner opposite of the bottom pair?
    abmurray wrote: »
    Wish I saw this earlier, some really neat stuff there. Thanks.
    Hugh wrote: »
    pretty neat design images on the first images. How is the tool pallet looking?
    Just a very basic gui atm:
    QHMErxR.gif
    Very cool. To influence the direction it generates towards, have you thought about or implemented something like objective landmarks?
    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.
    Sounds cool, I will add that to the todo list. Thinking maybe generating across a specified curve.
    Gannon wrote: »
    I didn't see it mentioned as I read some of the comments but is there the possibility of variants?
    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.
    dissonance wrote: »
    What language/program are you writing this in? Do you plan on opensourcing it at any point?
    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.
    Thaiauxn wrote: »
    I've been atom smashing some modular kit pieces together using Joel Burgess's & Tor Frick's lessons, combined with my own nutty experiences since last October, and I've whiteboxed a ton of pieces to use with a script just like this.
    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.
    Skiffy wrote: »
    This is very interesting stuff indeed. If this ever gets into alpha / Beta for unity for other folks to test count me in. I would be curious to see this in the Asset store as an extension.
    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:
    hI53pXF.png
    wT6vpHM.png
    Like I mentioned above, you can now have multiple variants of each cube type:
    98HnKWc.png
    I look forward to texturing these assets!
  • ARX71
    wow this is very cool, can't wait to see this finish :)
  • Mark Dygert
    Just when I think you're done, you add more cool stuff. =)
  • Redsett
    Offline / Send Message
    Redsett polycounter lvl 4
    Wow man, this is really great. Should do very well in the asset store.
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    Thanks guys, perhaps a few more features and a little optimization and it will be ready for beta testing. Here is this weeks update:

    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
    S1jDCjS.png
    Variant 1 :: Level 2
    6Ps2FrF.png
    Variant 2 & Variant 3 :: Level 3
    NFOKQQV.png
    rFmCFcm.png

    Also you can scale each level individually. Level 3 in this example is twice the size of the other levels.
    oJUL0Po.png

    Random level of the week:
    DFWpdRd.png
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    This just keeps getting more fantastic.

    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.
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    Thaiauxn wrote: »
    This just keeps getting more fantastic.

    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.
  • Lucas Annunziata
    Offline / Send Message
    Lucas Annunziata polycounter lvl 13
    HNNNNNNNNGGGHH! This is super cool! Wheres the UE4 port!?
  • AbominableSoul
    This is fantastic! keep it up :D
  • allaze-eroler
    Offline / Send Message
    allaze-eroler polycounter lvl 11
    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/14183130/naga_quest/naga_quest_level.rar

    have fun !
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    CDeniz wrote: »
    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.

    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.

    POLYCOUNT%2520COMENT.jpg

    Cheers
  • Syros
    Offline / Send Message
    Syros polycounter lvl 11
    This is supper fantastic, very handy, very nice, I liked also the prop placer, great job man, keep up the good work. \m/
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    CDeniz wrote: »
    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.
    I still have to port it, but I am developing it in a way to make porting as quick and easy as possible.
    This is fantastic! keep it up :D
    Thanks, I appreciate it.
    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/14183130/naga_quest/naga_quest_level.rar

    have fun !
    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.
    Thaiauxn wrote: »
    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
    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.
    Syros wrote: »
    This is supper fantastic, very handy, very nice, I liked also the prop placer, great job man, keep up the good work. \m/
    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
    PCv6HGP.png
    sZ0B7ql.png
    32toBqk.png
    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.
  • allaze-eroler
    Offline / Send Message
    allaze-eroler polycounter lvl 11
    Quote:
    Originally Posted by allaze-eroler viewpost.gif
    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 !

    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.

    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.
  • mzprox
    Offline / Send Message
    mzprox polycounter lvl 5
    Very nice, I'd like to have this tool.. for UE4.
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    Originally Posted by CDeniz

    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.


    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.
  • CDeniz
    Offline / Send Message
    CDeniz polygon
    Ughh, busy with my summer courses,, should lighten up towards the end of of July.

    Im working on new features, but in the meantime here is a preview to demonstrate outdoor maps.
    krSMmBe.png
    rmy7uUF.png
    8q16fUJ.png

    Thaiauxn wrote: »
    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.
    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.
  • Skiffy
    Offline / Send Message
    Skiffy polycounter lvl 15
    Lovely. Yeah I think this will be on my wishlist / buy list if and when it hits the Unity asset store one day.
  • Thaiauxn
    Offline / Send Message
    Thaiauxn polycounter lvl 7
    CDeniz wrote: »
    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.
Sign In or Register to comment.