Other world generation methods

I suspect tiny is the only method. It’s just a way to create a minimal map for fast game creation.

Having said that, it would be nice to know where the game defines and uses that method so I could play with it a bit. For instance, a mod that generates a very large map to select a start point on would be pretty cool, even if just to get a better idea of what kind of maps the world generation system creates on a larger scale.

Edit: Now that I think about it, it would also be great in the case of making a unique campaign. For instance, wouldn’t it be great to create your own custom map (rather than a randomly generated seed based one) and give the player the option of where to start on that map?

1 Like

@Tuhalu I attempted this before for making large worlds however I could never get it to actually work because apparently the size is defined somewhere else than where it listed the “normal” and “tiny” and after you guys changed the world generation a bunch of versions ago I couldnt find the information again

I’ve tried “small” and “normal” before posting this but nothing changed. It just change back to default.

The correct term is ‘tiny’ or ‘micro’ its one of those two and the map it generates is maybe 1 or 4 chunks if that[quote=“Hunyo18, post:5, topic:25750, full:true”]
I’ve tried “small” and “normal” before posting this but nothing changed. It just change back to default.
[/quote]

I know “tiny” or “micro” works. I’m talking about
this…

but thanks.

FOUND IT!

stonehearth/services/server/game_creation/game_creation_service.lua

now what? :laughing: > :sweat_smile: > :confused: ?

Edit: it has “small” but has same value as “tiny” :confused:

There is no other types ready to use, but in that file you can change the hardcoded radius values, doing that you will get other map sizes.

3 Likes

I think not, is to increase the map generation … I looked at the radius in the code, but it does not understand how to change to increase.

This is the piece of code in that file (stonehearth/services/server/game_creation/game_creation_service.lua) that actually defines the map size:

function GameCreationService:create_new_world(num_tiles_x, num_tiles_y, seed, biome_src)
   local seed = radiant.util.get_config('world_generation.seed', seed)
   local generation_method = radiant.util.get_config('world_generation.method', 'default')
   local wgs = stonehearth.world_generation
   local blueprint
   local tile_margin

   log:info('using biome %s', biome_src)
   
   wgs:create_new_game(seed, biome_src, true)

   -- Temporary merge code. The javascript client may eventually hold state about the original dimensions.
   if generation_method == 'tiny' then
      tile_margin = 0
      blueprint = wgs.blueprint_generator:get_empty_blueprint(2, 2) -- (2,2) is minimum size
   else
      -- generate extra tiles along the edge of the map so that we still have a full N x N set of tiles if we embark on the edge
      tile_margin = self:_get_world_generation_radius()
      num_tiles_x = num_tiles_x + 2*tile_margin
      num_tiles_y = num_tiles_y + 2*tile_margin
      blueprint = wgs.blueprint_generator:get_empty_blueprint(num_tiles_x, num_tiles_y)
   end

   wgs:set_blueprint(blueprint)

   return self:_get_overview_map(tile_margin)
end

As you can see, it uses a hardcoded if statement to make a different sized map if the generation_method is tiny.

If you want the game to generate a map that is larger than normal, you’ll also want to adjust the scaling of the map, so as to keep the map inside the borders.

This is found in stonehearth/ui/shell/select_settlement/map.js line 5 as cellSize.

Implementing an option for a ‘huge’ method that gives a 28 x 19 map with a scaling of 5 (instead of 12), gets you a map like the following image. It took over 30 seconds to load, as compared to 4 seconds for a normal map.

4 Likes

That’s pretty cool looking, it’s neat to see large areas of world gen like that. How large will it go?

How long do you want to wait?

One theoretical limit would be 144x as large as the normal map, with a scale of 1 instead of 12. It would also take 144x as long to generate (~10 minutes on my computer!). Not really something you’d want to do all the time :smiley:

Some additional notes:

  • The map is divided up into chunks that are 8 units wide and 8 units high, but the map is always 1 unit less high and wide than that.
  • The normal map is 12 x 8 chunks.
  • You can’t make a map smaller than 2 x 2 chunks, as it causes errors.
  • On my screen (Full HD resolution), the most pixels you can fit in the map area is 1140 x 756. This makes the largest map size I can fit in the borders 71 x 47 chunks. Not sure if you could fit more on larger screens, but you’d certainly be able to see less on smaller screens.
  • In practise, the game ate all my RAM and failed to build that map in 20 mins.
  • I managed to build a 47x31 chunk map in ~4min20sec. This is just over 15x as big as the normal map, but it took 65 times as long to create. I suppose it’s possible to make bigger maps, but it might take hours…
6 Likes

Now, you know if it is possible to increase the area of selection …

stonehearth/ui/shell/select_settlement/map.js has the variable settlementRadius set to 19. You can adjust that to change the apparent size of the selection area in the map screen. However, that won’t change the size of the actual area that is generated for you to play on. It’s just a guide.

One way to affect the actual map you play is is to adjust some numbers in constants.lua and this block of code:

   terrain = {
      TILE_SIZE = 256,
      MACRO_BLOCK_SIZE = 32,
      FEATURE_BLOCK_SIZE = 16,
   },

These numbers are related by the following rules:
FEATURE_BLOCK_SIZE must be half the size of MACRO_BLOCK_SIZE.
TILE_SIZE must be evenly divisible by MACRO_BLOCK_SIZE.

From what I can tell, adjusting TILE_SIZE will adjust the size of the actual map you play on, but will also adjust the size of the map you embark from by an equal amount. For instance, if you reduce TILE_SIZE down to 64, the map will be 1/4 of the width and height as normal.

You probably don’t want to adjust MACRO_BLOCK_SIZE or FEATURE_BLOCK_SIZE. If you change the size of the FEATURE_BLOCK_SIZE, this changes the size of the area in which a chunk of features will appear. Smaller numbers mean more features overall and larger numbers mean less features overall. Reducing FEATURE_BLOCK_SIZE to 8 gives forest areas that look like this:


As you can see, the trees are really crowded due to this!

I suspect there is somewhere else that lets you adjust the size of the map without messing with these numbers, but I haven’t figured out where it is yet. The files at stonehearth/services/server/world_generation/ have something to do with it (since this is the stuff that generates the actual world terrain). There is just a hell of a lot of stuff to figure out there…

2 Likes

Oh… It’s a dense forest. I can imagine monsters hiding in those trees :anguished:

As far as I know, @8BitCrab, “tiny” is the only one that works.

1 Like

Yeah, it would be fun to play with if the camera controls around tight terrain (and especially trees) wasn’t really difficult :sweat:

We figured out that part earlier in the topic… and also where you can add code to make new working methods.

1 Like

can be purposeful of devs, for future implementation in game… I have even heard of this proposal to go beyond the edges of Stonehearth … But I thank you contact, I will be continue to keep our conversation here and this active topic …

I’m not good in programming but I propose a mod in the world generation map (where you choose the place to embark) a small, medium & large button to resize the world map or two input boxes for the custom length and width of the map.

And also arrow keys (up, down, left, right) to navigate through the map X (10 or idk) blocks to the desired direction.

Maybe this is more of a suggestion than a mod.

2 Likes

For anyone trying to use Tuhalu’s method of making the map bigger, the code snippet they show with terrain and tile size and what not is now in a different file path as of alpha 22, the new file path is stonehearth\data\constants.json

I tried messing around with it for around an hour and have no idea how it works because it seems really inconsistent whether or not the map size gets bigger like Tuhalu theorized

Anyone know where this path is currently located?

For anyone else who is interested i believe this is the correct location Stonehearth\mods\stonehearth\ui\shell\select_settlement