Wuzzy/Repixture
6
33
Fork
You've already forked Repixture
10

Improve village terrain integration #82

Closed
opened 2023年02月20日 18:16:09 +01:00 by Wuzzy · 5 comments
Owner
Copy link

Villages don't integrate well with most terrain shapes. Either they cut away the land too aggressively, or the create huge overhangs.
Villages are always flat.

I think a major overhaul of the algorithm is required.

TODO:

  • Get rid of worst and most aggressive terrain overhangs below houses caused by the hill generator
  • Make village houses adapt to landscape
  • Generate non-flat villages
  • Generate paths that adapt to landscape
  • Make sure all key features of the previous versions still work
Villages don't integrate well with most terrain shapes. Either they cut away the land too aggressively, or the create huge overhangs. Villages are always flat. I think a major overhaul of the algorithm is required. TODO: * [x] Get rid of worst and most aggressive terrain overhangs below houses caused by the hill generator * [x] Make village houses adapt to landscape * [x] Generate non-flat villages * [x] Generate paths that adapt to landscape * [x] Make sure all key features of the previous versions still work
Wuzzy changed title from (削除) Non-flat villages (削除ここまで) to Improve village terrain integration 2024年06月03日 13:58:11 +02:00

It would be nice if villages could expand, for example if the player builds another house and the village can detect it because there is a new bed in a 30 or so node radius, and that would become part of the village and also allow for another villager.
Currently my home village is half my builds which no villagers ever touch, and then the generated ones, which feels a bit weird sometimes.
Some of the villagers living there said they wanted a library. I build one, but it's a bit too far away for them to notice. Meanwhile three of them are crazing around a single bookshelf in a house.

It would be nice if villages could expand, for example if the player builds another house and the village can detect it because there is a new bed in a 30 or so node radius, and that would become part of the village and also allow for another villager. Currently my home village is half my builds which no villagers ever touch, and then the generated ones, which feels a bit weird sometimes. Some of the villagers living there said they wanted a library. I build one, but it's a bit too far away for them to notice. Meanwhile three of them are crazing around a single bookshelf in a house.
Author
Owner
Copy link

Thank you for your comment. I have thought a lot about the village/villager mechanic.

All villagers pick a home bed and a "worksite" which is a per-profession block.
Once chosen, they don't change their selection unless they can't find a path or the block is gone.
A villager without a bed or worksite will scan its proximity for an unclaimed bed and worksite and once found, they claims it.
Villagers also secretly "communicate" with each other to ensure no two villagers claim the same bed.

So to relocate a villager, just destroy their current home bed and build one elsewhere.

Villager schedule currently has 3 phases: Work, sleep, play. At work, they go to their worksite. At sleep, the go to bed. At play, they go to random decoration blocks (mostly chests). Each profession has its own schedule and worksite.

The "worksite" of carpenters is a bookshelf. This is admittedly a bit cheating to create simulate a "fascination" for libraries. I probably need to think of a better day routine for carpenters.

Admittedly, the current system still has room for improvement. I think the search range is large enough, but maybe I could teach villagers to roam the world semi-randomly when they don't have a bed so that they may find one randomly.

Currently, if a villager does not find any interesting block, they stand still and are stranded. Maybe such a roaming mechanic could allow a lost villager to find a village or basic home from far away.

But IMHO the biggest hurdle to village expansion right now is that villagers cannot breed. The villagers that the mapgen spawns are all you will ever get. This is obviously a problem.

Internally, the villagers have no awareness of villages at all. All they see is points of interest to walk to. This is by design because I don't want a complex "village detection system" or "village boundary algorithm" or something like that. And it's probably not neccessary.

Anyway. Right now, it is already possible to spawn a villager in Creative in flat worlds and build a custom village from scratch and the villager will start follow a schedule if you built a bed and worksite somewhere.

Thank you for your comment. I have thought a lot about the village/villager mechanic. All villagers pick a home bed and a "worksite" which is a per-profession block. Once chosen, they don't change their selection unless they can't find a path or the block is gone. A villager without a bed or worksite will scan its proximity for an unclaimed bed and worksite and once found, they claims it. Villagers also secretly "communicate" with each other to ensure no two villagers claim the same bed. So to relocate a villager, just destroy their current home bed and build one elsewhere. Villager schedule currently has 3 phases: Work, sleep, play. At work, they go to their worksite. At sleep, the go to bed. At play, they go to random decoration blocks (mostly chests). Each profession has its own schedule and worksite. The "worksite" of carpenters is a bookshelf. This is admittedly a bit cheating to create simulate a "fascination" for libraries. I probably need to think of a better day routine for carpenters. Admittedly, the current system still has room for improvement. I think the search range is large enough, but maybe I could teach villagers to roam the world semi-randomly when they don't have a bed so that they may find one randomly. Currently, if a villager does not find any interesting block, they stand still and are stranded. Maybe such a roaming mechanic could allow a lost villager to find a village or basic home from far away. But IMHO the biggest hurdle to village expansion right now is that villagers cannot breed. The villagers that the mapgen spawns are all you will ever get. This is obviously a problem. Internally, the villagers have no awareness of villages at all. All they see is points of interest to walk to. This is by design because I don't want a complex "village detection system" or "village boundary algorithm" or something like that. And it's probably not neccessary. Anyway. Right now, it is already possible to spawn a villager in Creative in flat worlds and build a custom village from scratch and the villager will start follow a schedule if you built a bed and worksite somewhere.

Thanks for the detailed explanation, I now understand how villagers work :)
I have also "cheated" to spawn in some more villagers because they can't reproduce themselves yet, and I need a larger population.

Relocating beds and workstations worked perfectly. Sometimes I had to place it in between where I wanted them to go, wait for them to move, then bring it to the desired spot, but that wasn't much of an issue.

Once there is a different work block for carpenters, bookshelfs could become a play block instead, allowing for much better fascination of libraries.

I also like how the villagers hint at what their workstation is if they can't find it. That is great.

Yes, a roaming mechanic would be a good feature. "Oh no! I don't have anything to do!" -> "I'll just walk around over there a bit and see what I can find." -> "Oh hey! Here's a group of lovely people, and they have a spare bed for me! Yay!"
But be careful that they can't get lost 30 blocks away from a village, then start roaming away the opposite direction. So every 30 or so seconds (and before they begin roaming) they should do a large scan of the area around them to try find a place of interest.

Having no "village detection system" makes total sense, and honestly just makes the game better and more simple. You've done a great job with it so far, and I am excited to see future improvements as well!

Thanks for the detailed explanation, I now understand how villagers work :) I have also "cheated" to spawn in some more villagers because they can't reproduce themselves yet, and I need a larger population. Relocating beds and workstations worked perfectly. Sometimes I had to place it in between where I wanted them to go, wait for them to move, then bring it to the desired spot, but that wasn't much of an issue. Once there is a different work block for carpenters, bookshelfs could become a play block instead, allowing for much better fascination of libraries. I also like how the villagers hint at what their workstation is if they can't find it. That is great. Yes, a roaming mechanic would be a good feature. "Oh no! I don't have anything to do!" -> "I'll just walk around over there a bit and see what I can find." -> "Oh hey! Here's a group of lovely people, and they have a spare bed for me! Yay!" But be careful that they can't get lost 30 blocks away from a village, then start roaming away the opposite direction. So every 30 or so seconds (and before they begin roaming) they should do a large scan of the area around them to try find a place of interest. Having no "village detection system" makes total sense, and honestly just makes the game better and more simple. You've done a great job with it so far, and I am excited to see future improvements as well!
Wuzzy added reference village_nextgen 2025年10月10日 15:38:22 +02:00
Wuzzy removed reference village_nextgen 2026年04月12日 00:43:05 +02:00
Author
Owner
Copy link

Good news! The village branch has finally been merged! Goodies:

  • Villages now adapt to the landscape instead of being placed flat
  • House spawns are now smart enough that the can spawn even safely in forests without cutting into trees in an ugly way
  • Village buildings are now placed freely, the "grid" layout is gone
  • Path width reduced
  • Paths are placed using the pathfinder for a more natural look
  • Villages now generate in the mapgen thread which should prevent annoying lag spikes
  • No more village lanterns (for now)
  • New tool to place a single village building (mostly for debug/testing only)

There is now only one thing that still needs improvement before closing this:

  • Houses occassionaly still generate large terrain overhangs due to the hill generator
Good news! The village branch has finally been merged! Goodies: * Villages now adapt to the landscape instead of being placed flat * House spawns are now smart enough that the can spawn even safely in forests without cutting into trees in an ugly way * Village buildings are now placed freely, the "grid" layout is gone * Path width reduced * Paths are placed using the pathfinder for a more natural look * Villages now generate in the mapgen thread which should prevent annoying lag spikes * No more village lanterns (for now) * New tool to place a single village building (mostly for debug/testing only) There is now only one thing that still needs improvement before closing this: * Houses occassionaly still generate large terrain overhangs due to the hill generator
Author
Owner
Copy link

House hills are now less aggressive and look somewhat more natural.

Villages are now good enough to close this.

House hills are now less aggressive and look somewhat more natural. Villages are now good enough to close this.
Sign in to join this conversation.
No Branch/Tag specified
master
new_weather_types
clock
sponge
cushion
vase
pages
giant_crops
duckweed
new_hairs_new_skin_selection
new_hairs
multi_flower_2
dirt_redo
craft_compat
gold_coin_upgrade
gold_coin
new_traders
item_frame_flat
silktouch_paint
silktouch
newtrees
new_weather
creative_per_player
scrollbar_style
village_nextgen_thread
village_nextgen
new_website
tnt_faster
fixbrush
roots
amber_slime
fir
path_fixes
villager_pathfind_cost
fence_gate
slab_up
biome_skies
pencil_showlabel
moonflower_seed
unicode_signs_refactor_newsigns_sideways
unicode_signs
spyglass
craftcolor
villager_pathfind
mobs_new2
paint_book
moon_phases
newmusic
weblate_test
paint4dir
whistle
buoy
pot
4x4grass
village_vmanip
seagrass
3.20.0
3.19.0
3.18.2
3.18.1
3.18.0
3.17.3
3.17.2
3.17.1
3.17.0
3.16.0
3.15.1
3.15.0
3.14.0
3.13.1
3.13.0
3.12.1
3.12.0
3.11.0
3.10.0
3.9.0
3.8.0
3.7.0
3.6.3
3.6.2
3.6.1
3.6.0
3.5.0
3.4.1
3.4.0
3.3.0
3.2.1
3.2.0
3.1.1
3.1.0
3.0.1
3.0.0
2.1.0
2.0.0
1.5.3
1.5.2
1.5.1
1.5.0
1.4.2
1.4.1
1.4.0
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.0
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.0
v0.6.0
v0.5.0
v0.4.4
v0.4.3
v0.4.2
v0.4.1
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
Category: Discussion
For discussions about the game
Category: Entities
About entities or objects (including player)
Category: Gameplay
About gameplay mechanics in general
Category: Graphics
About graphics
Category: GUI and HUD
Anything related to the graphical user interface or heads-up display
Category: Items and Tools
About items or tools, but not nodes
Category: Mapgen
About the map generator
Category: Nodes
About nodes
Category: Sounds
About sounds
Category: Translation
About translations
Category: Website
Related to the Repixture website
Kind
Balancing
About game balance
Kind
Bug
When something doesn't work right
Kind
Documentation
About documentation, both for devs and players
Kind
Feature
Ideas, feature requests, enhancements, etc.
Kind
Maintenance
Code quality, technical improvements, refactoring, etc.
Kind
Performance
About making the game run fast
Priority
CRITICAL
Highest priority level. For crashes, major data loss, etc.
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Decision needed
When the issue still needs a decision on what to do
Reviewed
Duplicate
When the issue existed already
Reviewed
Invalid
When the issue was not valid
Reviewed
Rejected
When something that was proposed was rejected
Status
Needs engine change
When it can only be solved after a Luanti bugfix/improvement
Status
Needs testing
If the task is believed to be done, but needs testing
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Wuzzy/Repixture#82
Reference in a new issue
Wuzzy/Repixture
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?