Search Unity

CiDy 2.7 Procedural City Designer

Discussion in 'Assets and Asset Store' started by RecklessGames_, Feb 11, 2016.

  1. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    I will take a look and let you know when I have a solution
     
  2. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Its due to the Changes made for Detailed Mult-Lane Roads.

    I've submitted an Updated Package that solves the Issue, I expect it will be live within 24 hours for download.

    I'll update you on the forum when it is.

    Due to the Changes and the Addition of Multi-Lane Roads,
    You will need to change your Test Script to include some more Data.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using CiDy;
    5.  
    6. [ExecuteInEditMode]
    7. public class TestRoadCreationAPI : MonoBehaviour
    8. {
    9.     public float nodeScale = 50;
    10.     public float laneWidth = 3.6f;
    11.     public float dividerLaneWidth = 0;
    12.     public float shoulderSpacing = 1.6f;
    13.     public CiDyRoad.LaneType laneType = CiDyRoad.LaneType.TwoLane;
    14.     public CiDyRoad.RoadLevel roadLevel = CiDyRoad.RoadLevel.Road;
    15.     public int roadSegLength = 12;
    16.     public int flattenAmount = 0;
    17.  
    18.     public CiDyGraph graph;
    19.     public Transform[] userPoints;
    20.     public bool generateRoad = false;
    21.  
    22.     private void Start()
    23.     {
    24.         GrabGraph();
    25.     }
    26.  
    27.     //Update is called once per frame
    28.     void Update()
    29.     {
    30.         if (generateRoad)
    31.         {
    32.             generateRoad = false;
    33.             GenerateRoad();
    34.         }
    35.     }
    36.  
    37.     void GrabGraph()
    38.     {
    39.         graph = FindObjectOfType<CiDyGraph>();
    40.     }
    41.  
    42.     //Generate Road
    43.     void GenerateRoad()
    44.     {
    45.         //Debug.Log("Generate Road");
    46.         if (graph == null)
    47.         {
    48.             GrabGraph();
    49.         }
    50.         Vector3[] newKnots = new Vector3[userPoints.Length];
    51.         for (int i = 0; i < userPoints.Length; i++)
    52.         {
    53.             newKnots[i] = userPoints[i].position;
    54.         }
    55.         float calculatedRoadWidth = 0;
    56.         //Add Center and Shoulder Lanes to total Width
    57.         calculatedRoadWidth += shoulderSpacing;
    58.         calculatedRoadWidth += dividerLaneWidth;
    59.         calculatedRoadWidth += shoulderSpacing;
    60.         //Add Lane Count
    61.         switch (laneType)
    62.         {
    63.             case CiDyRoad.LaneType.TwoLane:
    64.                 calculatedRoadWidth += laneWidth * 2;
    65.                 break;
    66.             case CiDyRoad.LaneType.FourLane:
    67.                 calculatedRoadWidth += laneWidth * 4;
    68.                 break;
    69.             case CiDyRoad.LaneType.SixLane:
    70.                 calculatedRoadWidth += laneWidth * 6;
    71.                 break;
    72.             default:
    73.                 calculatedRoadWidth = shoulderSpacing + laneWidth + shoulderSpacing;//One Way only has Single Lane and Shoulders
    74.                 break;
    75.         }
    76.         //Debug.Log("Connect Nodes: " + calculatedRoadWidth);
    77.         //Input Values needed for Creating a Road from Preset Points.
    78.         //Vector3[] Knots, float calculatedRoadWidth, float laneWidth, float dividerLaneWidth, float shoulderWidth, float NodeScale, int RoadSegmentLength, int FlattenAmount, CiDyRoad.LaneType laneType, CiDyRoad.RoadLevel roadLevel
    79.         graph.CreateRoadFromKnots(newKnots, calculatedRoadWidth, laneWidth, dividerLaneWidth,shoulderSpacing, nodeScale, roadSegLength, flattenAmount,laneType,roadLevel);
    80.     }
    81.  
    82.     private void OnDrawGizmos()
    83.     {
    84.         if (userPoints != null && userPoints.Length > 0)
    85.         {
    86.             Gizmos.color = Color.yellow;
    87.             for (int i = 0; i < userPoints.Length - 1; i++)
    88.             {
    89.                 Gizmos.DrawLine(userPoints[i].position, userPoints[i + 1].position);
    90.             }
    91.         }
    92.     }
    93. }
    Thanks,
    Steven M.
     
    Last edited: Jan 14, 2021
  3. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126

    So do I need to use your updated code , and wait for the new package ?
     
  4. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Correct, It will be out of review within 24 hours.
     
    keithsoulasa likes this.
  5. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    Cool, while I'm here how do I generate the city on both sides of the road ?

    I can't stress how awesome your tool is !!
     
  6. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Current Version requires a Cell to Create Building lots.

    I have a prototype in the works for spawning lots regardless of cells. But its not quite ready for production.

    Thank you for your continued Support,
    Steven M.
     
    keithsoulasa and SirTwistedStorm like this.
  7. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
  8. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    The Update is Live in the Asset Store/Package Manager. :)

    Thank you for your continued Support,
    Steven M.
     
  9. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    Any way to make multiple cities in the same scene, I suppose I could just make them in separate scenes and then load them all in async
     
  10. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    I'm not sure what you mean.

    Different Graphs?

    You can setup Themes and sperate cities in the same scene, but each one using different themes all on the same single graph.

    In this 4 min video, I show creating two Separate City Layouts with different themes, in the Same Single Scene, with a GAIA Pro Created Terrain.



    I'm currently working on Adding Global Theme Settings as well. So you will be able to Setup Different Materials for Sidewalks & Roads based on Theme Choice.

    Next update will have these changes.

    Thank you for your continued support,
    Steven M.
    Reckless Games Studio
     
    Last edited: Jan 15, 2021
    keithsoulasa likes this.
  11. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    Maybe I'm missing something, but I get the road generated, but theirs's no city .

    upload_2021-1-16_0-18-58.png
     
  12. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Hey Keithsoulasa,

    Thank you for continued support.

    Currently, CiDy only generates Lots and Buildings when you enclose a Cell.

    There are new methods in the Works for Addings Buildings along single roads coming but currently its still cell based.


    Here are some tutorial to get you started.
    How to Setup CiDy in your Project.


    How to Use CiDy Spawners


    How to Setup Custom Themes.



    Thanks again for your continued support,
    Steven M.
    Reckless Games Studio
     
  13. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    Wait ,

    With your API example, couldn't I just modify that to add grid points instead ?
     
  14. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Using the API you can do quite a few things.

    I once did a test with a L-System.



    This was a Test with L-System and BuildR.



    :)

    Thanks,
    Steven M.
     
    Artexxxx and keithsoulasa like this.
  15. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Nothing to See Here Folks..... Just another Day in the Life of Editor tool Development. :)

    Simple Traffic System Integration is going very well..... eh... no problems. cough. cough

     
  16. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    CiDy and Simple Traffic System Combined allows for Fast Urban Design directly in Unity Engine.

    Integration Release should be Soon, I estimate 7 days.

    We are making final Adjustments for Best Results with Out of the Box Settings.

    Here is a Speed Run of me Making a Small Scene in only 30 Mins.

    Asset Store Links:
    CiDy 2
    https://assetstore.unity.com/packages/tools/level-design/cidy-2-55298?aid=1011l8fSb

    Simple Traffic System
    https://assetstore.unity.com/packages/tools/ai/simple-traffic-system-159402?aid=1011l8fSb

     
  17. SirTwistedStorm

    SirTwistedStorm

    Joined:
    Sep 20, 2015
    Posts:
    192
    Do you think it would be possible to allow users to import OSM data to create roads as an alternative?
     
  18. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Yes Its possible but the amount of work needed to clean the OSM data to work with CiDy is no small task.

    If you could convert the OSM data to a usable Nodes and Roads setup you could feed that data into CiDy through its API calls and Generate the City from it.

    But again it would not be a small task to take on.

    I'm sure there are going to be degen cases that will have to be dealt with for good General Results.

    I hope to tackle OSM data in the distant future.

    But I want to finish getting the Designer Aspects completed before I tackle Full Level Generation from a Preset of Rules or OSM Data.

    That way when I get to Doing full City generation, the core design and edit functions will already be working and will allow the designer to control fine details after the Generation does the Main Brush Strokes.

    Thank you for your Interest in CiDy.
    Steven M.
     
    SirTwistedStorm likes this.
  19. IvanAlvarez

    IvanAlvarez

    Joined:
    Apr 30, 2013
    Posts:
    9
    cant you move a node once its created? I can change the spline of roads but I don't seem to be able to move the node itself
     
  20. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Yes, Click on the Node, it will turn red. Then while holding the Activator Key (Shift) press Left click on a Terrain or Mesh defined with "Terrain" Layer and Tag.
     
  21. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    There are checks that will not allow you to move a node too close to another node or cause a connected road edge to overlap another edge.

    but other than that. You can just click and move
     
  22. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Click the Help Button at the top of the Editor Window to see the key inputs
     
  23. IvanAlvarez

    IvanAlvarez

    Joined:
    Apr 30, 2013
    Posts:
    9
    Thanks, how about STS? In your video you have some extra options in the CiDy Editor to configure it, but I don't see it on mine. I already installed STS and imported the CiDy 2 Integration package
     
  24. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Oh yes the Official has changed.

    To keep things more logical for our coding side of things.

    The Traffic Generation is inside STS.

    Feel Free to Join our Discord.
    https://discord.gg/5ErF9MU

    Here is the Official Way.
     
  25. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    First of all, amazing asset, love it..

    But i have a issue with clipping of the "foundations"
    I tried adjusting the Main camera, but no luck.

    I see the clipping in both Editor and runtime, any ideas what to check?

    upload_2021-2-12_14-44-1.png
     
  26. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    For any others following along,

    This was discussed on the Discord Server and we have solved the issue, It was due to the LODs, the Foundation was only on the First LOD, so it would pop in and out when the camera would leave the LOD Render Area.

    This change has been made and is currently in Unity Review, The solution now places the Foundation in all LOD's except Culling. :)
     
  27. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    im planning on purchasing the asset in a couple weeks but im not finding support for world streamer and was hoping it could be added.
     
  28. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    I do not have access to World Streamer, But my understanding is that it would work the same way as it would for any other pre built scene?

    Isn't world streamer a streaming system for Scenes?

    CiDy generates meshes and places prefabs in editor.


    So you use CiDy to create your scene and finalize the scene, then proceed to setup streaming of the scenes you created.

    Or am I missing something?
     
  29. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Correct but having to go through and make adjustments is a pain so having it set up where the system places the pieces already correct would be amazing. Cscape and easyroads3d both aren't integrated with streaming and can be very time consuming to go through and adjust. With Easyroads3d each road piece is at 0,0,0 so you have to go and adjust the pivot of each piece. Thats just one of the steps needed after post work
     
    RecklessGames_ likes this.
  30. miuulm

    miuulm

    Joined:
    Aug 8, 2018
    Posts:
    3
    Hey, great package! Is it possible to use the Cidy building _without_ generating streets? That would actually be very helpful for my use case.

    Kind regards
     
  31. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Not currently,
    But I am working on a rework of the project that will allow this to be possible in the future.
     
    miuulm likes this.
  32. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hi i just but Cidy and i followed the quick start up video on youtube but right click is not working to create the nodes, its literally doing nothing can you help me with this, I don't know what's happening.
     
  33. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    I was able to get it working just a little confusing in the video u say just to click rmb but i actually had to hold shift while right clicking, but glad its working thanks for the great asset.
    Oh i also tried the docs before posting but they are from a few versions back seems like...would be nice to have those updated when u can.
     
  34. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Yes, I have been working on a big update for the Package. I added a Help Button at the very top of the Editor Window.

    Alot has changed quickly after i made those tutorial videos.

    I understand your frustration, I will be working on updating the Tutorials Again after the Big update is out.

    Thank you for your Support,
    Steven M.
     
    Aaron2348 likes this.
  35. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Thanks for the quick reply and yeah that's totally understandable, I was also wondering have you thought about adding Like an alley creation feature?
    Currently it seems that the space in between buildings is not field would be nice to have like alleyways that can be generated differently per cell with some sort of a ground texture under too because the buildings basically just sit on top of the terrain, also was thinking how about props/prefabs that can be generated to be attached buildings,roof ie roof elements, fire scapes, balconies etc.
     
  36. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hey sorry but i also was thinking if u have not already done it for you big update you are working on, sometime in the near future if you could add the option to click and add nodes to a road segment that would be awesome!
     
  37. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Yes, all of those things are actually being addressed and are why this change is long over due. :)
     
    Aaron2348 likes this.
  38. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    This is Great news Im very happy to hear that, If u are able to implement everything i mentioned this would be by far the best City generator out.
     
  39. Wolpertinger-Games

    Wolpertinger-Games

    Joined:
    Mar 4, 2015
    Posts:
    19
    Hi @RecklessGames_! I recently purchased your package and have a very basic problem now:
    Shift-RMB does not work for placing nodes because Shift is not recognized as the "activator key" (it is bound to switch to orbit camera in the scene view (Unity 2021.1.0b10)).

    Can you consider exposing your custom controls to the (new) Shortcuts Manager to re-bind them or introduce some "tool toggles" in your editor window to toggle into a "hard" node placement tool to prevent any conflict with other hardcoded shortcuts?
     
    Bennidhamma2 likes this.
  40. Bennidhamma2

    Bennidhamma2

    Joined:
    Jan 5, 2019
    Posts:
    23
    Hi! Just purchased this, and very excited to get it going with my project. I'm using Gaia Pro with multiple tiles (I initially was using them in separate scenes, but saw that isn't supported.) I get this ominous message in the CiDy Editor pane:

    "--Active Terrains (Not Editable, Use Grab All Btn)--"

    And I can't seem to add nodes. Any ideas? I'm using CiDy 2.7.3, with Unity 2021.1b and GAIA Pro 2.2.3-c4

    thanks for any help.
     
  41. Bennidhamma2

    Bennidhamma2

    Joined:
    Jan 5, 2019
    Posts:
    23
    I don't see that binding in my shortcut manager, i think we're running the same version of Unity though. but... I definitely can't shift+rmb click to create a node.
     
  42. Bennidhamma2

    Bennidhamma2

    Joined:
    Jan 5, 2019
    Posts:
    23
    OK. Looks like the issue is that we needed to add symbol to the preprocessor directives. Basically, do a search and replace for:

    Code (CSharp):
    1. #elif UNITY_2019 || UNITY_2020
    with

    Code (CSharp):
    1. #elif UNITY_2019 || UNITY_2020 || UNITY_2021
    I found two references in CidyEditor.cs and I'm further along!
     
    cepoimario280135 likes this.
  43. Wolpertinger-Games

    Wolpertinger-Games

    Joined:
    Mar 4, 2015
    Posts:
    19
    Thanks, this fixed it, but I generally would recommend adding dedicated control buttons and modes to avoid conflicts with other plugins and editor tools
     
    Bennidhamma2 likes this.
  44. jouany

    jouany

    Joined:
    Aug 4, 2018
    Posts:
    19
    Hello !

    I think I found origin "index out of range exception index outside the bounds of the array" with option "blend city to terrain" from first sreenshot

    in fresh project using just Cidy with fresh terrain.
    Terrain size 1000*1000 works with "blend city to terrain"
    Terrain size 2000*2000 works with "blend city to terrain"

    But
    Terrain size 2000*1000 DOESN'T WORK with "blend city to terrain"
    Custom terrain size like 1882*1184 (screenshot) DOESN'T WORK with "blend city to terrain"

    Do you see a way to solve this problem as I used custom sized terrain ?

    Thank You
     

    Attached Files:

    Last edited: Mar 29, 2021
  45. tgentry

    tgentry

    Joined:
    Feb 11, 2013
    Posts:
    36
    Yes many of the terrain tools do not work with non square terrains. Path Painter and Digger both are like this. I use Real World Terrain to capture my locations for real world visualizations. I now make sure that they are square so I have no issues. Why is this, well I haven’t been told yet, so I just make sure the terrain is square.

    And I haven’t had any problems other than making sure I am no closer to zero in y than 100 units. Being too close to 0,0,0 is a problem too.
     
  46. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    tgentry is correct.

    The issue with Terrain Resolutions and the Terrains being squared (at least with CiDy) stretching and floating point issues start to become an issue causing false outputs and exceptions(You have experienced this), these issues can also affect programs that are trying to generate heightmaps and textures. CiDy also generates textures for masking and requires squared terrains.

    There may be a solution for this in a future update, but as it stands currently, squared terrains will behave more consistent for you.
     
  47. MegaMileyStudios

    MegaMileyStudios

    Joined:
    Aug 19, 2017
    Posts:
    72
    I found out about your asset this morning and it looks pretty neat! I have a couple questions though before I decide to purchase the asset

    In the tutorials it seems that only enclosed roads can support buildings, is there any way to have a straight open road support buildings as well with a float slider for up to how far away from the road they can be?

    Is there any way to draw a proper grid that has snapped nodes for city blocks? I like the fluidity of the tool but for some cases straight (and somewhat boring) roads/blocks are needed. In a perfect world it would work similarly to City Skylines road grid system (inside the editor, IIRC the editor doesn't work at runtime which is fine) but having access to the default snapping tools or ProGrids would be good enough

    Can the tool also support elevated roads like one of the highways in New York or Amsterdam that are above normal roads? And also the reverse, does it support tunnels? This is more a nice to have for me than a requirement :)

    How easy would it be to import Synty Studios assets for this tool? Would there be a ton of manual work or would most of it just work out of the box as long as you have the proper materials available? (the road materials will need a slight update as Synty uses UVs to position the road marker lines rather than having it baked into the texture itself)

    Is it possible to lock a certain building at a specific spot? Or instead have a specific spot be taken up by a different prefab and thus not have it try to generate anything in that place? This would allow me to place hospitals, police stations, fire stations, etc, in pre-determined locations rather than somewhere by chance

    Thanks!
     
    Last edited: Apr 4, 2021
    chol-ee likes this.
  48. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222

    The Current Released Version of CiDy 2 is still limited as you see in the current tutorial vidoes.

    https://www.youtube.com/playlist?list=PL8XbkWPNcpu0rcsomKnnel8AS97gDUX2-

    You are correct, Buildings are currently only supported for enclosed areas.

    Highways are not possible yet (Leveled Roads and On/off Ramps)

    No snap grid is implemented yet, its free hand placement. (Precise placement is not exposed yet)

    There are other City Generating Assets on the store as well, that may be more what your project needs.

    I am working on an Update/Re-write of the System to remove these previous limitations of design and adding features and content such as Highways and Tunnels/bridges, but this update is large and will take time.

    Let me know if you have any other questions. :)

    Thanks,
    Steven M.
     
    MrIconic and MegaMileyStudios like this.
  49. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    was wondering if anyone is having an issue with connecting the start and end node? it seems to just keep going for me
     
  50. RecklessGames_

    RecklessGames_

    Joined:
    Jul 30, 2010
    Posts:
    222
    Do you have compile Errors or console logs spitting out of CiDy?

    If not, Try increasing the Node Scale, You might be just missing it, make sure to be holding shift while executing the click.
    NodeScale.png