Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ProWorld - Procedural World Generation

Discussion in 'Assets and Asset Store' started by tertle, Oct 4, 2012.

  1. GamePowerNetwork

    GamePowerNetwork

    Joined:
    Sep 23, 2012
    Posts:
    257
    -- sorry wrong topic --
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Sorry everyone it's taking longer than expected, but I decided to make the entity (tree, rocks etc) algorithm a lot more powerful.

    Apart from what I previously talked about, it now also uses density maps


    (Not just developer preview, map won't look like that)

    Gives it a much more realistic look with areas of emptiness.
     
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Looking good : )
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Anyone interested in testing the latest version
     
  5. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    I am interested in testing the latest version :)

    EDIT:

    Just bought ProWorld - I could not help myself.

    I am generating terrain like a kid in the candystore!

    I also stumbled across a bug. Here is what the console shot out at me.

    I am using unity Unity 3.5.7

    Windows Seven 64 bits.

    If you need more information let me know :)
     
    Last edited: Jan 9, 2013
  6. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Of course : D
     
  7. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Sent you both a link with a preview build from about a week ago.
     
  8. MortalMan

    MortalMan

    Joined:
    Nov 6, 2012
    Posts:
    25
    Yes, I'm VERY interested..

    I'm running windows 7 64 bit, Unity 3.5.6f4
     
  9. Dunfee

    Dunfee

    Joined:
    Jan 14, 2013
    Posts:
    14
    Just bought this over the weekend. I'm having a lot of fun messing around with it. Looking forward to the future of this project!
     
  10. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Ok, I have a public test version version available for people to try out. It's quite a bit more advanced than the version I sent out a few days ago to a few select people.

    http://bovinelabs.com/proworld/

    Please Note:
    -This is a developer version. This means it may have bugs, is not feature complete and may have weird debug messages etc.
    -It does not allow applying to terrain or output anything. This version won't let you use it to generate terrain.
    -It is not backwards compatible. Install it in a fresh project, don't replace your current version.
    -Right click does stuff.
    -I know entity previews don't work yet
    -Cliff doesn't work exactly as I'd like
    -Readme hasn't been updated.
    -No support provided.
     
    Last edited: Jan 17, 2013
  11. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Any difference from the closed beta version, should i dl this instead? Did not have time to test it out yet : (
     
  12. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Yes. There are a lot of new things in this one.
     
  13. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    What exactly are we supposed to do with it, then?
     
  14. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Btw, you should really do a feature freeze and try to get this one out before adding more stuff : )

    PrimeDerektive: Check out the new features and give feedback of course : p

    Edit: List of stuff i noticed from testing:
    -Erosion don't seems to work as it should? Gives very strange results i think
    -Cliffs don't work either at all?
    -Checkbox to get the water height in meter would be cool i think, that way its easier to match the water plane.
    -Tree placement did only work with one of the lowest terrain layer on your test world, the other only had a black square in the "Create entity group" window.
    -There is a long delay when going from the tree adding window back to the layer window before i can select a layer again.
     
    Last edited: Jan 17, 2013
  15. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    It's a preview if you're interested. If not ignore it. I wasn't looking to making it publicly available.

    Oh yeah forgot to mention I don't like errosion, it tends to leave flat areas. Going to implement some another one which I think is much better, but takes a little longer to compute. In other version i sent you it was disabled but I now generate node list automatically so it appears.
    I did say cliff doesn't work (well it works, but it's a bit messy and you can't control height)
    Trees is now based off texture. If you haven't placed textures you can't place trees. I'm contemplating this, but it allows you to put different types of trees in say muddy areas etc which is really nice.

    As for feature freeze, I've kind of already decided what I'm going to do:
    -Add better erosion
    -Fix entities to handle tree removal from multiple layers (currently it doesn't do hit detection between layers)
    -Fix cliffs
    -Add real-time preview (so it'll automatically apply heightmap to a terrain while you change it etc, this is toggled because will cause a little lag.
     
    Last edited: Jan 17, 2013
  16. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    I've finally added areas. This is something that is extremely important if you were creating a large world so that it doesn't all look the same.
    It lets you define different rules for different areas of the world which are then blurred together. You can create coast lines, towns, mountain ranges areas for swamps etc.

    http://i.imgur.com/F89oaGD.png
    http://i.imgur.com/fAaIVjP.png

    You may also see that I have real-time terrain updates working as well. If you toggle the button when you change stuff in ProWorld it'll automatically apply to any terrain you have selected. This way you can get real-time previews in 3D to really see how it looks.

    I'm not trying to add many new features at the moment as I want to release this as soon as possible, but getting areas was a core reason for the rewrite.

    I'm pretty close to releasing this all through the asset store, I just need to make sure it's all tested since it's not just adding features it was a total rewrite.

    -edit-

    easy coastline http://i.imgur.com/lzBAq8h.png
     
    Last edited: Jan 23, 2013
  17. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    1.1 should be out this week assuming I can figure out a few workarounds.

    The reason it's taken so long is I haven't had as much time as I expected (though I've worked really hard on it in the past week) and there were many small issues that have arisen I didn't expect. A few of the most recent stuff.

    -I'm still struggling with fixing a bug when a user changes scene in the editor. When this happens Unity loses all references (at least in 3.6 which I still want to support) of textures causes an error. I'm struggling to find a way to detect when the user actually changes scenes. I can check the name of the scene which works fine the problem is if 2 scenes the same name, this comes up mostly when the scene hasn't been named yet and the string name is empty.

    -I've had to write some BuildProcessor for when building your application and running the scene. I needed to find a way to copy files to the output etc without writing my own build pipeline as that doesn't work in the free version which I want to support.

    I've also been working on a bit of feedback, for example

    This was caused because every window rebuilt everything it needed every time it was loaded and trees rely on terrain and textures so it had to rebuild everything. I've now made it so it only rebuilds everything when you load the main window and not when you're in sub windows. Overall everything is much faster.

    Like I said, hopefully it's out this week assuming all goes well. It's not as feature complete as I wanted but I need to get it out for you all.
     
  18. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Looks awesome, just as expected : )
     
  19. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Was in prosess of submitting to asset store when I realized I forgot to add support for water so I'm quickly writing that and should submit it later tonight, might take a few days to appear up though.

    For the meantime, here is the final preview (excluding auto water!)

     
  20. Jasper-Hesseling

    Jasper-Hesseling

    Joined:
    Jul 27, 2009
    Posts:
    34
    Bought it tonight and gave it a spin. It's a real joy to work with! Would love to see some grass and rock support and maybe a voronoi node would be nice. Overall great job already can't wait to see the next versions.
     
  21. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    a really powerful voronoi noise is included in 1.1 (under the name of cell noise) so wait for update later this week when it's approved and you shall have!
     
  22. Jasper-Hesseling

    Jasper-Hesseling

    Joined:
    Jul 27, 2009
    Posts:
    34
  23. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Was not a simple voronoi already included in the 1.0 release?
    Finally waiting is soon over : D
     
  24. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    For anyone considering purchasing, price is increasing to $25 in a day so get it while it's cheap!

    There are few things to know about the next release. For starters I've actually decided to call it 2.0 instead of 1.1 because well it's a complete rewrite so I thought i deserved a major release increase.

    -Firstly, unfortunately I haven't been able to make it backwards compatible (because it's a full rewrite). All future versions will be and if you have old worlds you want to use I've bundled 1.0 in a .zip file for you to use. I'm in process of implementing full importing (currently you can only do terrain) so you'd be able to import a world you've generated previously if you need.

    -Second, there are a couple of features missing that'll I'll implement in small releases in next week or so that I didn't get around to finishing but I needed to release it as it's been way delayed. I've temp disabled cliffs while I work on a new algorithm for slopes as I wasn't happy with what was being generated and I didn't get around to converting the presets over so I'll do that as soon as possible. I have a few more I can implement now as well.
     
  25. Jasper-Hesseling

    Jasper-Hesseling

    Joined:
    Jul 27, 2009
    Posts:
    34
    Looking forward to it. Not that I am expecting a whole worldbuilder in your package but take a look at this clip and you might get some nice ideas for nodes. http://www.youtube.com/watch?v=p0o3bqoM0Qg Maybe you've seen it.
     
  26. ChadH

    ChadH

    Joined:
    Aug 28, 2012
    Posts:
    101
    Looking forward to release ;)
     
  27. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    2.0 approved! Tutorial coming very soon.

    You'll most likely need to do a clean update (delete the proworld folder) because it's been restructured a lot.

    Please let me know of any problems so I can fix them asap!
     
  28. sacha

    sacha

    Joined:
    Oct 29, 2012
    Posts:
    22
    Quick test: i did an island using those nodes:
    simple -> fbm -> level -> cutoff -> output. The output window shows an island but the preview shows nothing close to the output result like i expected.
    I only did those steps
    1) add nodes
    2) switching to proworld main panel.

    Thanks
     
  29. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Can you take a picture? Of the node page and the main page when complete.
    Or even better just save the .pw file and upload that.

    I just used the defaults of those nodes and the result looked as I expected (though wasn't close to an island so I assume you've used some custom values).
     
    Last edited: Feb 18, 2013
  30. sacha

    sacha

    Joined:
    Oct 29, 2012
    Posts:
    22
  31. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Ok, seems to be a completely unrelated issue. I see an exception has been thrown in your debug bar.

    I thought I had fixed that specific one but obviously under certain causes I haven't so I'll look into it. Thanks for the report.
     
  32. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    I have a problem with the smooth node, nothing seems want to attach to its input : /
    The one in your mountain example works but if i place a new one it wont work. All other nodes seem to work ok.
    Keep up the great work, fantastic release : D

    Edit: Getting some severe texturing artifacts when trying to run it in "runtime" mode, single terrain when doing the normal generation worked great.

    $TextureProblems.png
     
    Last edited: Feb 19, 2013
  33. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Smooth/FBM/Erosion nodes all need to be fed from a noise function (or from each other). This is because they use neighboring points to generate their output and if weren't fed from a noise function would not match between terrain. It's a bit annoying but you can usually get the same effect as putting it just before output.
    I did experiment with the alternative of blurring between terrain instead but with things like erosion it caused some really unwanted effects along the edges. My tutorial video, hopefully out in a few days (had a few technical issues) details all nodes and quirks like this.

    As for the texture "artifacting" I've never seen that before and looks really weird. It's like a texture has gone missing or hasn't been set in the world builder or something. I'll experiment a little to see if I can reproduce it. If you'd like to upload the .pw file it might help.

    Regarding my previous post about that exception being thrown I'm still working on it, but I'm struggling to reproduce it. I saw it on rare occasion when developing but thought I had fixed it up. I think it has something to do with the temp saving. If you happen to run into it, from memory I believe you could fix it starting new then reloading.
     
    Last edited: Feb 20, 2013
  34. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    @tertle

    I cann't work on your plugin without a video tutorial, those nodes I cann't get them to work properly, so I'm waiting for your video tut.

    Thank you
     
  35. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    It should be here within 2 days.
     
  36. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ok, that explains the Smoothing thing, its a bit sad that i cnat do i final smoothing but its possible to solve anyway so no problems : )
    I will attach .pw file so you can have a look at it, its actually just a modification to your mountain.pw file.

    View attachment $test.zip
     
  37. Whistle

    Whistle

    Joined:
    Feb 23, 2013
    Posts:
    8
    So uh... it's been four days. Also, is there a way we can save the generated terrains? I know that they'll be generated the same each load, but it'd be a good way to reduce CPU usage at the expensive of disk/memory usage. Also, is there a possibility of using different generation based off of distance? Like for making terrain progressively more *blank* as it gets further away? Or west=*blank1*, east=*blank2*? Because randomly generated terrain does us no good if we can't add things into it or change it to our needs. So far it's working flawlessly though! Totally worth the price!

    EDIT: And by saving terrain data, I mean the option to have it saved. Or at least changes, et cetera. Some kind of flag to where we can tell unity to save the most recent 3x3 grids (9 square kilometers in my case) to hard drive/storage so we can at least reduce startup time upon load.

    Which brings me to my next point: Could you possibly make (I can do this myself of course but it won't be inline with your cleanup script) it to where the script has an accessible "current cells active) so we could integrate making gameobjects active while those cells are active?

    EDIT 2: I've gone through your code, and it's fairly well commented. I'm just a novice coder, and I can't figure out how to add random rotation of placed trees! Can we get this as a feature? As well as maybe a random scale range, too? Maybe even random X/Y/Z ranges too, in case we have full 3d boulders, or want some trees slightly canted.
     
    Last edited: Feb 25, 2013
  38. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Sorry I found a bug while recording the tutorial (it's quite obvious when you come across it, look at area node, spherical option if you want check it out) and I went cycling all weekend so I didn't get around to fixing it. I'm recording the last part now.

    Yes that's what the area node does in a way. You can change how the terrain behaves after a certain point.
    Unfortunately the map editor doesn't have an easy way of shifting so it's hard to see outside of the 0,0 square. Adding the ability to move around now.

    For

    I assume that's for real time generation? In which case yes I probably should have a property for current active cells.

    Better yet I'll add an interface so you can tap into my workers and add your own (I was meant to do this can't believe I forgot, it's really easy to add for me)

    So you'd just Inherit from this class

    Code (csharp):
    1.  
    2. public abstract class Worker : ISerializable
    3. {
    4.         // stuff matters
    5.         public abstract void Generate(object sender, DoWorkEventArgs e);
    6.         public abstract bool Apply(WorldData data, DateTime startTime, double duration);
    7. }
    Then you'd just put all code that can be run in a separate thread inside Generate.
    WorldData is sent in the argument
    This gives you access to info about the World, what cell it is, the terrain heightmap, all entity and texture data etc.

    Then you'd put all stuff that needs to be run in unity primary thread (ie. actual gameobject creation etc).

    I'll add a clean method to this as well so you can do custom cleanups. I have to finish this tutorial today, and I have an interview tomorrow so I'll try get this done in rest of week for you.


    As for saving terrain pre-generating terrain, that's actually a really good idea and would greatly reduce load times. I don't think it'd be that hard to implement but I'll have to look.
     
    Last edited: Feb 25, 2013
  39. Whistle

    Whistle

    Joined:
    Feb 23, 2013
    Posts:
    8
    You're freaking amazing, man! I'm running through your code, trying to familiarize myself with how it works. Also I noticed either the rendering or the generation doesn't prioritize the 'current' cell, at least what I'd consider the current cell by which one the linked object is in.

    As far as saving pre-generated terrain saving, I've been researching that on my own a bit, but am unfamiliar with (as I'm sure you absolutely ARE) how terrain data is held in memory, IE what properties or variables each cell of terrain uses upon generation, (height, slope, basically everything your script already uses to generate terrain). Here's the most relevant link I found: MSDN Link

    Also, could there be an easier way to tag certain generated entities to not be regenerated upon each ... well, terrain regeneration? Something along the lines of "place this tree here once, but since a player chopped it down (replaced it with a trunk), don't generate it again? Or does your current box-collider check in the entity generator script detect ALL of them, or just ones for the entities it is placing?

    EDIT: Re-read your post again, and thought I'd clarify after experimenting a bit as far as "Could we have generation change based off of original distance/reference distance:

    Could we have 'zones' of generation that change layers, nodes, textures, and everything? With maybe a way to blend them? Like pipe the output of one world into another or something? So I could have a 'swamp' region, a 'forest' region, and mix and match them?
     
    Last edited: Feb 25, 2013
  40. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Firstly a side note to something somewhat relevant previously said, I actually started working on different quality settings - you can see the start of this in the tree editor and quality setting, which for lower qualities reduces trees that don't have colliders.

    Anyway I apologize for my lack of comments if you're reading through my code! I do at least try to name things in a way that makes sense.

    Anyway adding areas to texture/trees was close to top of my to do next list as area for just terrain doesn't really get the desired effect.

    Prevent certain trees from regenerating is a bit problematic because it's only stored as an algorithm and regenerated each time but it is deterministic so I could probably store a list of changed trees and check when generating and change the behavior. Interesting idea, but I have other priorities atm,

    As for storing terraindata, one problem with unity is you can't serialize anything from unity. Not even structs like vector3/rect etc (hence I wrote my own simple vec3/rect classes to serialize). If you just want to pre-generate terrrain before compiling that's easy enough but I assume you want to store the players current location while playing, save the terrain around him and load that when next playing. I could manage that just by serialzing my WorldData class which already stores all the important terrain info while generating. Even compressed the files might be largish though: 10-20mb per terrain, so if you had 9 terrain might be 150mb, or if you had more significantly larger. There's a reason games like minecraft had such large save files. It would be significantly faster to load though.

    As a side note, I currently have an event you can use for first load to handle load screens.
     
  41. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Keep up the great work, it looks fantastic!
     
  42. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    This is a very specific case and should probably be implemented by the user of the system, i think ProWorld is a great tool and should be kept pretty "wide", same with most systems, they give you a base and all the specific features has to be implemented by the end user.

    RapeWhistle: Doing rotation on trees is not possible when using Unitys terrain engine, its a built in restriction. If you want that you have to place the trees as standard models and that will have a big impact on performance instead. What you can do is to add the same tree in maybe 4 different rotations as different assets and this way get different rotations.

    tertle: Did the file i attached help any with finding the cause of the strange texturing bug?
     
  43. Whistle

    Whistle

    Joined:
    Feb 23, 2013
    Posts:
    8
    Gotcha. This has been an extremely educational learning experience! And I know that serializing data within unity has to be done a special way, and I don't mind doing that. As far as rotated trees, I'll have to make my own workaround and use virror's suggestion in the meantime. Tertle... again, your support is freaking amazing, as is your tool!
     
  44. Whistle

    Whistle

    Joined:
    Feb 23, 2013
    Posts:
    8
    Also, WorldBuilder.cs is throwing a ton of errors whenever I compile, but not when I playtest. The errors I get during playtesting are 'splatdata=null' for terrain 0. No idea what's going on.

    EDIT: Fixed it... lots of googling, and then just figured out it needed:

     
    Last edited: Feb 26, 2013
  45. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    That's actually a good point and if I fix it up so you can implement your own workers no reason a user couldn't add their own method to remove/replace certain trees.

    Maybe. I fixed a bug but it wasn't exactly what your screenshot posted so I'm still searching to make sure (i've fixed around 5-6 bugs since last build, 3 that were found while recording this stupid tutorial!)

    Power cut out for 4-5hours today was quite frustrating (just after getting home from an assessment.) Tutorial is uploading at the moment though (about to head to sleep). Hopefully it completes fine and I'll link it in morning. While I have fast download speeds, my upload is terrible.

    Haha oh that's a good bug find. It's because I use resharper to clean up code and since the WorldBuilder works different in editor compared to run time it didn't realize that System.IO was actually required at runtime.

    ie. in editor it just sets the world using a [PostProcessScene] flag but for runtime it loads it from a file.

    Thanks for spotting that. I'll push a fix for that + the other misc stuff tomorrow (takes about an extra day for Unity to verify an update though)
     
    Last edited: Feb 26, 2013
  46. wrussell

    wrussell

    Joined:
    Feb 26, 2013
    Posts:
    15
    Is the new tutorial for this resource likely to be ready soon? I can't work out how to apply my proworld stuff to a terrain object, and I have yet to see anything actually render in anything other than a very broken-looking way. I doubt this is any fault of the tool - it will just be my ignorance of Unity and how to use plug-ins like this. So some more documentation would be great - even a normal-speed, larger version of the demo video would be very helpful (the double-speed one is too small for me to see the detail of anything being clicked)

    Thanks...
     
  47. Whistle

    Whistle

    Joined:
    Feb 23, 2013
    Posts:
    8
    Wrussell, I've figured out this myself, so I feel your pain. As an in development tool, there's a learning curve. But luckily I'll simplify this for you, with my easy to read instructions!

    Step 1: Import the Proworld package!
    Step 2:Create a Terrain via Terrain>Create terrain
    Step 3: Open ProWorld editor via Window>ProWorld>ProWorld
    Step 4: Create or Load one of the existing terrains!
    Step 5: Apply this to the terrain you've created, if it doesn't work, sometimes making sure you have a water type selected under the first screen helps. In the "Apply" menu, make sure you drag the terrain from the layout to the "terrain" box underneath the 'Selection' button. If you already have your terrain highlighted you can just hit 'Selection'.
    Step 5a: If you want randomly generated terrain as you walk, apply the world you saved to a character controller, then hit apply. Under that character controller you can now customize how many cells are loaded away from it via slider.

    Not extremely well written, but it should help you get started.
     
  48. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    Sigh nothing is going well for this video. Got up and was notified my video was too long for youtube so I've spliced it in 2 and reuploading at the moment, reuploading at the moment. -edit- oh I can just verify account to upload longer. Doing that!

    You are bug finding machine. That shouldn't happen should apply perfectly if you have no water selected so fixing this at the moment. -edit- fixed. Will fix 1 more bug I've been meaning to get to then upload new version.
     
    Last edited: Feb 27, 2013
  49. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,752
    It's finally up



    I haven't had chance to sit through and watch it all to check there's any issues with the upload but I have to head out swing dancing right now so I'll have to do it when I get back. Hopefully it's fine.

    I'm no good at explaining things so hopefully it makes enough sense. Also I had a few issues with audio, for instance half the video recorded at a different level for some reason which I've had to tried normalize but I just checked and it doesn't seem good enough so I'm going to upload a new copy.
     
    Last edited: Mar 26, 2013
  50. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Keep up the great work, don't stress yourself to much ; )