[Mod] Villages for Minetest [mg_villages]

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Sun Jun 18, 2017 19:54

- secular: A type of building that does not belong to the church/religion but has a "worldly" purpose - like i.e. a town hall, a library, city administration buildings, the opera etc. Houses for living don't count for that. It is probably too general for any specific chat messages. More specific categories would be more fitting.

- deco: Decoration. So far used for a lamp and a park. The park maybe ought to get its own category. Statues, monuments, lamps, signs, flower beds etc. may all count as decoration.

- mill: A place where i.e. wheat is turned into flour. Traditional medieval types are windmill and watermill. Older ones may have been operated by oxen. Other types of grains and field products (i.e. rape seed into oil) may also be processed in a mill. A miller works here.

- pit: A hole in the ground. In the case of mg_villages it's a clay pit where the claytraders dig their clay. In RL clay is far more common than in MT.

- chateau: Castle built not for protection but for representation. Kings loved them. The one that comes with mg_villages is a small one for the country. The king might have visited for a hunting trip or to spend the summer.

- allmende: commons, common land. In medieval villages it was land that belonged to no one in particular but to all that lived there. The villagers could let their cattle graze there, collect wood for fire etc. In mg_villages, all players can build on the allmende. It is unprotected and allows to grow some plants inside a safe village before venturing out in the unkown.
A list of my mods can be found here.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Tue Jun 20, 2017 08:10

very nice! thanks sokomine for the details. i went ahead and began adding some chat dialogue for deco and allmende villager types on v0.12 of my villagers mod. more to come of course..
 

User avatar
BirgitLachner
Member
 
Posts: 358
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] Villages for Minetest [mg_villages]

by BirgitLachner » Tue Jun 20, 2017 20:05

I was not able to use "villages" at a new server. I tried the modpack and as it was not working I even tried "mg_villages" and all of the mods they depends on seperately.

In both cases it was not working. There are error messages like: mg_villages missing or handle_schematics. Really strange because alle missing mods were there in the newest version.

Do you have any idea, what's the reason for that?
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Wed Jun 21, 2017 02:33

BirgitLachner wrote:In both cases it was not working. There are error messages like: mg_villages missing or handle_schematics. Really strange because alle missing mods were there in the newest version.

You'll need handle_schematics and mg_villages in order to get the villages. cottages is also highly recommended - else you'll just get only a small subset of possible village types. Can you post the error messages you get?
A list of my mods can be found here.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Thu Jun 22, 2017 02:09

More and larger plots of the type "empty" have been added. Those are intended for players who want to settle in the village. It's room for expansion. There are also a few saplings on these plots so that you have some wood at hand.
Image

Villages of type "taoki" now have houses with beds inside. That's important for the assignment of villagers. Some houses had to be adjusted slightly. The tower got stairs instead of a ladder. Mobs can handle stairs but have no idea how to climb ladders yet.A very tiny place for a guard (sleeping palce) was added:
Image
Attachments
tower_taoki_new.jpg
(100.32 KiB) Not downloaded yet
village_with_empty_plots.jpg
(209.31 KiB) Not downloaded yet
A list of my mods can be found here.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Tue Jun 27, 2017 15:17

hi sokomine, is there a way my mod can get the position of where a village will initially spawn? i am looking into finding a better way of assigning a 'region type' to my villagers. i'm thinking that if i know the spawn position of your village, i can obtain a sample of a number the nodes surrounding that position. then i sort the nodes by name and use that data to determine if the climate/region type of my villagers should be cold, hot, or normal/mild weather, or warm and humid jungle/forest or desert dry climate.

i experimented with getting temperature and humidity values of biomes but i didn't get consistent results that made much sense with the surround nodes that i see.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Tue Jun 27, 2017 21:27

Update: New villages now get mob spawners placed next to their plot markers. One mob spawner is placed for each inhabitant of the house. Right-clicking on the plotmarker will show you in chat which data the village has stored about that mob who is supposed to "stand" on this spot. This is mostly for debugging and development of villagers/advanced_npc/likewise mods. I'll burry the mob spawners one node deeper to hide them from view soon. The spawners do not spawn any mobs. They're just unique places where mobs *could* spawn. There's a comfty bed reserved for each mob spawner. The data structure the villages provide has names, family relationship, age and job names for the mobs. For most houses, a place next to the bed where the mob can stand can be determined and a path to the mob spawner be calculated. The inverse might not always be true (mobs can't climb ladders), and following the plotted path seldom works satisfactory so far due to problems with mob movement in general.

Some houses - in particular the inn/pub/hotel buildings - have been made wider so that there's enough room for each mob with a bed inside to have a mob spawner as well. Other houses have been slightly redesigned where needed as well.

Right-clicking on the plotmarker lists you information about the inhabitants of each house plus (if mob_world_interaction is installed) debug information about a path from a place next to each mob's bed to the position on top of the mob spawner.

Mob mods of course don't have to make use of the spawners or the stored data structures. But I think it could be very useful.

Don't forget to update handle_schematics as well.

The next step on my TODO list is to let Burlis pathfinder code operate on the internal data representation of each house so that bed positions, places in front of beds, paths to mob spawners and front door(s) can be calculated at the time the schematic (or .we file) is read. This will allow for some consistency checks (Can the mob get from bed to spawner? Does the reverse path work? Is there some agreement on what might be the front door?) and might also speed up later operations.

ErrorNull wrote:hi sokomine, is there a way my mod can get the position of where a village will initially spawn? i am looking into finding a better way of assigning a 'region type' to my villagers. i'm thinking that if i know the spawn position of your village, i can obtain a sample of a number the nodes surrounding that position. then i sort the nodes by name and use that data to determine if the climate/region type of my villagers should be cold, hot, or normal/mild weather, or warm and humid jungle/forest or desert dry climate.

The center of the village is stored in village.vx and village.vz. village.vh represents y (ground level). Most villages seem to cover more than one biome. The ground type is kept whenever possible. village.vs roughly determines the size (the radius). Maybe that'll help you a bit. It might also be of intrest to take the trees into account. Each village chooses its own random tree type and uses that for wood and saplings. Some tree species might be more common in one region than another.

ErrorNull wrote:i experimented with getting temperature and humidity values of biomes but i didn't get consistent results that made much sense with the surround nodes that i see.

I don't have any real experience with biomes.
A list of my mods can be found here.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Wed Jun 28, 2017 01:01

Awesome Sokomine! The mob spawner nodes will be very helpful - thanks for that. That should simplified my spawning code and allow my villagers to know where the bed are... and can allow me to add other features much easier. Nice.

Sokomine wrote:The center of the village is stored in village.vx and village.vz. village.vh represents y (ground level). Most villages seem to cover more than one biome. The ground type is kept whenever possible. village.vs roughly determines the size (the radius). Maybe that'll help you a bit. It might also be of intrest to take the trees into account. Each village chooses its own random tree type and uses that for wood and saplings. Some tree species might be more common in one region than another.


Ok cool thanks - thanks perfect. Also you mention about the random trees you choose. Can i access what type of tree is choses? perhaps this can be another factor i choose for my villagers to know what region/climate to they are in...
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Wed Jun 28, 2017 01:49

ErrorNull wrote:Ok cool thanks - thanks perfect. Also you mention about the random trees you choose. Can i access what type of tree is choses? perhaps this can be another factor i choose for my villagers to know what region/climate to they are in...

village.to_add_data.replacements is a table that contains the replacements for the village. Iterate through that table. It has entries of the form { "default:sapling", "some_mod:new_sapling" }. default:tree and default:wood are replaced in a similar way.
A list of my mods can be found here.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Thu Jun 29, 2017 16:57

Sokomine wrote:village.to_add_data.replacements is a table that contains the replacements for the village. Iterate through that table. It has entries of the form { "default:sapling", "some_mod:new_sapling" }. default:tree and default:wood are replaced in a similar way.


ah ok that's perfect. i will continue this task as soon as I'm done with getting my villagers to spawn on your mob spawners. :)
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Fri Jun 30, 2017 17:04

I noticed the anomaly you have mentioned about how sometimes not all the villagers seem to appear on the mob spawners. It happened very rarely. When reviewing my output logs, it shows that the villager entities seem to get added to the world with assigned names, textures, spawn positions, etc without errors... but for some reason does not materialize in the world. Then if I start a new world with same map and village parameters, then villagers always spawn no problem. What do you think? For now i don't use any ABMs to force the 'missing' villagers to eventually spawn.. but perhaps I will try an LBM to compensate. Keep up the nice work!
Image
Image
Attachments
mob-spawner-glitch-2.png
(494.28 KiB) Not downloaded yet
mob-spawner-glitch-1.png
(488.55 KiB) Not downloaded yet
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Fri Jun 30, 2017 22:53

ErrorNull wrote:I noticed the anomaly you have mentioned about how sometimes not all the villagers seem to appear on the mob spawners. It happened very rarely. When reviewing my output logs, it shows that the villager entities seem to get added to the world with assigned names, textures, spawn positions, etc without errors... but for some reason does not materialize in the world. Then if I start a new world with same map and village parameters, then villagers always spawn no problem. What do you think? For now i don't use any ABMs to force the 'missing' villagers to eventually spawn.. but perhaps I will try an LBM to compensate. Keep up the nice work!

I have no idea why that bug happens. There aren't that many villagers after all; it's unlikely that we run into the too-many-entities-situation.
A list of my mods can be found here.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Sun Jul 09, 2017 00:59

Updates:
- made compatible with older versions of MT again
- houses in villages of type grasshut, sandcity, village_towntest, tents, gambit and modern_houses got beds and doors where appropriate
- new type of building introduced: townhall (might be important for the villagers)
- acacia and aspen trees will now spawn as full-grown trees instead of saplings only
- front doors are calculated
- paths from beds to a position in front of the house are calculated for all front doors
- front door positions and paths are cached
- added transformation function for coordinates (schematic to actually placed house)
- lots of smaller bugfixes

You'll get villages of type grasshut if you install the very nice dryplants mod:
Image

Details about pathfinding, front doors etc. for those that are intrested and/or develop mob mods (the rest can stop reading here):

Pathfinding and front door recognition work like this: First off all positions of beds (minetest_game's beds mod, cottages bed head and sleeping mat with pillow) are searched. Then Burlis pathfinding algorithm is applied and searches a path from a position next to each bed (where the mob can stand) to a position in front of the house. The last common door on the path is considered to be the front door. This door is then blocked and the process repeated until no further common front doors can be found. This algorithm works in most cases but fails at some of the sandcity buildings as those have multiple seperate door-covered rooms without a common front door. The search for doors and paths is done inside the data structure read from the schematic files of each building. The process takes a couple of seconds. In order to spare players waiting time upon starting a new world, the data has once been calculated and is now cached inside the file mods/mg_villages/mg_villages_path_info.data

The functions mg_villages.get_path_from_bed_to_outside(..) and mg_villages.get_path_from_outside_to_bed(..) take that pathinfo data, transform the relative coordinates to the absolute ones of a particular building and return the complete path. Bed number might vary between what was previously stored in *.beds[bed_nr].x etc. and what can now be obtained through transforming the list of stored bed positions for each house. mg_villages.inhabitants.get_mob_data(..) will return you the *.beds[beds_nr] data, but the paths will use the bed positions from transforming those found in the original schematic.

If you want to test the paths, update at least handle_schematics, mg_villages and mob_world_interaction to current git. For testing, check out the "movement" branch of mobf_trader. Right-clicking on the plotmarkers and on "who lives here" will then spawn you mobf_trader mobs, and if you right-click on a mob spawner, the trader standing on it will try to go to his bed and sleep there. Once he reached his bed and you right-click again, the mob will try to get out of his bed and come back. This may sometimes work but sadly still leads to mobs getting stuck.

Two proud villagers who managed to march from their spawners to their beds and back (they still have to learn to stand next to each other instead of stacking):
Image
Attachments
trader_testing_paths.jpg
(152.53 KiB) Not downloaded yet
grasshut_village2.jpg
(189.85 KiB) Not downloaded yet
A list of my mods can be found here.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Sun Jul 09, 2017 01:26

Sokomine wrote:- houses in villages of type grasshut, sandcity, village_towntest, tents, gambit and modern_houses got beds and doors where appropriate
- new type of building introduced: townhall (might be important for the villagers)

Yes! that is awesome.

Sokomine wrote:- front doors are calculated
- paths from beds to a position in front of the house are calculated for all front doors
- front door positions and paths are cached

My villagers will be very happy to hear that.

Sokomine wrote:You'll get villages of type grasshut if you install the very nice dryplants mod:

Question for you: is there a way I can make grasshut not use the dryplants mod? It depends on the biomes_lib mod which I'd like to avoid for now. My villagers do not support grasshut yet. Ah and almost forgot it doesn't support 'ruins' village type either.

Sokomine wrote:Two proud villagers who managed to march from their spawners to their beds and back (they still have to learn to stand next to each other instead of stacking):

Very cute. I like how they stack.. hehe. On rare occasions, my villagers simply merge inside each other like a horrific sci-fi movie accident. Looks like I have a lot of goodies to work with for my next update. Thanks for continuing to add all these nice features.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Sun Jul 09, 2017 02:31

ErrorNull wrote:Question for you: is there a way I can make grasshut not use the dryplants mod? It depends on the biomes_lib mod which I'd like to avoid for now. My villagers do not support grasshut yet. Ah and almost forgot it doesn't support 'ruins' village type either.

All you really need are the blocks it defines. Those are in reeds.lua as far as I can see. The dryplants mod also changes the default grass texture to something very nice looking.

ErrorNull wrote:Very cute. I like how they stack.. hehe. On rare occasions, my villagers simply merge inside each other like a horrific sci-fi movie accident.

Happens whenever two mobs stand at the same spot and look in the same direction. One of the scary things in MT (same as those 2d sprites). Such "accidents" happen in my tests as well.
A list of my mods can be found here.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Mon Jul 10, 2017 15:23

New: Added navigation inside villages. Villages standing on a road or on a node directly adjacent to a road may request a path via
Code: Select all
path = mg_villages.get_path_from_pos_to_plot_via_roads( village_id, pos, target_plot_nr );

to another plot inside the village. This makes use of the road structure of the village generator and is quite inexpensive. The path generated is not necessarily the shortest - going straight over the grass and other plots may be faster - but it's the fastest using the roads. And what are roads for if not for travelling?

Here's a family on their walk from their plot to another:
Image

The usual problems with mob movement apply and make it relatively unlikely that the mob will actually reach its target:
- once the mob will get unloaded (player too far away), the mob gets deactivated; when the player comes back later on and the mob gets loaded again it is uncertain what the mob ought to do (quite a lot of time might have passed; he may not even have stored his path and target)
- if two mobs meet and block each others way they end up in a deadlock unless they manage to gltich past each other

But that's rather something the movement code of the mob ought to fix and handle. The "movement" branch of my mobf_trader mod contains a slightly adjusted version of the movement code in npcf as written by bell07. It does address some smaller things like door handling and sleeping but not the bigger issues mentionned here. I'd be glad if someone with more experience in mob handling could add such functionality to a general mob lib. After all all "intelligent" mobs will need it to some degree.

The two functions
Code: Select all
path = mg_villages.get_path_from_bed_to_outside( village_id, plot_nr, bed_nr, front_door_nr );

and
Code: Select all
path = mg_villages.get_path_from_outside_to_bed( village_id, plot_nr, bed_nr, front_door_nr );

continue to exist and help the mob to get from the front of the house to his bed and back. Some paths in houses with more than one front door (some can be found in sandcity) and some other paths may need to be recalculated, but in general it ought to (hopefully) work.
Attachments
family_on_walk.jpg
(59 KiB) Not downloaded yet
A list of my mods can be found here.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Tue Jul 11, 2017 13:28

Sokomine wrote:
ErrorNull wrote:Question for you: is there a way I can make grasshut not use the dryplants mod? It depends on the biomes_lib mod which I'd like to avoid for now. My villagers do not support grasshut yet. Ah and almost forgot it doesn't support 'ruins' village type either.

All you really need are the blocks it defines. Those are in reeds.lua as far as I can see. The dryplants mod also changes the default grass texture to something very nice looking.

Hmm.. I will look into this.
Sokomine wrote:New: Added navigation inside villages. Villages standing on a road or on a node directly adjacent to a road may request a path to another plot inside the village. This makes use of the road structure of the village generator and is quite inexpensive. The path generated is not necessarily the shortest - going straight over the grass and other plots may be faster - but it's the fastest using the roads. And what are roads for if not for travelling?

It makes sense for villagers to stay on the roads to walk from one plot to another. If villagers simply cut through the grass, fields, or gardens, the other villagers may not like that. these api functions will be very convenience. thanks!
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Fri Jul 14, 2017 15:14

Hi Sokomine! I'm about to release my stability update.. i've tested many times and my error nil errors happen very rarely now. But I've also ran into a new problem - and it's not with your mod.. and i think more about my understanding of entities and map generation.

I noticed that when a player walks away from a villager/entity about 40-50m (or blocks) then the entity de-spawns. which is fine, because i'v known this for a while. I also see that your function mg_villages.part_of_village_spawned() loops several times in order for a village to completely spawn. From what I can tell, this function loops until all the mapchunks surrounding it has appeared in the game. Once all the mapchunks have loaded, then this function no longer executes. Even when you exit the game and re-enter the game, this function no longer executes. Which, I'm sure there's a good reason.

My challenge is that, during gameplay I see many remote villages (or mostly single buildings) that can be 50 to 100 to 150 blocks away from the player attempt to spawn -- my debug output shows mg_villages.part_of_village_spawned() start looping and starts to spawn those villages far away. The problem is when I code my villagers to (attempt) to spawn that far away when your mg_villages.part_of_village_spawned() function calls, they do not appear in the game at all - because i suspect because it is farther than this 40-50 block limit where entities just de-spawn automatically. I'm thinking this is a minetest engine behvior? Wonder if there is a way to extend this range from 40 to like 200m?

So I tried setting your parameter mg_villages.VILLAGE_DETECT_RANGE to equal like 100 or even 50, but it doesn't seem to make a difference. As a workaround, my villager spawning code that is inside your mg_villages.part_of_village_spawned() function is instead skipping spawning during each loop until it detects that the player is at least 40 blocks away from the village spawn point. However, this results in my real issue: Those villages that attempt to spawn that are 40 blocks or more from the player will skip spawn and wait for the next loop. But if player never gets close enough, the villagers will not spawn... and eventually your mg_villages.part_of_village_spawned() function will run its course and never execute again.. and i'm left with some empty villages.

What ideas? I wonder if I might need to start considering ABM's .....
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Sat Jul 15, 2017 18:19

ErrorNull wrote:Hi Sokomine! I'm about to release my stability update.. i've tested many times and my error nil errors happen very rarely now. But I've also ran into a new problem - and it's not with your mod.. and i think more about my understanding of entities and map generation.

Nice to hear that there will soon be a new release. Mapgen and entities are complex areas and may always hold some surprises.

ErrorNull wrote:I noticed that when a player walks away from a villager/entity about 40-50m (or blocks) then the entity de-spawns. which is fine, because i'v known this for a while. I also see that your function mg_villages.part_of_village_spawned() loops several times in order for a village to completely spawn. From what I can tell, this function loops until all the mapchunks surrounding it has appeared in the game. Once all the mapchunks have loaded, then this function no longer executes. Even when you exit the game and re-enter the game, this function no longer executes. Which, I'm sure there's a good reason.

The entity doesn't really despawn. It just gets deactivated/unloaded and stored away in the mapchunk data. When the player "activates" the area again by getting nearby, the mob is loaded and recovers its state from what data it had stored before beeing deactivated. Mobs that want to i.e. "sleep" need to take special attention here. Otherwise they'll sleep when you walk away and just stand on the bed when you enter the area again after running away for a few seconds. Your assumption about the work of mg_villages.part_of_village_spawned is correct - it's called whenever a mapchunk which contains part or all of a village is generated. Mapchunks overlap by 16 blocks in each direction - so the function can be called several times for a specific position.

ErrorNull wrote:My challenge is that, during gameplay I see many remote villages (or mostly single buildings) that can be 50 to 100 to 150 blocks away from the player attempt to spawn -- my debug output shows mg_villages.part_of_village_spawned() start looping and starts to spawn those villages far away. The problem is when I code my villagers to (attempt) to spawn that far away when your mg_villages.part_of_village_spawned() function calls, they do not appear in the game at all - because i suspect because it is farther than this 40-50 block limit where entities just de-spawn automatically. I'm thinking this is a minetest engine behvior? Wonder if there is a way to extend this range from 40 to like 200m?

I'm sure you can extend the range of entity activity with a parameter, but that might be only of limited help. It will increase server load and might not cover all anyway. I thought so far that mobs spawned on mapchunks that where too far away where just stored away and deactivated immediately. This might also mean that the entity cannot be found when the next mapchunk with partly overlapping area generates and thus may lead to further problems...

ErrorNull wrote:So I tried setting your parameter mg_villages.VILLAGE_DETECT_RANGE to equal like 100 or even 50, but it doesn't seem to make a

That range just determines how many (and which) villages you see when you issue the "/villages" command.

ErrorNull wrote: difference. As a workaround, my villager spawning code that is inside your mg_villages.part_of_village_spawned() function is instead skipping spawning during each loop until it detects that the player is at least 40 blocks away from the village spawn point. However, this results in my real issue: Those villages that attempt to spawn that are 40 blocks or more from the player will skip spawn and wait for the next loop. But if player never gets close enough, the villagers will not spawn... and eventually your mg_villages.part_of_village_spawned() function will run its course and never execute again.. and i'm left with some empty villages.

What ideas? I wonder if I might need to start considering ABM's .....

ABMs (or perhaps LBMs? Not sure...) might be a better solution, yes. You can still use the mg_villages.part_of_village_spawned function for general data maintenance and manipulation. There are quite a lot of situations where "spawn mob once and then let it do its jobs" just doesn't work. The player might walk away and come back at a later time - when a totally diffrent behaviour of the mob is expected. Or you might take some time exploring and enter a village for the first time at night. Now mobs ought to be in their beds, sleeping, with only the occasional guard wandering around randomly. Or you visit a village at day. Now you'd expect the mobs to be at their work places and not sleeping. Their workplaces may be some distance away from their homes. If they just start walking there when you come it's too late. I'm afraid mobs will not only have to store where they want to go - but also at which time they expect to arrive at their target (calculating the length of the path is pretty straightforward), how long they want to stay, and in general teleport to where they think they ought to be at the time when they are activated. There might be some overlap in time, i.e. 22-6 sleep, 6-8 go to workplace, 8-12 work, 12-13 sit down and eat, 13-18 work, 18-21 go to spare time activity, 21-22 go to bed. A mob activated at 5:59 might teleport to his bed and sleep instantly, while one activated at 6:01 or 7:59 will go from where he is to his workplace. A mob activated at 8:01 will instantly teleport to his workplace and work there and so on. Diffrent mobs may even require diffrent timetables. Babies and sick mobs might even stay in bed, offering tasks the player could do for them.

I'm considering adding mob spawners to all plots. Those without beds or even workers would then more or less only indicate "this plot got activated; if any mob wants to do anything here now - now's the time".

Certain buildings (forge, school, church, pub, ...) will get a marker added that tells mg_villages the favorite spot of the mob working there. Detecting that automaticly is close to impossible. Yet players will expect the bartender to be (mostly) behind his bar, the smith to love his anvil, the teacher and priest to stand in the front, the major beeing there for people to talk to, and so on.

The mob spawners will also be burried in the ground in the future. Having them visible next to the plotmarker was useful for debugging but is not good for later gameplay. They'll be hidden 1 or 2 blocks lower.
A list of my mods can be found here.
 

User avatar
BirgitLachner
Member
 
Posts: 358
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] Villages for Minetest [mg_villages]

by BirgitLachner » Thu Jul 27, 2017 10:52

Does it make sense to mg-villages with Etherreal Mod?

I tried a setting an it was quite boring, because I had snow and ice anywhere.
 

User avatar
ErrorNull
Member
 
Posts: 199
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Villages for Minetest [mg_villages]

by ErrorNull » Thu Jul 27, 2017 12:29

Sokomine wrote: Mapchunks overlap by 16 blocks in each direction - so the function can be called several times for a specific position.
I see. That is something very interesting I didn't know.

Sokomine wrote:I'm afraid mobs will not only have to store where they want to go - but also at which time they expect to arrive at their target (calculating the length of the path is pretty straightforward), how long they want to stay, and in general teleport to where they think they ought to be at the time when they are activated. There might be some overlap in time, i.e. 22-6 sleep, 6-8 go to workplace, 8-12 work, 12-13 sit down and eat, 13-18 work, 18-21 go to spare time activity, 21-22 go to bed. A mob activated at 5:59 might teleport to his bed and sleep instantly, while one activated at 6:01 or 7:59 will go from where he is to his workplace. A mob activated at 8:01 will instantly teleport to his workplace and work there and so on. Diffrent mobs may even require diffrent timetables. Babies and sick mobs might even stay in bed, offering tasks the player could do for them.
That is a nuance that I've come to realize as well. Once a player leaves the village, the villagers are unloaded and their actions are 'paused'. Once the player returns as some time later, the villager will re-activate. At this point, I must code for the villager to check the time of day and instantly teleport/skip to the actions they should be doing based on their daily schedule. Villagers will smoothly transition from one daily activity to the next only when the villagers have not been unloaded (eg player is nearby). This is a very interesting problem I will look forward to working on once i've reached version 0.2x - following version roadmap.

Sokomine wrote:I'm considering adding mob spawners to all plots. Those without beds or even workers would then more or less only indicate "this plot got activated; if any mob wants to do anything here now - now's the time".
This would also be great for the 'single' buildings that spawn around the map.. because for now those w/out mob spawners look like empty/lonely buildings with no villagers in the middle of nowhere.

Sokomine wrote:Certain buildings (forge, school, church, pub, ...) will get a marker added that tells mg_villages the favorite spot of the mob working there. Detecting that automaticly is close to impossible. Yet players will expect the bartender to be (mostly) behind his bar, the smith to love his anvil, the teacher and priest to stand in the front, the major beeing there for people to talk to, and so on.
Very nice! Otherwise I would need to search neaby nodes for an anvil (smith) or red carpet (church) or a table spot (pub) or something specific for each building schem type for the villager to understand to stay near.

Sokomine wrote:The mob spawners will also be burried in the ground in the future. Having them visible next to the plotmarker was useful for debugging but is not good for later gameplay. They'll be hidden 1 or 2 blocks lower.
Once you move the spawners lower, i'll be sure to update my code so that the villagers spawn y+1 or +2 from the spawner, or the poor villagers will be buried alive on spawn. lol.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Villages for Minetest [mg_villages]

by Sokomine » Thu Jul 27, 2017 16:15

BirgitLachner wrote:Does it make sense to mg-villages with Etherreal Mod?

Definitely! Ethereal has very nice biomes. The trees it provides are used as tree and wood material for the villages. During development I regulary tested with RealTest and Ethereal. I didn't do so recently but don't expect any real problems either - except that blocks added too recently will not be recognized as ground or tree material.

BirgitLachner wrote:I tried a setting an it was quite boring, because I had snow and ice anywhere.

Did you choose mapgen v7? Ethereal requires that. Else you'll get a very diffrent world without most of the biomes Ethereal provides.

ErrorNull wrote:That is a nuance that I've come to realize as well. Once a player leaves the village, the villagers are unloaded and their actions are 'paused'. Once the player returns as some time later, the villager will re-activate. At this point, I must code for the villager to check the time of day and instantly teleport/skip to the actions they should be doing based on their daily schedule. Villagers will smoothly transition from one daily activity to the next only when the villagers have not been unloaded (eg player is nearby). This is a very interesting problem I will look forward to working on once i've reached version 0.2x - following version roadmap.

Good luck! Solving this problem might be something very crucial for any mob mod that tries to simulate activity.

ErrorNull wrote:
Sokomine wrote:I'm considering adding mob spawners to all plots. Those without beds or even workers would then more or less only indicate "this plot got activated; if any mob wants to do anything here now - now's the time".

This would also be great for the 'single' buildings that spawn around the map.. because for now those w/out mob spawners look like empty/lonely buildings with no villagers in the middle of nowhere.

I'm not sure yet how much it will really help. Inside villages, mobs might need to be told that the plot they think they want to be at has been activated. Lone buildings with neither beds nor workplace are probably another problem. What should a mob do there? He might be just passing by, same as the player...

ErrorNull wrote:Very nice! Otherwise I would need to search neaby nodes for an anvil (smith) or red carpet (church) or a table spot (pub) or something specific for each building schem type for the villager to understand to stay near.

Newer versions of mg_villages have modified buildings that come with a workplace marker. The marker doesn't look good - it is flat and uses the player's skin as a texture. I'd prefer a texture that shows just some footprints next to each other, indicating that someone was standing here for a long time. Anyway...the workplace markers exist now, and paths from them to the outside are calculated and stored. Calculation of all paths from beds and workspace markers to the outside takes about ~20 seconds on my machine. The calculation was done once and the result stored for quick access.

Not all is fine yet. The paths calculated are paths that the mob might realisticly walk - provided the mob knows how to. Some places like i.e. pubs and shops use hatches to seperate customer and counter. Neither movement code nor mob_world_interaction know weather they have to right-click the hatch now in order to open it or not. Several houses did need some slight adjustments so that the paths could be calculated at all. A thin wooden slab from cottages as a wall looks very decorative, but the pathfinder has no idea how to create a path through that.

This is how a workplace marker looks from above:
Image

ErrorNull wrote:Once you move the spawners lower, i'll be sure to update my code so that the villagers spawn y+1 or +2 from the spawner, or the poor villagers will be buried alive on spawn. lol.

We don't want to risk that :-) The best way to get the correct height would be through mg_villages.all_villages[ village_id ].vh+1 (=the air node above the villages surface).

I'm also improving the formspecs. Clicking on "Who lives here" on a plotmarker will show a formspec with the list of all inhabitants. Clicking on a particular inhabitant will show details about it. "Back" will go back to the plot list, and back from the plotlist is the list of villages. There are also next and prev(ious) buttons.

There's some more work needed, and the current implementation might be slightly broken. Villages will in the future get their bed positions calculated from the bed positions the original blueprint has, with the building's position and rotation applied as offset. This is necessary in order to use the precalculated paths. Workplace markers need to be assigned to mobs. I hope to be able to eliminate the last bugs and release the new version very soon.
Attachments
workplace_marker.jpg
(63.92 KiB) Not downloaded yet
A list of my mods can be found here.
 

User avatar
BirgitLachner
Member
 
Posts: 358
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] Villages for Minetest [mg_villages]

by BirgitLachner » Thu Jul 27, 2017 18:37

@sokomine ... Okay ... then I'll try my choosen Mods with Etherreal ... and use adapted values that I don't have so much of the lava- and mushroom-biomes.
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 6 guests