Announcement

Collapse
No announcement yet.

Easy way to add prefab in random gen. worlds at certain position

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

    #16
    position is the hub cell's position on an imaginary voronoi graph with offset centers(spacing ends up being right around the cell_size). hub city being 0,0. It's neighbor to the east(ish) would be 1,0

    east/west = first number; east is +/ west is -
    north/south = second number; north is +/ south is -

    the probability is for when it's randomly rolled in areas OTHER than ones that are manually set with position. eg, wastlandHub would spawn at 0,0 but ALSO has a chance of 0.1 to spawn somewhere else.

    I'll be writing up some documentation on the rwgmixer over the next couple of weeks.

    Feel free to ask questions here, I'll do my best to answer them.

    P.S. you can simply replace the wastelandHub with a test hub so you know it'll always spawn around 0,0.

    Uncomment this, it's near the other cell rules at the top of rwgmixer
    <!--<cell_rule name="customHubTest" position="0,1" prob="0"/>-->

    Then set the position to 0,0 like below:
    <cell_rule name="customHubTest" position="0,0"/>

    after that go to the bottom of rwgmixer and you'll see hub_layouts.
    replace that with the code below (put your prefab's name where you see MY_PREFAB_NAME):

    <hub_layouts>
    <hub_layout name="customHubTest">
    <township_type value="town"/>
    <street start_point="-64,0" end_point="64,0"/>
    <lot min_x_y="-32, 12" prefab="MY_PREFAB_NAME" rotation_to_road="2"/>
    </hub_layout>
    </hub_layouts>

    I think that should get you started.
    Last edited by Kinyajuu; 07-21-2015, 03:10 AM.

    Comment


      #17
      Originally posted by Kinyajuu View Post
      position is the hub cell's position on an imaginary voronoi graph with offset centers(spacing ends up being right around the cell_size). hub city being 0,0. It's neighbor to the east(ish) would be 1,0

      east/west = first number; east is +/ west is -
      north/south = second number; north is +/ south is -

      the probability is for when it's randomly rolled in areas OTHER than ones that are manually set with position. eg, wastlandHub would spawn at 0,0 but ALSO has a chance of 0.1 to spawn somewhere else.

      I'll be writing up some documentation on the rwgmixer over the next couple of weeks.

      Feel free to ask questions here, I'll do my best to answer them.

      P.S. you can simply replace the wastelandHub with a test hub so you know it'll always spawn around 0,0.

      Uncomment this, it's near the other cell rules at the top of rwgmixer
      <!--<cell_rule name="customHubTest" position="0,1" prob="0"/>-->

      Then set the position to 0,0 like below:
      <cell_rule name="customHubTest" position="0,0"/>

      after that go to the bottom of rwgmixer and you'll see hub_layouts.
      replace that with the code below (put your prefab's name where you see MY_PREFAB_NAME):

      <hub_layouts>
      <hub_layout name="customHubTest">
      <township_type value="town"/>
      <street start_point="-64,0" end_point="64,0"/>
      <lot min_x_y="-32, 12" prefab="MY_PREFAB_NAME" rotation_to_road="2"/>
      </hub_layout>
      </hub_layouts>

      I think that should get you started.
      Been wanting to ask -

      1) We can use this for existing hub set?

      2) Lets say I copied the wasteland hub and pasted it in, will it double?

      3) What is the max size for city/towns/rural and such, will the system support currently and still spawn?

      Still learning things so don't be too brutal :P
      Last edited by Tin; 07-21-2015, 10:45 PM.

      Comment


        #18
        Welcome back kinjayuu!

        Question about lot types, is this partially
        hard coded or can we create custom lots? If so, can you give me some sample code (I.e town lots). L.T. has tried but has been unable to.
        Last edited by Laz Man; 07-21-2015, 10:51 PM.

        Comment


          #19
          welcome back hope the honeymoon was worth the wait you had

          Comment


            #20
            Originally posted by Kinyajuu View Post
            position is the hub cell's position on an imaginary voronoi graph with offset centers(spacing ends up being right around the cell_size). hub city being 0,0. It's neighbor to the east(ish) would be 1,0

            east/west = first number; east is +/ west is -
            north/south = second number; north is +/ south is -

            the probability is for when it's randomly rolled in areas OTHER than ones that are manually set with position. eg, wastlandHub would spawn at 0,0 but ALSO has a chance of 0.1 to spawn somewhere else.

            I'll be writing up some documentation on the rwgmixer over the next couple of weeks.

            Feel free to ask questions here, I'll do my best to answer them.

            P.S. you can simply replace the wastelandHub with a test hub so you know it'll always spawn around 0,0.

            Uncomment this, it's near the other cell rules at the top of rwgmixer
            <!--<cell_rule name="customHubTest" position="0,1" prob="0"/>-->

            Then set the position to 0,0 like below:
            <cell_rule name="customHubTest" position="0,0"/>

            after that go to the bottom of rwgmixer and you'll see hub_layouts.
            replace that with the code below (put your prefab's name where you see MY_PREFAB_NAME):

            <hub_layouts>
            <hub_layout name="customHubTest">
            <township_type value="town"/>
            <street start_point="-64,0" end_point="64,0"/>
            <lot min_x_y="-32, 12" prefab="MY_PREFAB_NAME" rotation_to_road="2"/>
            </hub_layout>
            </hub_layouts>

            I think that should get you started.
            Heya Kinyajuu,

            If you don't use the "prob" variable and only the "position" variable, will that spawn that cell only once? If so, we can generate unique locations at a specific coordinate.

            Comment


              #21
              That is what confused me at first. It looked like if I specified a pattern of hubs for the cell rule that would replicate every time a cell is generated. This did not appear to be the case. What I have noticed is there is a lot of behaviour being generated behind the scenes by hard coded routines.

              It is these same routines - the hub type code for example that is responsible for drawing city blocks or town roads - that appear to be the limiting factor as far as creating custom lots for towns. If you don't use the city hub type you can't generate blocks, therefore you can't use modded town blocks even if you wanted to, if you do use it you are only limited to the "CityBlocks" hub rule as the game is hard coded to look for that rule, e.g a townBlocks hub rule group doesn't work, it draws 1 block and stops.

              The key things that would massively change how dynamic the world could be, especially with mods are -

              -Working lot types for residential, town, commercial, etc which would allow us to zone neighbourhoods.
              -If the random gen engine respected the allowedbiomes flag for the block prefabs, then you could have custom city block prefabs built for desert, snow, etc.
              -If the hub type rule for town worked, we could then design some nicer and smaller town streets with parks, water fountains, school fences etc.

              This would allow us to make much more vibrant towns as currently they do not seem to populate with POIs properly.

              Comment


                #22
                Originally posted by LT. View Post
                That is what confused me at first. It looked like if I specified a pattern of hubs for the cell rule that would replicate every time a cell is generated. This did not appear to be the case. What I have noticed is there is a lot of behaviour being generated behind the scenes by hard coded routines.

                It is these same routines - the hub type code for example that is responsible for drawing city blocks or town roads - that appear to be the limiting factor as far as creating custom lots for towns. If you don't use the city hub type you can't generate blocks, therefore you can't use modded town blocks even if you wanted to, if you do use it you are only limited to the "CityBlocks" hub rule as the game is hard coded to look for that rule, e.g a townBlocks hub rule group doesn't work, it draws 1 block and stops.

                The key things that would massively change how dynamic the world could be, especially with mods are -

                -Working lot types for residential, town, commercial, etc which would allow us to zone neighbourhoods.
                -If the random gen engine respected the allowedbiomes flag for the block prefabs, then you could have custom city block prefabs built for desert, snow, etc.
                -If the hub type rule for town worked, we could then design some nicer and smaller town streets with parks, water fountains, school fences etc.

                This would allow us to make much more vibrant towns as currently they do not seem to populate with POIs properly.
                I've been able to generate streets and prefabs specific to type (i.e. town) and size (i.e. 15x15) so I think I can create rough set pieces but was just wondering if I can limit where these set pieces spawn.

                Comment


                  #23
                  Originally posted by Laz Man View Post
                  I've been able to generate streets and prefabs specific to type (i.e. town) and size (i.e. 15x15) so I think I can create rough set pieces but was just wondering if I can limit where these set pieces spawn.
                  well similar to the hub thing mentioned with the prefab always spawning at 0,0 with the settings a few posts above, theoretically it would also be possible to set exact locations for what you are asking. either using a biome and sub biomes to spawn those specific hub parts at preset locations, or by just copying the entire part of how the cities are generated and changing the copied version to something that fits the biome its supposed to be in better (would need to do that for the original one as well then). Alternatively, instead of changing city hubs, it could be possible to change the way that villages spawn because keep in mind, village roads are different from normal roads; they dont have the gravel borders. So from what stuff looks like it should be possible to generate stuff with custom roads, which could be set to actually be entire "town blocks" with prefabs randomly spawning on them similar to backpacks and trash and stuff randomly spawning in barns (you know, 2 barns of the exact same type, but still one of the neiches in the wall has a backpack in it and the same on the other farm has trash). I guess it could work this way. Would have to play around a bit. Still this would confront us with the vanilla restrictions of the chunk borders and especially the 45x45 thing. Wont go into further detail before I havent tried it out myself.

                  ~shado

                  Comment


                    #24
                    Originally posted by Shado47 View Post
                    well similar to the hub thing mentioned with the prefab always spawning at 0,0 with the settings a few posts above, theoretically it would also be possible to set exact locations for what you are asking. either using a biome and sub biomes to spawn those specific hub parts at preset locations, or by just copying the entire part of how the cities are generated and changing the copied version to something that fits the biome its supposed to be in better (would need to do that for the original one as well then). Alternatively, instead of changing city hubs, it could be possible to change the way that villages spawn because keep in mind, village roads are different from normal roads; they dont have the gravel borders. So from what stuff looks like it should be possible to generate stuff with custom roads, which could be set to actually be entire "town blocks" with prefabs randomly spawning on them similar to backpacks and trash and stuff randomly spawning in barns (you know, 2 barns of the exact same type, but still one of the neiches in the wall has a backpack in it and the same on the other farm has trash). I guess it could work this way. Would have to play around a bit. Still this would confront us with the vanilla restrictions of the chunk borders and especially the 45x45 thing. Wont go into further detail before I havent tried it out myself.

                    ~shado
                    I have been able to overcome the 45x45 prefab limit with the hub_layout code that kinyajuu mentioned. I am trying to figure out 2 things now.

                    #1 Can you define the biome type of a user defined cell. (i.e. desert, forest, plains)

                    #2 Can you define a custom cell to only spawn only once. For example, there are some unique prefabs that should only spawn once in any given world.

                    The screenshot below is an example of a cell that consists of a 130x130 custom prefab (The Walking Dead Prison) between two roads which organically connects with other roads.



                    For those interested, here is my code for this configuration.

                    Code:
                    	<hub_layouts>
                    		<hub_layout name="customHubTest">
                    			<township_type value="town"/>
                    			<street start_point="-128,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
                    			<street start_point="-128,141" end_point="128,141" path_material="asphalt" path_radius="7"/>
                    			<lot min_x_y="-23, 10" prefab="TWDprisonRWG" rotation_to_road="3"/>
                    		</hub_layout>
                    	</hub_layouts>
                    Last edited by Laz Man; 07-27-2015, 11:01 AM.

                    Comment


                      #25
                      Can we start badgering Kinyajuu now for a public release of the tool he's been working on that was mentioned in the latest devblog, they ain't the only ones bored of flying around the map in god mode testing changes to prefabs and the rwgmixer!

                      Comment


                        #26
                        Originally posted by Slaan View Post
                        Can we start badgering Kinyajuu now for a public release of the tool he's been working on that was mentioned in the latest devblog, they ain't the only ones bored of flying around the map in god mode testing changes to prefabs and the rwgmixer!
                        Yes! Even if it's not part of the actual game but just put in a "tools" subfolder if it's not for proper release. Access to this tool even in it's current state would help server admins and modders immensely. That pain of having to fly around for hours at a time hunting for the perfect seed, we are experiencing that too! Really hope this makes it to the masses.

                        Comment


                          #27
                          Originally posted by Laz Man View Post
                          I have been able to overcome the 45x45 prefab limit with the hub_layout code that kinyajuu mentioned. I am trying to figure out 2 things now.

                          #1 Can you define the biome type of a user defined cell. (i.e. desert, forest, plains)

                          #2 Can you define a custom cell to only spawn only once. For example, there are some unique prefabs that should only spawn once in any given world.

                          The screenshot below is an example of a cell that consists of a 130x130 custom prefab (The Walking Dead Prison) between two roads which organically connects with other roads.



                          For those interested, here is my code for this configuration.

                          Code:
                          	<hub_layouts>
                          		<hub_layout name="customHubTest">
                          			<township_type value="town"/>
                          			<street start_point="-128,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
                          			<street start_point="-128,141" end_point="128,141" path_material="asphalt" path_radius="7"/>
                          			<lot min_x_y="-23, 10" prefab="TWDprisonRWG" rotation_to_road="3"/>
                          		</hub_layout>
                          	</hub_layouts>
                          I've been dying to hard code this prefab into my mod!
                          This makes me very excited to see, I am going to at least try to add something based on this code if you don't mind.

                          Comment


                            #28
                            Originally posted by Chaosocks View Post
                            I've been dying to hard code this prefab into my mod!
                            This makes me very excited to see, I am going to at least try to add something based on this code if you don't mind.
                            So far I am able to spawn whatever I want at 0,0. But having trouble with other locations (I.e. 0,1.....1,0.......1,1 etc.).

                            I shelved my testing until kinyajuu posts more guidance.

                            Comment


                              #29
                              Originally posted by Laz Man View Post
                              I have been able to overcome the 45x45 prefab limit with the hub_layout code that kinyajuu mentioned. I am trying to figure out 2 things now.

                              #1 Can you define the biome type of a user defined cell. (i.e. desert, forest, plains)

                              #2 Can you define a custom cell to only spawn only once. For example, there are some unique prefabs that should only spawn once in any given world.

                              The screenshot below is an example of a cell that consists of a 130x130 custom prefab (The Walking Dead Prison) between two roads which organically connects with other roads.



                              For those interested, here is my code for this configuration.

                              Code:
                              	<hub_layouts>
                              		<hub_layout name="customHubTest">
                              			<township_type value="town"/>
                              			<street start_point="-128,0" end_point="128,0" path_material="asphalt" path_radius="7"/>
                              			<street start_point="-128,141" end_point="128,141" path_material="asphalt" path_radius="7"/>
                              			<lot min_x_y="-23, 10" prefab="TWDprisonRWG" rotation_to_road="3"/>
                              		</hub_layout>
                              	</hub_layouts>
                              My question to this is can we put this in and it not rep;lace the main hub city at 0,0. For example 1000 1000 or 500 500 etc. Would it not be possible to create a hub elsewhere for bigger unique prefabs.

                              Comment


                                #30
                                Originally posted by stallionsden View Post
                                My question to this is can we put this in and it not rep;lace the main hub city at 0,0. For example 1000 1000 or 500 500 etc. Would it not be possible to create a hub elsewhere for bigger unique prefabs.
                                Based on kinyajuu's last post we should be able to but I haven't been able to. More trial and error testing needed.

                                Comment

                                Working...
                                X