Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

ByChance Level Generator

Discussion in 'Assets and Asset Store' started by npruehs, Feb 6, 2014.

  1. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey everybody,

    after a year of hard work it's finally live!

    ByChance for Unity allows you to provide an infinite amount of unique levels for both 2D and 3D games of all genres. Generate complex levels including all of their game components and apply useful post-processing algorithms afterwards in order to ensure a great gaming experience.

    Features

    • Infinite Game Worlds. Let ByChance generate unique levels in no time for you and focus on more important parts of your game such as quest design and boss encounters instead.
    • Workflow the Unity way. Prefabs, custom editors, handles and native Undo/Redo - ByChance feels like home for every Unity developer.
    • No scripting required. Create and customize your preferred level generator just by attaching scripts and using inspectors.
    • Powerful But Simple. ByChance is easy to learn and extend. Our goal is to enable you to control the level generation process while providing a clear interface that is easy to handle.
    • High Flexibility. Tweak the probabilities of your level modules and adapt the difficulty of your levels to the player’s behavior, or generate them based on parameters specified by the players themselves.
    • Proven concept. ByChance uses the same approach for generating game levels as successful games like Torchlight and Infinite Mario Bros.
    • Webplayer Showcase. Test ByChance online with the Angry Bots Infinite showcase.
    • Full source access. Inspect the whole ByChance source code in order to improve the interoperability of your game with the framework.
    • Verbose documentation. Manual PDF, verbose warnings and graceful error handling help you developing with ByChance.
    ByChance for Unity works in both Unity Free Pro.

    Screenshots

    Chunk Template



    Level Generator



    Support


    Extending ByChance for Unity

    If you want to dive deeper into ByChance and access its core functionality, the level generation algorithm itself is open source. There's also a public API documentation for you to browse.

    Showcase

    Finally, when you’re finished creating your awesome game with ByChance, we’d love to hear from you and feature your showcase!
     
    Last edited: Dec 5, 2015
  2. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey folks,

    we're pleased to announce that ByChance 1.1 is now available on the asset store! ByChance is now fully compatible with Unity 5, and a new tag manager prevents you from ever misspelling or mixing up tag names.

    Take a look at the full release notes:

    Features
    • Chunk libraries are stored as scriptable objects instead of prefabs now. This improves the overall memory footprint of the framework.
    • New tag manager provides easy access to all anchor and context tags. Scripts that are related to tags in any way now provide dropdown menus instead of textboxes for selecting tags. Users can specify the color illustrating contexts and anchors in the scene view.

    Improvements
    • ByChance scripts are accessible from the Add Component menu.
    • Assigning reasonable default values for context alignment, chunk template extents and level generator properties.
    • Removed chunk template creation window, and created simple shortcut for turning a game object into a chunk template.

    Bug Fixes
    • Showing correct chunk extents in the scene view, even if the chunk is scaled in any dimension.
    • Correctly computing the extents of an object, even if it is rotated in any direction.
    The manual has been updated to reflect all of these changes. As always, don’t hesitate to drop by at our issue tracker or ask a new question!

    Don't forget: If you're making a game with ByChance, we'd love to feature your game!
     
    SAOTA likes this.
  3. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey everybody!

    ByChance 1.2 is now available on the asset store, including full 2D support!

    Take a glimpse at the full release notes:

    Features

    Added full support for automatically generating 2D levels! Turn sprite renderers into chunks, and benefit from additional editor support such as automatically rotated contexts while in 2D editor mode.

    Improvements
    • Providing single buttons for adding centered contexts.
    • Automatically computed bounds are never zero in any dimension to prevent infinite level generation.
    • Reduced context and anchor sphere handle size in scene view. Moved labels up a bit in order to increase readability.

    Bug Fixes
    • Correctly re-setting chunk context indices whenever a context is removed.
    The manual has been updated to reflect all of these changes. As always, don’t hesitate to drop by at our issue tracker or ask a new question!

    Also, we're happy to announce a new game has been added to our showcase section! If you're making a game with ByChance as well, we'd love to feature you!



     
  4. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    And here goes our first video tutorial! Feel free to let us know what you think :)

     
  5. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey boys and girls!

    ByChance 1.3 can now be acquired at the asset store, allowing you to generate levels directly in the editor! This way, you can pump out a whole lot of levels, polish them and include them in your final game.

    OfflineLevelGeneration.png


    There's also been a bugfix affecting chunk rotations.

    The manual has been updated to reflect all of these changes. As always, don’t hesitate to drop by at our issue tracker or ask a new question!

    Don't forget: If you're making a game with ByChance, we'd love to feature you!
     
  6. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Now, here it goes: Our second video tutorial! Learn how to fill your level with game objects like enemies and items, apply post-processing to improve their overall quality, and generate the same levels again using seeds.

    As always, feel free to let us know what you think :)

     
  7. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    This looks interesting, can you post videos that approximate the results in your screenshots, with 3d rooms?

    Also what I'm looking for is a system that can approximately fill a space with a given footprint, typically an office building where upper floor entry be based around an elevator /stairs 'core'. Would your algorithm account for that?
     
  8. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey lazygunn,

    generating 3D levels like the ones in the screenshots will work exactly like the 2D levels shown in the videos. There showcase used to create the screenshots is available at the showcase section at our website. As I'm no artist, I was forced to abuse the assets of the Angry Bots demo that come along with the Unity Editor, but you'll get the idea :) Also, I can point you to the public manual so you can understand how the workflow demonstrated in the videos applies to 3D levels as well. Recording a video with the above quality would take quite a while, but feel free to ask any additional questions that might come up.

    When generating levels, you may explicitly specify the first chunk of your level , see the "Setting the First Level Chunk" section of the manual. Providing full layouts to be filled is not yet supported, because finding a clean and user-friendly way of specifying arbitrary layouts is not trivial. However, I can explain to you how to set the position of the initial chunk as well, if you need it to be the same across all levels.

    Cheers!
    Nick
     
  9. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hello again!

    ByChance 1.4 is out now, with a whole lot of new requested features finally implemented - including level difficulty ramping, lock-key-puzzles and more.

    Screenshot - Generated Level.png

    Here are the full release notes:

    New Scripts
    • Maximum Chunk Count. Finishes level generation after a certain amount of chunks has been added.
    • Required Chunk. Chunks that are required for valid levels.
    • Required Chunk Count. Minimum total chunk number required for valid levels.
    • Restricted Chunk. Prevents a chunk from being placed until a specific anchor has been added to the level.
    Features
    • Custom termination conditions allow you to stop the level generation before all level space is filled.
    • Custom chunk distribution allows you to override the default random chunk selection, for example for adding rooms with increasing difficulty to the level, scaling by distance from the level start.
    • Custom chunk pre-conditions prevent a specific chunk to be added to the level unless an arbitrary condition holds, for example for adding locked doors only after the matching key has been added.
    • Custom validation rules reject a generated level and have the generator start over, requiring a level to have a minimum number of chunks, for instance.
    Improvements
    • Configuration scripts don’t need to be put on the level generator game object any more, but may be put anywhere below it.
    • Increased performance in the case a level is rejected and a new one is generated with the same configuration.
    • Chunk template anchors are added at random initial positions within the chunks instead of the center so they’re more easily moved around in the scene view.
    Bug Fixes
    • Correctly checking whether 3D chunks fit the depth of 3D level bounds.
    As always, the public manual has been updated to reflect all of these changes. Don’t hesitate to drop by at our issue tracker or ask a new question any time!

    Clearly, if you're making a game with ByChance, we'd love to feature you!
     
    Last edited: Dec 5, 2015
  10. aurel_unity

    aurel_unity

    Joined:
    Jun 21, 2015
    Posts:
    18
    Hi !
    we are using DunGen right now, it's great, but we have a huge problem with the prefabs it generates. You can't modify the result later because of the classic nested prefabs Unity issue and it's becoming a nightmare. We are considering to purchase your asset, but we would really need to be sure it handles prefabs as great as it seems in the description.

    Could you confirm we could update the original chunks prefabs and then apply the changes on all levels ? Or would we have to go the insanely painful "Prefab Evolution" way again ?

    Thank you very much for your time!
     
  11. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey Aurel :)

    I don't have any experience with DunGen, but I can surely explain how it works in ByChance:
    • You create one prefab per level building block (room, floor, ...) containing the basic geometry such as walls, windows, torches, ambient crates etc.
    • You create prefabs for connections between these building blocks (doors, ...)
    • You create prefabs for everything else you want to spawn randomly in these rooms (enemies, treasures, etc.)
    Within ByChance configuration scripts, you specify which door, enemy, treasure prefabs to spawn for which rooms, floors, ..., thus avoiding the nested prefabs problem (to some extent).

    You can update both your chunk prefabs and your item prefabs at any time.

    If unsure, you can always take a look at the manual: http://www.levelsbychance.com/unity/manual.pdf section Anchors (currently page 7).

    Are you planning to generate your levels at run-time (while the game is loading or running), or at design time (in the Unity editor, before starting the game)?
     
  12. aurel_unity

    aurel_unity

    Joined:
    Jun 21, 2015
    Posts:
    18
    Thanks a lot for your quick answer!

    We build levels at design time, then finetune them. So, for now we have some scenes containing all the rooms, and each room is a prefab. Our problem is: if there is an "chair " prefab in a "room" prefab, it won't be updatable later because it becomes a nested prefab. So it ruins everything.

    People using random level generators for levels made at design time are all stuck with this issue right now, sadly. (And use prefab evolution, which allows nested prefabs but is an no more updated asset)
    Which makes all other asset I purchased unusable for a real game production, since you always update your objects during the developement so it gets better and better.

    Your asset seems to be made in a different way, so there is hope!
     
  13. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Yeah, generating a level will instantiate both the room prefab and the chair prefab, in your example. Updating both should be fine, just verified it with a very basic example in Unity 5.3 :)
     
  14. aurel_unity

    aurel_unity

    Joined:
    Jun 21, 2015
    Posts:
    18
    Niiiiiiice.

    That's very good news. Thanks a lot for checking it. Pretty sure we will switch to your asset and give it a try after the next milestone in a few days.

    Thanks again for your time, much appreciated!
     
  15. mrleon

    mrleon

    Joined:
    Sep 27, 2014
    Posts:
    18
    Great asset! I have a two questions:

    1) Is it possible to define where the initial chunk is positioned? For example, I would like for my initial chunks to always begin at the most top right corner of my level. How would I go about doing that?

    2) Is it possible to also set an 'ending chunk', I would like to have a special room for the last chunk that gets placed. Ideally it'll also be nice to be able set it so it's always the most bottom chunk.

    Basically I'm making a maze that always starts at top right and I want the last room to be different and as far from the top as possible.

    Thanks for your help
     
  16. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey mrleon!

    Unfortunately, both isn't possible out of the box. Here are some pointers:

    1) In ByChanceLevelGenerator.cs, replace line 323

    Code (CSharp):
    1. this.level.SetRandomStartingChunk(chunk3D, this.random);
    by something like this

    Code (CSharp):
    1. this.level.SetStartingChunk(chunk3D, new Vector3F(1, 2, 3));
    2) Right now, it's now possible to specify an ending chunk, nor its position. You can specify that the special room needs to be placed for valid levels, see chapter Required Anchors of the manual. If you need more special behaviour, refer to the chapter Extending ByChance for Unity in the manual to get you started.

    The manual is available here: http://www.levelsbychance.com/unity/manual.pdf
     
  17. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    855
    I've had this in my cart for awhile but I will be buying it in couple days (I am just finishing researching other purchases I'll be making at the same time.) Anyways, I had a question.

    This is designed to create levels, which is something that I think would be immensely useful for my needs but I would like to know if a prefab itself (not just an entire level) could utilize ByChance. So I place a prefab and the prefab generates contents. That allows me to scatter ByChance content created prefabs throughout a level (for example, in my landscape.) Is this possible? Could this be added in a future update? A potential positive side effect of this is chunks could include generated content (Inception style, lol.) Hopefully I'm making sense. If not I could explain further is needed.
     
  18. jimmy_doodle

    jimmy_doodle

    Joined:
    Nov 8, 2015
    Posts:
    22
    Good job. Looks very solid!:)
     
  19. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Basically, that depends on the type of "content" you're referring to :) Are we talking about the same type of content generation ByChance already does (e.g. filling anchors with other prefabs)?
     
  20. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    855
    I know my post sounded very convoluted so I apologize for that. :)

    So, let's say I am using a dynamic terrain generator like Magic Map and I want to randomly drop prefabs (such as animals or enemies) but I want to also drop prefabs that are actually ByChance dynamically generated content (let's say, a building.) Each time the prefab is placed a new ByChance generated building is created.

    Hopefully, that's clearer. :)
     
  21. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    855
    Basically, my confusion is whether I can have more than one instance of a dynamically generated level per scene.
     
  22. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey Steven! Sorry for the late reply - I wasn't home yesterday.

    Sure, you can generate as many "levels" per scene as you'd like! Putting "level" in quotes here because you actually hit the nail on the head: If you understand each single building as a "level", there's absolutely no problem with having ByChance generate the individuals floors of the building, for example. You can decide whether to use the same level generator for each building, or different ones.

    There is no "singleton" approach in any part of ByChance. You can have as many generators as you'd like.
     
    StevenPicard likes this.
  23. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    855
    Awesome! That's great news.
     
  24. PixelPounder

    PixelPounder

    Joined:
    Feb 11, 2014
    Posts:
    56
    In your description it says, "Online and offline level generation. Generate levels without having to enter play mode, and pump out hundreds of levels and polish them before shipping - or generate levels while the game is running."

    Does that mean we can during the development phase generate a random level/scene... save it... edit it and then do it again for another level and so on and so forth... delete the generated levels we dont like and then use the ones we do? Rather than have them all random at run time when a player starts the game or level?
     
  25. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Yep, that's exactly what it means :) See page 11 of the manual for details.
     
  26. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Hi when i compute Extents form renderers
    Pivot it's not take in count

    http://puu.sh/yrXHt/9d986da943.jpg


    2:
    About Allow Chunk Rotation It's possible to get on Y only ?
     
    Last edited: Nov 23, 2017