Announcement

Collapse
No announcement yet.

Hub_Layout Guide (by Laz Man)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hub_Layout Guide (by Laz Man)

    Hello guys,

    I have been doing some trial and error with the "Hub_Layout" property/attribute/method (within rwgmixer.xml file) and think I have figured it out for the most part. This property will allow you to specify the exact location of your prefabs and roads within a given cell. I plan to incorporate this code for my next version of TWDprison prefab but wanted to share my observations with the community so you guys can also create your own custom work. The following is my code (search for the keyword "prisonHub") and a graphical representation of the end product. Let me know if you have any questions

    Rule Set Code:

    - Insert the following highlighted code into your rwgmixer.xml ruleset group

    Code:
    <world ruleset="vanilla" />
    <rulesets>
    		<ruleset name="vanilla" cell_cache_size="16" cell_size="1200" cell_offset="0.8" generation_distance="10000">
    			
    			<cell_rule name="wastelandHub" position="0,0" prob="0.1"/>
    			<cell_rule name="lowDensity" prob="1"/>
    			<cell_rule name="highDensity" prob="0.5"/>
    			<cell_rule name="prisonHub" position="0,1"/>
    			
    		</ruleset>
    Cell Rules Code:

    - Insert the following highlighted code into your rwgmixer.xml cell_rules group.

    Code:
    <cell_rules>
    				
    		<cell_rule name="prisonHub">
    			<cave_count value="0,4"/>
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    			<hub_rule name="prisonHub"/>
    			
    			<wilderness_rule name="wildernessDefault"/>
    		</cell_rule>
    
    		<cell_rule name="lowDensity">
    			<cave_count value="0,4"/>
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    			
    			<hub_rule name="citySmall" prob="0.1"/>
    			<hub_rule name="ruralSmall" prob="0.5"/>
    			<hub_rule name="townSmall" prob="0.5"/>
    			
    			<wilderness_rule name="wildernessDefault"/>
    		</cell_rule>
    		
    		<cell_rule name="highDensity">
    			<cave_count value="2,6"/>
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    			
    			<hub_rule name="citySmall" prob="0.1"/>
    			<hub_rule name="ruralSmall" prob="0.5"/>
    			<hub_rule name="townSmall" prob="0.5"/>
    			
    			<wilderness_rule name="wildernessDefault" prob="1"/>
    		</cell_rule>
    		
    		<cell_rule name="wastelandHub">
    			<cave_count value="0,0"/>
    			
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    			
    			<hub_rule name="citySmall" /> 
    			
    			<wilderness_rule name="wildernessDefault" prob="1"/> 
    		</cell_rule>
    </cell_rules>

    Hub Rules Code:

    - Insert the following highlighted code into your rwgmixer.xml hub_rules group.

    Code:
    <hub_rules>
    		<hub_rule name="ruralSmall">
    			<hub_type value="rural"/>
    			<width value="96, 96" />
    			<height value="96, 96" />
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    
    			<prefab_rule name="townSmall" prob="1"/>
    		</hub_rule>
    		
    		<hub_rule name="townSmall">
    			<hub_type value="town"/>
    			<width value="100, 200" />
    			<height value="100, 200" />
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    
    			<prefab_rule name="townSmall" prob="1"/>
    		</hub_rule>
    		
    		<hub_rule name="townLarge">
    			<hub_type value="town"/>
    			<width value="200, 250" />
    			<height value="200, 250" />
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    
    			<prefab_rule name="townLarge"/>
    		</hub_rule>
    		
    		<hub_rule name="citySmall">
    			<hub_type value="city"/>
    			<width value="414,828" />
    			<height value="414,828" />
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    
    			
    			<prefab_rule name="wastelandHub" prob="1"/>
    		</hub_rule>
    		
    		<hub_rule name="none">
    			<hub_type value="default_hub"/>
    			<path_material value="asphalt" /> 
    			<path_radius value="7" />
    			
    			<prefab_rule name="none"/>
    		</hub_rule>
    		
    		<hub_rule name="prisonHub"> 
    			<hub_type value="town"/>
    			<hub_layout name="prisonHub"/>
    			<prefab_rule name="townSmall"/>
    		</hub_rule>
    </hub_rules>
    Prefab Rules Code:

    - Insert the following code into your rwgmixer.xml prefab_rules group.

    *IMPORTANT* It is mandatory to assign the prefab to a group even if you don't plan on referencing it. Not doing so will cause error messages.

    Code:
    	<prefab_rule name="UniquePOIs">
    		<prefab rule="TWDprisonRWG"/>
    	</prefab_rule>
    Hub Layout Code:

    - Insert the following code into your rwgmixer.xml hub_layouts group.

    Code:
    <hub_layouts>
    	<hub_layout name="prisonHub">
    		<township_type value="town"/>
    		<street start_point="-50,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
    		<street start_point="-50,144" end_point="128,144" path_material="asphalt" path_radius="7"/>
    		<street start_point="-28,7" end_point="-28,133" path_material="gravel" path_radius="4"/>
    		<street start_point="110,7" end_point="110,133" path_material="gravel" path_radius="4"/>
    		<lot min_x_y="-23, 133" prefab="TWDprisonRWG" rotation_to_road="3"/>
    	</hub_layout>
    </hub_layouts>
    Example rwgmixer.xml and prefab files:

    https://www.dropbox.com/s/4ysvnley2n...rison.zip?dl=0

    Last edited by Laz Man; 12-27-2015, 07:41 AM.

    #2
    With this code, unique set pieces can be hand crafted and inserted into Random Gen smoothly (im looking at you Woodbury, Hershal's Farm and Terminus )

    Comment


      #3
      Are you basically creating streets around your prefab, with the last code?

      Comment


        #4
        This is awesome, can't wait to have a bash. I had success with kinyajuu's method using the custom hub test and your previously posted layout code in that thread. I was never able to replicate the code so I could free up the custom hub test but after I redid my mixer when V8 compo pack was released even the hub test refused to play nice. I was never able to duplicate my original success even with seemingly (*rolls eyes*) identical code.

        Thats why I started testing the idea I mentioned with the cityblocks, I have a feeling I may drink many beers in your honour after this!

        Comment


          #5
          Is the cell size large enough to accommodate the larger hub size? I had issues with that size of hub with a default cell size. Just recommending (if you haven't already) that you create various seeds and have it at multiple positions. I had to go to a cell size of 1400 to get a hospital to generate seamlessly.



          Vote h0tr0d 2016 -- where the streets have no name

          Comment


            #6
            Originally posted by Guppycur View Post
            Are you basically creating streets around your prefab, with the last code?
            That's correct. The streets can be independantly of different material and width and also can be diagonal. In my sample I added 4 roads in a square (2 asphalt, 2 gravel).

            - - - Updated - - -

            Originally posted by h0tr0d View Post
            Is the cell size large enough to accommodate the larger hub size? I had issues with that size of hub with a default cell size. Just recommending (if you haven't already) that you create various seeds and have it at multiple positions. I had to go to a cell size of 1400 to get a hospital to generate seamlessly.



            Vote h0tr0d 2016 -- where the streets have no name
            Good idea HR, I will run it through a few seeds to test. The seed in the example was perfect, 3 roads connected to the prefab smoothly. Word of warning regarding custom streets, if you make the streets to long or short you may get some strange elevation drops where it connects to other streets.

            You will have to play around with it to find the sweet spot.
            Last edited by Laz Man; 09-18-2015, 11:47 PM.

            Comment


              #7
              Yup, that is exactly what I had with a hospital at 0,-1 and a cell size of 1200. Road dropped 5 blocks and continued. made the cell 1400, and seamless transition.



              Vote h0tr0d 2016 -- the road less traveled.

              Comment


                #8
                Very very awesome information Laz

                I didn't played around much with custom-hubs and cells yet. U guys know I had other works to do !!!
                But now that I surly know it works - Iam very excited to add all the big Prefabs to the COMPOPACK again.

                And with that it seems we are in the next level of Town-designing guys.

                When now also TFP will smoothn the landscapes around the hubs - we have made a big positive step to the maps we wanna see.


                ty Laz for this information
                this is mindblowing to me right now. My head explodes from the mass of ideas I got right now

                Mag

                Comment


                  #9
                  FYI, I think using the position value and leaving the prob value out of the prisonHub ruleset effectively made it unique to the world. Meaning no, duplicate spawning anywhere else.

                  I tested this by omitting out all other cells from the code except the prisonHub and following each road leaving the prison. Each road would end at the end of the cell and I'd get some type of cell generation null error. Will need to do more testing to be 100% sure. If this is true, server admins can define unique set pieces throughout their worlds.

                  For example, I could set my prison at cell (0,5) and Woodbury at cell (3,5) and terminus at (-1,8). *evil grin*

                  Comment


                    #10
                    I'm struggling to make this method work, been at it all morning.

                    I keep getting a: 'KeyNotFoundException: the given key was not present in the dictionary'
                    followed by my old friend: 'NullReferenceException: Object reference not set to an instance of the object.'

                    The only modification I've made is changing the prefab name in the hub layout to xcostum_TWDprison_v1(by_Laz_Man)a12_v2 as I'm using the compo pack, not the individual download.

                    I even pulled out a vanilla rwg.mixer incase I have dropped errors into my current one. Can't help but feel I've missed something obvious >.<

                    Comment


                      #11
                      Originally posted by Laz Man View Post
                      Hello guys,

                      I have been doing some trial and error with the "Hub_Layout" property/attribute/method (within rwgmixer.xml file) and think I have figured it out for the most part. This property will allow you to specify the exact location of your prefabs and roads within a given cell. I plan to incorporate this code for my next version of TWDprison prefab but wanted to share my observations with the community so you guys can also create your own custom work. The following is my code (search for the keyword "prisonHub") and a graphical representation of the end product. Let me know if you have any questions

                      Rule Set Code:
                      Code:
                      <world ruleset="vanilla" />
                      <rulesets>
                      		<ruleset name="vanilla" cell_cache_size="16" cell_size="1200" cell_offset="0.8" generation_distance="10000">
                      			
                      			<cell_rule name="wastelandHub" position="0,0" prob="0.1"/>
                      			<cell_rule name="lowDensity" prob="1"/>
                      			<cell_rule name="highDensity" prob="0.5"/>
                      			<cell_rule name="prisonHub" position="0,1"/>
                      			
                      		</ruleset>
                      Cell Rules Code:
                      Code:
                      <cell_rules>
                      				
                      		<cell_rule name="prisonHub">
                      			<cave_count value="0,4"/>
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      			<elevation_range value="50, 80" />
                      
                      			<hub_rule name="prisonHub"/>
                      			
                      			<wilderness_rule name="wildernessDefault"/>
                      		</cell_rule>
                      
                      		<cell_rule name="lowDensity">
                      			<cave_count value="0,4"/>
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      			
                      			<hub_rule name="citySmall" prob="0.1"/>
                      			<hub_rule name="ruralSmall" prob="0.5"/>
                      			<hub_rule name="townSmall" prob="0.5"/>
                      			
                      			<wilderness_rule name="wildernessDefault"/>
                      		</cell_rule>
                      		
                      		<cell_rule name="highDensity">
                      			<cave_count value="2,6"/>
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      			
                      			<hub_rule name="citySmall" prob="0.1"/>
                      			<hub_rule name="ruralSmall" prob="0.5"/>
                      			<hub_rule name="townSmall" prob="0.5"/>
                      			
                      			<wilderness_rule name="wildernessDefault" prob="1"/>
                      		</cell_rule>
                      		
                      		<cell_rule name="wastelandHub">
                      			<cave_count value="0,0"/>
                      			
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      			
                      			<hub_rule name="citySmall" /> 
                      			
                      			<wilderness_rule name="wildernessDefault" prob="1"/> 
                      		</cell_rule>
                      </cell_rules>

                      Hub Rules Code:
                      Code:
                      <hub_rules>
                      		<hub_rule name="ruralSmall">
                      			<hub_type value="rural"/>
                      			<width value="96, 96" />
                      			<height value="96, 96" />
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      
                      			<prefab_rule name="townSmall" prob="1"/>
                      		</hub_rule>
                      		
                      		<hub_rule name="townSmall">
                      			<hub_type value="town"/>
                      			<width value="100, 200" />
                      			<height value="100, 200" />
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      
                      			<prefab_rule name="townSmall" prob="1"/>
                      		</hub_rule>
                      		
                      		<hub_rule name="townLarge">
                      			<hub_type value="town"/>
                      			<width value="200, 250" />
                      			<height value="200, 250" />
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      
                      			<prefab_rule name="townLarge"/>
                      		</hub_rule>
                      		
                      		<hub_rule name="citySmall">
                      			<hub_type value="city"/>
                      			<width value="414,828" />
                      			<height value="414,828" />
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      
                      			
                      			<prefab_rule name="wastelandHub" prob="1"/>
                      		</hub_rule>
                      		
                      		<hub_rule name="none">
                      			<hub_type value="default_hub"/>
                      			<path_material value="asphalt" /> 
                      			<path_radius value="7" />
                      			
                      			<prefab_rule name="none"/>
                      		</hub_rule>
                      		
                      		<hub_rule name="prisonHub"> 
                      			<hub_type value="town"/>
                      			<hub_layout name="prisonHub"/>
                      			<prefab_rule name="townSmall"/>
                      		</hub_rule>
                      </hub_rules>
                      Hub Layout Code:
                      Code:
                      <hub_layouts>
                      	<hub_layout name="prisonHub">
                      		<township_type value="town"/>
                      		<street start_point="-50,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
                      		<street start_point="-50,144" end_point="128,144" path_material="asphalt" path_radius="7"/>
                      		<street start_point="-28,7" end_point="-28,133" path_material="gravel" path_radius="4"/>
                      		<street start_point="110,7" end_point="110,133" path_material="gravel" path_radius="4"/>
                      		<lot min_x_y="-23, 8" prefab="TWDprisonRWG" rotation_to_road="3"/>
                      	</hub_layout>
                      </hub_layouts>
                      I am getting keyexception errors with this :-(.

                      I copied it exactly as well :-(. Isnt there spose to be a bit that goes in the prefab_rules or. cause thats the only thing i see different between this one and the other post. But I can not find twdprison in the game when i try that 1 lol urgh what i do wrong :-/

                      Here is my output.log - https://www.dropbox.com/s/5p6l2vq1vs...t_log.txt?dl=0

                      Here is my RWGMixer - https://www.dropbox.com/s/en39971vqy...mixer.xml?dl=0

                      Comment


                        #12
                        Great work Laz, I'm using 3 of your prefabs (TWD Prison, Brownstones, Autoparts Store) along with the TWD mod running on "Malworld" -- great stuff and it'll only get better with this.

                        I was reading this and thinking, "Hey, now there could be a prefab made of a road location like where Sophia went wandering off in the first season -- that 'fits in' to the road network"

                        Consider walking along the roadway and seeing a scene like this :

                        http://2.bp.blogspot.com/-o19MQh4hIk...1318792822.png

                        http://bloody-disgusting.com/photosi...jpg&w=600&zc=0

                        https://cmgajcradiotvtalk.files.word...ad-highway.jpg

                        Comment


                          #13
                          Originally posted by Laz Man View Post
                          FYI, I think using the position value and leaving the prob value out of the prisonHub ruleset effectively made it unique to the world. Meaning no, duplicate spawning anywhere else.

                          I tested this by omitting out all other cells from the code except the prisonHub and following each road leaving the prison. Each road would end at the end of the cell and I'd get some type of cell generation null error. Will need to do more testing to be 100% sure. If this is true, server admins can define unique set pieces throughout their worlds.


                          For example, I could set my prison at cell (0,5) and Woodbury at cell (3,5) and terminus at (-1,8). *evil grin*
                          Yes, using the position and only having the prefab attached to it makes it unique. I believe I covered this somewhat here: https://www.youtube.com/watch?v=psqP3xmLJHM

                          Just a suggestion: make the prison generate a good distance from center. Once I understand 13.0 and make all the changes I'm going for one major city at 0,0 and nothing else. Then try large prefabs like this further out in the boonies because you wouldn't normally see one near the city, or withing 5km in my experience. Not a respectable city anyway.


                          Originally posted by Slaan View Post
                          I'm struggling to make this method work, been at it all morning.

                          I keep getting a: 'KeyNotFoundException: the given key was not present in the dictionary'
                          followed by my old friend: 'NullReferenceException: Object reference not set to an instance of the object.'

                          Spoiler: 
                          The only modification I've made is changing the prefab name in the hub layout to xcostum_TWDprison_v1(by_Laz_Man)a12_v2 as I'm using the compo pack, not the individual download.

                          I even pulled out a vanilla rwg.mixer incase I have dropped errors into my current one. Can't help but feel I've missed something obvious >.<

                          Let me see your output_log.txt and rwgmixer.xml please.

                          Originally posted by stallionsden View Post
                          I am getting keyexception errors with this :-(.

                          Spoiler: 
                          I copied it exactly as well :-(. Isnt there spose to be a bit that goes in the prefab_rules or. cause thats the only thing i see different between this one and the other post. But I can not find twdprison in the game when i try that 1 lol urgh what i do wrong :-/

                          Here is my output.log - https://www.dropbox.com/s/5p6l2vq1vs...t_log.txt?dl=0

                          Here is my RWGMixer - https://www.dropbox.com/s/en39971vqy...mixer.xml?dl=0
                          Looks like it has to do with your hub/cell layout, taking a look. I see quite a few custom prefabs I am unfamiliar with, rather complex rwgmixer.

                          Code:
                          KeyNotFoundException: The given key was not present in the dictionary.
                            at System.Collections.Generic.Dictionary`2[System.String,Prefab].get_Item (System.String key) [0x00000] in <filename unknown>:0 
                            at HGHubLayout.generateLots () [0x00000] in <filename unknown>:0 
                            at HGHubLayout.Init () [0x00000] in <filename unknown>:0 
                            at HubCell.GenerateDetails () [0x00000] in <filename unknown>:0 
                            at RandomWorldGenerator.GetBiomeCellByWorldPos (Int32 _seed, Single x, Single y, Boolean _generateDetails) [0x00000] in <filename unknown>:0 
                            at RandomWorldGenerator.GetBiomeCellByWorldPos (Single x, Single y) [0x00000] in <filename unknown>:0 
                            at ChunkProviderGenerateWorldRandom.GetSpawnPointList () [0x00000] in <filename unknown>:0 
                            at GameManager.GetSpawnPointList () [0x00000] in <filename unknown>:0
                          Have you tried adding a probability to this?




                          Code:
                           <cell_rule name="prisonHub" position="0,1"/>
                          Remove the elevation_range from this below, unless someone can explain why it is in there? I would look at the elevation_ranges and find what is 50,80, and add that biome to the prefab.xml.

                          Code:
                              <cell_rules>
                                  <cell_rule name="prisonHub">
                                      <cave_count value="0,4"/>
                                      <path_material value="asphalt" /> 
                                      <path_radius value="7" />
                                      <elevation_range value="50, 80" />


                          What version of the prefab editor are all of you using individually?


                          If you want me to take a look I shall!


                          Vote h0tr0d 2016 -- I'm stuck in Folsom Prison

                          Want me to take a look?
                          Last edited by h0tr0d; 09-19-2015, 05:15 PM.

                          Comment


                            #14
                            As far as elevation ranges you have this stallions:

                            Code:
                            <biome_spawn_rule name="plains">
                                        <elevation_range value="20, 60" />
                                    </biome_spawn_rule>
                                     
                                    <biome_spawn_rule name="forest"> 
                                        <elevation_range value="60, 100" />
                                    </biome_spawn_rule>
                            But have the prison in elevation 50-80 which crosses 2 biomes. Could this be an issue?

                            Code:
                             <cell_rules>
                                    <cell_rule name="prisonHub">
                                        <cave_count value="0,4"/>
                                        <path_material value="asphalt" /> 
                                        <path_radius value="7" />
                                        <elevation_range value="50, 80" />

                            Try making the prison 60,80 or change your biomes so forest is 50,100.


                            You also have negative values in the hublayout:

                            Code:
                             <hub_layouts>
                                 
                                <hub_layout name="prisonHub">
                                    <township_type value="town"/>
                                    <street start_point="-50,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
                                    <street start_point="-50,144" end_point="128,144" path_material="asphalt" path_radius="7"/>
                                    <street start_point="-28,7" end_point="-28,133" path_material="gravel" path_radius="4"/>
                                    <street start_point="110,7" end_point="110,133" path_material="gravel" path_radius="4"/>
                                    <lot min_x_y="-23, 8" prefab="TWDprisonRWG" rotation_to_road="3"/>
                                </hub_layout>
                                </hub_layouts>
                            While having it at this position:

                            Code:
                            <cell_rule name="prisonHub" position="0,1"/>
                            There are no negative values in region 0,1. Could this cause issues? Or are those values relative to the prefab and not the in-game coordinates?


                            And to clarify Laz:

                            Originally posted by Laz Man View Post
                            FYI, I think using the position value and leaving the prob value out of the prisonHub ruleset effectively made it unique to the world. Meaning no, duplicate spawning anywhere else.
                            Leaving the probability out is not what makes it unique. What makes it unique is if the prefab rule which contains the prefab rule. If that prefab rule only applies to the hub rule and cell rule for that cell, it is unique.

                            Code:
                            		
                            		<cell_rule name="prisonHub">
                            			<cave_count value="0,4"/>
                            			<path_material value="asphalt" /> 
                            			<path_radius value="7" />
                            			<elevation_range value="50, 80" />
                            
                            			<hub_rule name="prisonHub"/>
                            			
                            			<wilderness_rule name="wildernessDefault"/>
                            		</cell_rule>
                            Code:
                            <hub_rule name="prisonHub"> 
                            			<hub_type value="town"/>
                            			<hub_layout name="prisonHub"/>
                            			<prefab_rule name="townSmall"/>
                            		</hub_rule>

                            This confuses me, what are the prefabs inside this?

                            Code:
                            <prefab_rule name="townSmall"/>
                            You essentially have given it two prefab rules, once which includes townsmall buildings and the other the prison layout. Couldn't you remove the townsmall prefab rule? Or create its own prefab rule specifically for that hub?





                            Vote h0tr0d 2016 -- elevate your expectations
                            Last edited by h0tr0d; 09-19-2015, 05:30 PM.

                            Comment


                              #15
                              Leaving the probability out is not what makes it unique. What makes it unique is if the prefab rule which contains the prefab rule. If that prefab rule only applies to the hub rule and cell rule for that cell, it is unique.
                              Sorry, I meant this:

                              Leaving the probability out is not what makes it unique. What makes it unique is if the prefab rule which contains that particular prefab is tied only to one hub_rule and one cell_rule. If your prion prefab rule applies nowhere else, then bueno.



                              Vote h0tr0d 2016 -- we don't make the rules, we make the rules you make better.

                              Comment

                              Working...
                              X