[Mod] Advanced NPC (WIP) [advanced_npc]

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

[Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Sat Jun 17, 2017 17:49

127 commits and 7 months later, it finally goes public!

Advanced NPC mod adds what many many people around in the Minetest community have been looking for: villagers! This mod features NPCs which you can interact with in many ways, and that they also know how to interact with their environment.

Advanced NPC is inspired on the Harvest Moon games which features NPCs which you can talk, trade, befriend and actually simulate having some kind of life. While still a WIP mod, Advanced NPC can already do all of this and have a strong foundation to grow even more.

This mod is WIP and it is currently at alpha state. There is a lot to add, specially in terms of content (textures, dialogue lines, etc.). For progress or a list of which has to be finished in route to version 1.0, please see https://github.com/hkzorman/advanced_npc/issues/10

Rough demo video:
https://www.youtube.com/watch?v=6iBNTnCv-XQ

Current features:
  • Dialogues: You can talk with the NPCs!
  • Trading: NPCs can trade with you in various ways
  • Actions: NPCs know how to walk to places, use furnaces, beds and even sit in a bench
  • Schedules: NPCs can perform different actions depending on the time of the day
  • Relationships: You are able to establish friendships and maybe even "romantic" relationships with NPCs
  • Support for mg_villages mod: NPCs will spawn in suitable building (e.g. houses, farms) found in the villages of this mod.
For the best experience, use alongside mg_villages mod so that you can see a village spring to life! Once you have a village in the map, the plotmarkers of suitable buildings will be replaced and NPCs will start spawning on them! These NPCs will have information of the building they spawn on, like where is the entrance and where are the beds. They will also walk into/out the building during different times of the day.
You can also spawn NPCs yourself by using the spawn egg, but these NPCs won't know anything of their environment.

Planned features (lots!):
  • Occupations: NPCs will have some Minetest-suitable job: they can be miners, wood-cutters, etc.!
  • Support for custom buildings: You will be able to place to populate your own buildings with NPCs
  • Player-like actions: NPCs will be able to tame and own animals, ride carts, etc.
  • Communities: The end-goal of this mod is that villages are automatically populated and create communities within them, e.g. some kind of government and economic activity simulation will be put in place on a village!
For more details, please check the wiki: https://github.com/hkzorman/advanced_npc/wiki


For developers:
Please note that Advanced NPC is planned to be a framework, a mod you can include to make your own NPCs and use the functions provided here. However, the API is heavily undocumented, and is still not friendly enough yet to include anywhere. This will be improved in the future.


Download:
Latest stable version (alpha-1): https://github.com/hkzorman/advanced_npc/releases/tag/1.0.0-alpha-1

Latest development version: https://github.com/hkzorman/advanced_npc/archive/master.zip (always points to latest version!)
WARNING: From now on, there will be no promise that latest code in Github will be stable. I will do my best to keep it stable but expect bugs and incomplete behavior! Also expect broken compatibility with alpha-1 version.

Browse the code: https://github.com/hkzorman/advanced_npc


License: GPLv3.0


Dependencies:
  • default
  • mobs_redo


Credits: The pathfinder code currently used by the NPC is currently almost entirely based on MarkBu's pathfinder https://github.com/MarkuBu/pathfinder code. NPCs wouldn't be smart without it, thanks!


Screenshots:

Image
Image
Image
Image
Image
Last edited by zorman2000 on Sat Oct 07, 2017 19:13, edited 7 times in total.
 

User avatar
Andrey01
Member
 
Posts: 1842
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Andrey01 » Sat Jun 17, 2017 18:56

Advanced NPC like Alive Ai mod as those mobs are advanced, too. But to see their interesting!
I like and i am learning to build nice and great houses, palaces, infrastructures and etc... in Minetest!
My Mods:
Unfinished:Medicine,Cube Nodes.

Old:Sweet Machine,Drink Machine

My Favourite Servers:
just test, Switchboard PvP made by yngwie123, VanessaE`s creative-building server, Parkour Owned by LoweGaming, Fractal Island and some other servers!
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by ErrorNull » Sat Jun 17, 2017 18:59

Hi zorman2000 - I tried your NPCs and i wish it existed like months ago! ;) There are no other NPC mods that i am aware that you can choose what to say and the NPC will respond. That's cool. It's great to see more villagers/npc mods out there now as there can be more choice for minetest players... and our mods have a slightly different focus to fit different tastes. if anyone is curious you can also check out my villagers here (viewtopic.php?f=9&t=17915)

I also accidentally punched one of the NPCs and it beat the crap out of me. Haha. In my villagers mod, players will not be able to fight with the villagers which might take away from the realism a bit, but to me it will make villagers seem more permanent to each village. Keep up the nice work!
 

User avatar
TenPlus1
Member
 
Posts: 2222
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by TenPlus1 » Sat Jun 17, 2017 19:20

Nicely done :) gonna play with this mod for a while :P
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Sat Jun 17, 2017 23:35

Andrey01 wrote:Advanced NPC like Alive Ai mod as those mobs are advanced, too. But to see their interesting!

Alive AI, and correct me if I'm wrong, is more about bots, e.g. trying to simulate players. Advanced NPC is more about NPCs who are villagers, and try to interact with the players and their own environment.


ErrorNull wrote:There are no other NPC mods that i am aware that you can choose what to say and the NPC will respond. That's cool

This will be what this mod will be about: interaction. Players will be able to interact with the NPCs by talking, trading and establishing relationships. Maybe even more, like hiring some of them, or working for them!

ErrorNull wrote:... check out my villagers here (viewtopic.php?f=9&t=17915)
I also accidentally punched one of the NPCs and it beat the crap out of me. Haha. In my villagers mod, players will not be able to fight with the villagers which might take away from the realism a bit, but to me it will make villagers seem more permanent to each village. Keep up the nice work

Your mod looks awesome. Specially the fact that they adapt to different climates and get different appearances is amazing. I definitely need to add more graphic content to my mod! Yours excel on that. And I agree, villagers have been something asked now for some time by many people. Having different tastes will help satisfy all of them!
Thank you and keep the good work as well!


TenPlus1 wrote:Nicely done :) gonna play with this mod for a while :P

Thank you TenPlus1! I really like your mods, so this is an honor for me! And thanks for answering all those questions I had at some point about mobs_redo... all of them were actually for the development of this mod! Thanks!
 

User avatar
azekill_DIABLO
Member
 
Posts: 7275
Joined: Wed Oct 29, 2014 20:05
Location: Under my desk (but I can't see my monitor now X'[ )
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Sun Jun 18, 2017 19:02

zorman2000 wrote:There are lots of mobs mods around, three major attempts at creating NPCs (npcf, villagers and peaceful_npcs mods)

Don't forget the other mods like societies - which does a pretty good job in small scale - or the working villages mod. Both more or less try to add villagers. peaceful_npc just tries to add friendly lifeforms to the world which don't attack you on sight - something that was needed when the first mob mods turned up and where full of hostile creatures. The more modern aliveai does achieve a lot as well - although the mobs there are not ideal as villagers.

zorman2000 wrote:Actions: NPCs know how to walk to places, use furnaces, beds and even sit in a bench

The npc managed to move around in my small houses and even found their beds at night. I havn't seen one using a bench so far. And leaving an area and returning later to it has the mobs standing on their beds. They don't remember that they're sleeping. I forgot that when testing sleeping at first as well. Tenplus1 says mobs_redo can store the animation. The mobs also had some trouble leaving the bed. I've got a function for finding a place next to a bed in mob_world_interaction.

zorman2000 wrote: Schedules: NPCs can perform different actions depending on the time of the day

That's very nice! They could wash themshelves in the morning, go to the church, then to work, and spend a nice evening in the tavern :-)

The changes I did to burlis pathfinder in mob_world_interaction are not limited to cottages:wood_flat. They detect nodes of similar shape and accept them as ceilings (not yet as floors...still work to do there).

Positions of beds can be provided by mg_villages. Also potential spawn positions in front of the house. The function now takes an optional parameter so that each mob in a house will get a diffrent position in front of the house. If you're intrested in positions of benches, chests, furnaces and doors as well, at least some of those could be provided. But I'm uncertain about benches. NPC ought to sit on random benches they encounter. Beds aren't usually shared...benches are. Chests may be more of a decorative item.

In general the family structure and job assignment done by mg_villages ought to be good enough for medieval villages. The mobs might still need things to do - after all it's more exciting for the player to watch a lumberjack than to just trade with a mob that stands around all day and is supposed to perform a medieval crafting job.

zorman2000 wrote:-- - The NPC will know the location of one chest, one bench and one furnace
-- - A life timer for the NPC will be created (albeit a long one). Once the NPC's
-- timer is invoked, the NPC will be de-spawned (dies). The spawner should keep
-- track of these.
-- - If a NPC has died, the spawner will choose with 50% chance to spawn a new NPC.

Won't they eventually die out if they respawn only with a 50% chance? Some replacement of mobs may be necessary when they get killed by hostile mobs or even players. Still, letting them die or grow up is a bit much of interaction IMHO.

I'm glad that you released the mod. Perhaps it's possible to cooperate with ErrorNull? Both mods are slightly diffrent (and will eventually stay that way) but they also have a lot in common. ErrorNull's design of mobs with diffrent appearance is great, while movement is less developped in his mod than in your advanced_npc.
A list of my mods can be found here.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7275
Joined: Wed Oct 29, 2014 20:05
Location: Under my desk (but I can't see my monitor now X'[ )
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by azekill_DIABLO » Mon Jun 19, 2017 15:06

i especially like the trader UI, it's very clean and easier to understand than the one of mobf_trader
【Voxellar 2.0】 ; 【MILA】 update ; 【Rec_a_MT】 ; 【BB,HD】 update ; 【▶ Youtube】 This person worked too hard to be forgotten: Feedback me!
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Tue Jun 20, 2017 01:20

Sokomine wrote:Don't forget the other mods like societies - which does a pretty good job in small scale - or the working villages mod. Both more or less try to add villagers. peaceful_npc just tries to add friendly lifeforms to the world which don't attack you on sight - something that was needed when the first mob mods turned up and where full of hostile creatures. The more modern aliveai does achieve a lot as well - although the mobs there are not ideal as villagers.

Thanks. I'm aware of all these mods, and they are great. However, none of them could really give me RPG-style NPCs where NPCs simulate being alive. Specially, if you are aware of Harvest Moon games, then you know those NPCs look *very* much alive. Advanced NPC is here to attempt to bring that kind of NPC to Minetest.

Sokomine wrote:The npc managed to move around in my small houses and even found their beds at night. I havn't seen one using a bench so far. And leaving an area and returning later to it has the mobs standing on their beds. They don't remember that they're sleeping. I forgot that when testing sleeping at first as well. Tenplus1 says mobs_redo can store the animation. The mobs also had some trouble leaving the bed. I've got a function for finding a place next to a bed in mob_world_interaction.

True, thanks for mentioning this issues. I know some very strange paths to leave beds (through the roof that's it!) and that if you leave and come back they aren't sleeping anymore, I need to fix these issues. Will check your functions as well.
They didn't used benches because they were not being aware of them existing, something I added now!

Sokomine wrote:That's very nice! They could wash themshelves in the morning, go to the church, then to work, and spend a nice evening in the tavern :-)

The changes I did to burlis pathfinder in mob_world_interaction are not limited to cottages:wood_flat. They detect nodes of similar shape and accept them as ceilings (not yet as floors...still work to do there).

Positions of beds can be provided by mg_villages. Also potential spawn positions in front of the house. The function now takes an optional parameter so that each mob in a house will get a diffrent position in front of the house. If you're intrested in positions of benches, chests, furnaces and doors as well, at least some of those could be provided. But I'm uncertain about benches. NPC ought to sit on random benches they encounter. Beds aren't usually shared...benches are. Chests may be more of a decorative item.

In general the family structure and job assignment done by mg_villages ought to be good enough for medieval villages. The mobs might still need things to do - after all it's more exciting for the player to watch a lumberjack than to just trade with a mob that stands around all day and is supposed to perform a medieval crafting job.

Yes, that will be the general idea going forward: schedules will support different actions on different days, so, for example, on day 7, they all go to church. That however, is some way to come!
They will definitely get a lot to do - soon. My next item on the list are occupations, or jobs. These will, at the very least, simulate farming, woodcutting, mining, cooking, smithing, etc. The NPCs will not be trader all day either. They will only trade within certain times. That is also coming soon.

I really need to check all this updates for mg_villages to see how to incorporate them!

Sokomine wrote:Won't they eventually die out if they respawn only with a 50% chance? Some replacement of mobs may be necessary when they get killed by hostile mobs or even players. Still, letting them die or grow up is a bit much of interaction IMHO.

That is old writing, and in all honesty, I'm not sure I will be implementing this. There are many scenarios. One would be to see a village's progression across time, so NPCs would have to grow old, and die, but also they have to reproduce. So, basically, I have said spawn with 50% chance as they will probably have children in their lifetime. However, another scenario would be conquering games. What if a bloodthirsty player wants to conquer a village and kill all NPCs? Well, if they keep spawning once they die, the player will never meet its goal. It is hard to choose what to do in this case, so that is future work!

Sokomine wrote:I'm glad that you released the mod. Perhaps it's possible to cooperate with ErrorNull? Both mods are slightly diffrent (and will eventually stay that way) but they also have a lot in common. ErrorNull's design of mobs with diffrent appearance is great, while movement is less developped in his mod than in your advanced_npc.

Thanks! We will see. For now, I have a clear direction of where I want Advanced NPC to go. I love the appearance of ErrorNull's villagers, maybe there can be some kind of cooperation in this regard.

azekill_DIABLO wrote:i especially like the trader UI, it's very clean and easier to understand than the one of mobf_trader

Thanks!! I literally spent hours designing and testing it to get it right. Hopefully all formspecs introduced to this mod will keep the clean design!
 

User avatar
Diamond knight
Member
 
Posts: 416
Joined: Sun Apr 19, 2015 19:50
Location: Sol 3 (aka earth for you science noobs)
In-game: Diamondknight or diamond_knight

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Diamond knight » Tue Jun 20, 2017 01:23

the clilderen maybe need to be made a little bigger, maybe 75% size of adults, they currently look unnaturaly small :P
Join The United Empire of Ferrum, a new virtual society gaming clan that uses real world military and financial tactics to achieve victory. We are currently looking for new politicians for the clan. [url]theunitedempireofferrum.weebly.com[/url]
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Tue Jun 20, 2017 01:27

Update:

Bugfix:
  • The "/restore_plotmarkers" command wasn't clearing all metadata; it should now.

Added:

  • NPCs now are aware of sits, furnaces and storage nodes (chests, shelves for now) that are in their homes!
  • In their basic daily schedule, NPCs now sit from 12 - 1 on one of the benches in their home.

Here is one NPC seated "enjoying lunch"...

Image

Note that this functionality is still WIP and will remain some time like that. NPCs are currently not sitting all together at the table to have lunch. This will be, hopefully, done in the future.
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Tue Jun 20, 2017 01:30

Diamond knight wrote:the clilderen maybe need to be made a little bigger, maybe 75% size of adults, they currently look unnaturaly small :P


Heh, I agree! This is currently due to mobs_redo having children set to 50% of the adults' size. I will be looking into this. Children are pretty WIP, there are many issues with them, like not keeping their textures on restart or growing out all of a sudden :)
 

User avatar
Diamond knight
Member
 
Posts: 416
Joined: Sun Apr 19, 2015 19:50
Location: Sol 3 (aka earth for you science noobs)
In-game: Diamondknight or diamond_knight

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Diamond knight » Tue Jun 20, 2017 02:34

maybe the 50% size ones could be "toddlers" instead of "school age" kids or something,

also maybe have randomly generated textures similar to the creatures modpack (the one with body jumping not the CME one)

and some of the formspecs are buggy, sometimes the npcs do not trade with me when I click the buy or sell button when they randomly come up standalone, it also does not bring up giving the mob an item 95% of the time when I right click mob with item in hand
Join The United Empire of Ferrum, a new virtual society gaming clan that uses real world military and financial tactics to achieve victory. We are currently looking for new politicians for the clan. [url]theunitedempireofferrum.weebly.com[/url]
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Tue Jun 20, 2017 19:35

zorman2000 wrote:Thanks. I'm aware of all these mods, and they are great. However, none of them could really give me RPG-style NPCs where NPCs simulate being alive. Specially, if you are aware of Harvest Moon games, then you know those NPCs look *very* much alive. Advanced NPC is here to attempt to bring that kind of NPC to Minetest.

I just mentionned those mods because you already listed some. At least aliveai seems to have a similar goal - NPC simulating beeing alive. Just not beeing villagers. There might still be some overalp. I'm not really aware of the Harrvest Moon games. All I know about them is what Meldrian (a MT player and youtuber) showed in some of his videos.

zorman2000 wrote:True, thanks for mentioning this issues. I know some very strange paths to leave beds (through the roof that's it!)

*g* No big surprise there. A lot of beds are below the roof. And if the NPC jumps once, he'll stand on top of the roof and plot his path from there. Thus the find-place-to-stand-function.

zorman2000 wrote:Yes, that will be the general idea going forward: schedules will support different actions on different days, so, for example, on day 7, they all go to church. That however, is some way to come!

That Harvest Moon game seems to be day-based from what I saw. A MT day last 20 minutes, so there'll be a sunday every 120 minutes. That might be rather impractical. I think they ought to gather randomly or when i.e. the player starts something (rings the bell, talks to the priest, ...)

zorman2000 wrote:They will definitely get a lot to do - soon. My next item on the list are occupations, or jobs. These will, at the very least, simulate farming, woodcutting, mining, cooking, smithing, etc. The NPCs will not be trader all day either. They will only trade within certain times. That is also coming soon.

Very nice! But keep in mind that it's enough if they make the player believe that they might be doing that job :-) Illusion does count a lot. A proper skin helps, and even just random walking is sometimes sufficient.

zorman2000 wrote: There are many scenarios. One would be to see a village's progression across time, so NPCs would have to grow old, and die, but also they have to reproduce. So, basically, I have said spawn with 50% chance as they will probably have children in their lifetime. However, another scenario would be conquering games. What if a bloodthirsty player wants to conquer a village and kill all NPCs? Well, if they keep spawning once they die, the player will never meet its goal. It is hard to choose what to do in this case, so that is future work!

Growing old takes time. It's a lot that would have to be simulated. And eventually you won't be able to re-visit your old game as the generation you befriended did grow old and now there're all those children around who grew old and run the job now...I don't think it's a good idea for a game like this. And players conquering villages by killing everyone...that's not very friendly of the player. Without support from other mobs, the player ought to end up dead. Else it does get too unrealistic.

As far as marrying one of the villagers is concerned: Each house gets an adult male first. That male gets a job - either at his house or at a place that requires a worker and hasn't beds. If there's a second bed in the house, a wife will be added. Further beds are assigned to children, with the parents of the worker thrown in randomly. If you really want the player to be able to marry a villager, you'd have to make some of the children old enough. That ought to be no big problem. Just make sure that their parents (and the parent's parents) are old enough as well.

zorman2000 wrote: NPCs now are aware of sits, furnaces and storage nodes (chests, shelves for now) that are in their homes!
In their basic daily schedule, NPCs now sit from 12 - 1 on one of the benches in their home.
Here is one NPC seated "enjoying lunch"...

That's great :-) I love that functionality. Will have to watch them doing it soon :-)

zorman2000 wrote:Note that this functionality is still WIP and will remain some time like that. NPCs are currently not sitting all together at the table to have lunch. This will be, hopefully, done in the future.

That might be too complicated. In general, NPC ought to be intrested in NPC and choose to stand (or sit) close to others for having a little chat. As far as benches go - let them sit so that they take a look at the nearby table. But that's probably something for mob_sitting in mob_world_interaction.

The function mg_villages.inhabitants.spawn_one_mob( bed, village_id, plot_nr, bed_nr, bpos ) now gets village_id, plot_nr and bed_nr supplied as well. With that it ought to be easier to spawn the pre-definied inhabitants.
A list of my mods can be found here.
 

User avatar
Diamond knight
Member
 
Posts: 416
Joined: Sun Apr 19, 2015 19:50
Location: Sol 3 (aka earth for you science noobs)
In-game: Diamondknight or diamond_knight

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Diamond knight » Tue Jun 20, 2017 22:51

Maybe a way to tell who lives in a house easier, and a good randomized texture made of different parts as opposed to full random texture we have for males now (too hard to tell villagers apart, would be a nightmare if you married :P), also there is an issue where even if a player buys a house they are constantly annoyed by a whole other family that lives there
Join The United Empire of Ferrum, a new virtual society gaming clan that uses real world military and financial tactics to achieve victory. We are currently looking for new politicians for the clan. [url]theunitedempireofferrum.weebly.com[/url]
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Wed Jun 21, 2017 02:25

Diamond knight wrote:Maybe a way to tell who lives in a house easier,

You get that information by right-clicking on the plotmarker. It's currently more of a debug function than anything else and certainly needs better presentation in the future.

Diamond knight wrote: and a good randomized texture made of different parts as opposed to full random texture we have for males now (too hard to tell villagers apart, would be a nightmare if you married :P),

See the villagers mod by ErrorNull for that. The mobs there have very individual and nice textures.

Diamond knight wrote:also there is an issue where even if a player buys a house they are constantly annoyed by a whole other family that lives there

That's right. The houses are already taken and people live there. You can buy their houses - but that doesn't mean that you can automaticly throw out who lives there. Same as RL. The plots of type "empty" are those players are supposed to buy and settle down on. Perhaps those plots are a bit too small and few right now.
A list of my mods can be found here.
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Thu Jun 22, 2017 18:21

Diamond knight wrote:maybe the 50% size ones could be "toddlers" instead of "school age" kids or something,

While I don't think I'm going so detailed on ages, I agree that 50% is too small. Btw, I tested with 75% and they are too big. I will try to come up with a good percentage.

Diamond knight wrote:also maybe have randomly generated textures similar to the creatures modpack (the one with body jumping not the CME one)
..and a good randomized texture made of different parts as opposed to full random texture we have for males now (too hard to tell villagers apart, would be a nightmare if you married :P)...

What you suggest is great, and I would like to be able to do this. And while appearance is important, I'm not 100% sure I will work on this next. I really want to focus on the simulation aspects, like occupations, relationships, etc. and then I will work on this random/dynamic appearance system you are suggesting. For now, I will be providing a good variety of textures, in the hope that it fills the gap until I can work on the random appearance generation.

Diamond knight wrote:and some of the formspecs are buggy, sometimes the npcs do not trade with me when I click the buy or sell button when they randomly come up standalone, it also does not bring up giving the mob an item 95% of the time when I right click mob with item in hand

I'm not able to reproduce this issue, I don't have any issue. Maybe it is lag? On a local server with two players, I can get lag from lots of NPCs using pathfinding, but not from formspecs. If you can provide more details, it would be appreciated!

Diamond knight wrote:Maybe a way to tell who lives in a house easier, ... also there is an issue where even if a player buys a house they are constantly annoyed by a whole other family that lives there

Agreed! I plan to make a nice formspec to see information about each house.
Also, I guess what you mention is a legitimate issue, and maybe it is better to disable buying houses with NPCs.


Sokomine wrote:*g* No big surprise there. A lot of beds are below the roof. And if the NPC jumps once, he'll stand on top of the roof and plot his path from there. Thus the find-place-to-stand-function.

I have one (not very specialized though), and NPCs should be not standing on the bed, but on the floor. I will revisit this, and will check this function you mention, probably will be useful, thanks.

Sokomine wrote:That Harvest Moon game seems to be day-based from what I saw. A MT day last 20 minutes, so there'll be a sunday every 120 minutes. That might be rather impractical. I think they ought to gather randomly or when i.e. the player starts something (rings the bell, talks to the priest, ...)

They are! Just like Minetest, 1 minute in real life = 1 hour in the game. I really don't mind that Sunday comes aprox. 120 minutes. It would be cool, the mymonths mod does this as well. However, as I said, I'm not really going to work on this yet. For now, schedules are the same every day.

Sokomine wrote:Very nice! But keep in mind that it's enough if they make the player believe that they might be doing that job :-) Illusion does count a lot. A proper skin helps, and even just random walking is sometimes sufficient.

I agree and that's how I'm going to do it. I planned before to do it extremely realistic, but I decided that's *really* impractical and complicated to do.

Sokomine wrote:Growing old takes time. It's a lot that would have to be simulated. And eventually you won't be able to re-visit your old game as the generation you befriended did grow old and now there're all those children around who grew old and run the job now...I don't think it's a good idea for a game like this. And players conquering villages by killing everyone...that's not very friendly of the player. Without support from other mobs, the player ought to end up dead. Else it does get too unrealistic.

As far as marrying one of the villagers is concerned: Each house gets an adult male first. That male gets a job - either at his house or at a place that requires a worker and hasn't beds. If there's a second bed in the house, a wife will be added. Further beds are assigned to children, with the parents of the worker thrown in randomly. If you really want the player to be able to marry a villager, you'd have to make some of the children old enough. That ought to be no big problem. Just make sure that their parents (and the parent's parents) are old enough as well.

I agree with your first paragraph, and for the moment, the decision is that they will not neither get old nor re-spawn if killed.
Regarding the second, I 100% agree. I noticed the issue as soon as I got to play and noticed that almost all houses have couples. That is good to some extent: too many options to marry isn't good I think. But yeah, definetely there has to be, either more grown-up children, or man and woman couples which are not husband and wife. They could be brothers, for instance, living in that home. However, specified family relationships among NPCs in a house is also something I haven't worked on, so don't feel bad for trying to marry a man or a woman in a house with a couple... who knows what their relationship is!

Sokomine wrote:That might be too complicated. In general, NPC ought to be intrested in NPC and choose to stand (or sit) close to others for having a little chat. As far as benches go - let them sit so that they take a look at the nearby table.

It is really not too complicated. I don't aim for perfection, but a good simulation. So, it is enough to limit the list of sits NPCs can use to only those around tables. There is a pretty good chance that they will end up around the same table. In any case, being seated by a table increases the illusion of eating rather than being seated by a bedside bench.
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Thu Jun 22, 2017 18:45

Update:
I will be updating in Github soon with some bugfixes and some minor changes to schedules, just as a demo to what they are capable of doing.
However, my main focus is currently in occupations/jobs. Unfortunately, I will probably be out for a few days until next week, so more news coming later.

Thanks for all the support, ideas and suggestions so far! Stay tuned because there are still lots to come!
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Thu Jun 22, 2017 23:24

zorman2000 wrote: really want to focus on the simulation aspects, like occupations, relationships, etc. and then I will work on this random/dynamic appearance system

ErrorNull did excellent work on the skins of the mobs. Why not take that work and include it? There's no point in creating that twice.

zorman2000 wrote:Also, I guess what you mention is a legitimate issue, and maybe it is better to disable buying houses with NPCs.

Those are mostly for those lazy players who want to buy houses built by other players for whatever reasons they may have. The empty plots are reserved for players who want to build their own house. The others...have to see weather the people living in their houses will pay rent (probably not :)).

zorman2000 wrote:But yeah, definetely there has to be, either more grown-up children, or man and woman couples which are not husband and wife. They could be brothers, for instance, living in that home. However, specified family relationships among NPCs in a house is also something I haven't worked on, so don't feel bad for trying to marry a man or a woman in a house with a couple... who knows what their relationship is!

The lumberjack houses are an exception to the family generation. They have male workers only - no women and children. So, in a way there are too few women. Increasing the age of a sufficient amount of children would probably be best. Then the player might also have to persuade the parents to let him/her marry his/her desired wife/husband.

zorman2000 wrote:However, my main focus is currently in occupations/jobs.

Very good! I'm looking forward to it.
A list of my mods can be found here.
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Tue Jun 27, 2017 21:40

mg_villages now comes with mob spawners. They're currently well-visible in front of the houses (next to the plotmarker). Right-clicking one gives information about the particular inhabitant for which the spawner us responsible. The spawner doesn't spawn anything. It's more like a placeholder for accessing the information about the inhabitants and for toher mods (like advanced_npc here or villagers) to overwrite and make use of. And it's a uniq place for each inhabitant. There can be as many inhabitants as there are beds (normal bed, fancy bed or cottages bed).
A list of my mods can be found here.
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Fri Jun 30, 2017 11:33

Sokomine wrote:ErrorNull did excellent work on the skins of the mobs. Why not take that work and include it? There's no point in creating that twice.

I agree, will see how to cooperate with ErrorNull in the future for this.

Sokomine wrote:Those are mostly for those lazy players who want to buy houses built by other players for whatever reasons they may have. The empty plots are reserved for players who want to build their own house. The others...have to see weather the people living in their houses will pay rent (probably not :)).

I agree, and I will disable buying on NPC-owned houses.

Sokomine wrote:The lumberjack houses are an exception to the family generation. They have male workers only - no women and children. So, in a way there are too few women. Increasing the age of a sufficient amount of children would probably be best. Then the player might also have to persuade the parents to let him/her marry his/her desired wife/husband.

What happens in lumberjack houses is that mostly they have just one bed. Therefore, only one NPC can be spawned on them. The first NPC that spawns is always an adult, and have equal chances of being male or female. I know some lumberjack houses have sleeping mats, and I know I have included these as possible beds... will check more about this. About persuading parents: Yes, this could be a good idea. The relationships mechanism has to be overhauled, and will be, after I'm done with jobs and some trading tweaks I want to do.

Sokomine wrote:Very good! I'm looking forward to it.

Will take some time, but working on it!

Sokomine wrote:mg_villages now comes with mob spawners. They're currently well-visible in front of the houses (next to the plotmarker). Right-clicking one gives information about the particular inhabitant for which the spawner us responsible. The spawner doesn't spawn anything. It's more like a placeholder for accessing the information about the inhabitants and for toher mods (like advanced_npc here or villagers) to overwrite and make use of. And it's a uniq place for each inhabitant. There can be as many inhabitants as there are beds (normal bed, fancy bed or cottages bed).

Thanks for all this effort. I understand that you want the functionality to come from the mg_villages mod rather than provided by another mod. I will definetely take a look at all of this and adapt advanced_npc to use the new data provided by mg_villages.
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Fri Jun 30, 2017 11:53

Update:

Bugfixes:
  • NPCs no longer stay frozen after pressing the ESC button for closing a formspec.
  • Minetest doesn't crashes anymore due to NPCs trying to access nodes currently unloaded (e.g. "ignore" nodes).
Added:
  • As a preview of the capabilities of the schedule functionality, NPCs now trade from 1-6 and aren't able to receive gifts (if they are interested in relationships) in this timeframe. They will be able to receive gifts again after 6, and will be no longer interested in trading.

Updates are available on Github.


Please note that development will be slow on these days as I'm focusing in occupations, which will require a major overhaul on how dialogues currently work. However, I would like to give you a preview of what occupations are and how they will work.
All NPCs currently are given random items, textures, dialogues and a fixed "basic" schedule. The plan is that NPCs will have a random occupation based on the building they spawn. For example, if they spawn on a medieval village farm, at least one of them will be a farmer. The others might have the "basic" schedule, as they may or may not work on the farm. Occupations will be defined by a Lua table, and API functions will be provided for you or other mods to provide their own occupation definitions. This definition will allow you to customize the following:

  • Textures: for example, specific textures for farmer, monks, etc.)
  • Dialogues: will allow you to specify which dialogues you want the NPC to say. More on this: NPCs usually select between 2-4 random dialogue lines. If the definition includes more than this, then only 2-4 dialogue lines will be chosen for that NPC. You will also be able to specify if you want dialogue lines from the predefined ones. This allows to have farmers, priests, tavern owners, smithers and others have their own dialogue lines related to their job instead of generic ones.
  • Building type: The type of building this NPCs will spawn on. Can be house, hut, farm_tiny, farm_full, lumberjack
  • Surrounding building type: A building that have to be in the immediate surrounding of the hose the NPC spawned on. For example, a priest will spawn on a house with a church nearby, Or maybe a smith will spawn in a house with a forge nearby.
  • Schedule entries: Actions the NPC will spawn at certain times during the day.

Also, I have mentioned the words schedules and actions many times. I will explain this in a coming post, but basically, there are currently 14 action commands a NPC can be given on, and are executed as a queue of tasks every 1 second or at a specified interval (default is 1 sec). The 14 commands include simple actions like walking one step, standing, sitting, laying, rotating, taking and placing an item from an external inventory, etc. It also includes a series of actions (called tasks) that are for using furnaces, using sit nodes, using beds and walking to a specific position. In the future, I will also include an action for digging and placing nodes.

Schedules are static Lua tables which gives the ability to set a list of action commands that the NPC will perform on certain times at day (see spawner.lua get_basic_schedule() for an example). They are executed per Minetest hour (1 minute in real life), and they basically enqueue actions and tasks specified on the schedule entry for that hour. They also allow you to change properties such as if the NPC wishes to trade or not, allow receiving gifts or not, and adding or taking items from a NPC.

In overall, stay tuned, more to come soon!
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by ErrorNull » Fri Jun 30, 2017 12:06

very impressive. can't wait to see your next updates! i haven't look that much indepth in your code yet.. but do you have open api for trading? i currently code my villagers to immediately show the trading formspec on right click. i would be interesting in seeing well your trading system can insert into my on_rightclick for my villagers. at this time, i'm spending most of my time fine tuning the spawning and working a bit more pathfinding now that i have access to bed position and shortly the doors positions. i can also look into turning my dynamic body attributes and clothing generator into an api so you can access...
 

zorman2000
Member
 
Posts: 79
Joined: Tue Jul 26, 2016 18:18
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Fri Jun 30, 2017 12:52

ErrorNull wrote:very impressive. can't wait to see your next updates! i haven't look that much indepth in your code yet.. but do you have open api for trading? i currently code my villagers to immediately show the trading formspec on right click. i would be interesting in seeing well your trading system can insert into my on_rightclick for my villagers.

Yes, there is a trading API. It is tighly related to the dialogues API, and have a custom pricing system which is pretty flexible, but it is based on currencies and currency tiers. There are three tiers currently: cheap, medium and expensive. Each tier has a specific item for currency (this is mostly due to an idea of having copper, silver and gold coins) and the defaults are iron lump, copper lump and gold lump.

I can work to help you get the trading code working in your villagers on right click. It would be a good exercise given that I want advanced_npc to be an API, and currently it is not. So, I will be looking at this as well!

ErrorNull wrote:i can also look into turning my dynamic body attributes and clothing generator into an api so you can access...

Sounds great! Looking forward to it!

How would be best to have this common functionality, both the dynamic appearance generator and the trading mechanism? Maybe a common mod we depens on? Maybe a lua file we can include in our projects? Certainly, for the moment being the later sounds as the best approach. Let me know what you think.
 

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

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Sat Jul 01, 2017 00:03

zorman2000 wrote:I agree, and I will disable buying on NPC-owned houses.

That's a good solution as well. Or just make it ridiciously expensive (i.e. 99 diamonds).

zorman2000 wrote:I know some lumberjack houses have sleeping mats, and I know I have included these as possible beds... will check more about this

I've updated cottages and mg_villages so that sleeping mats are now recognized as beds.

zorman2000 wrote:Thanks for all this effort. I understand that you want the functionality to come from the mg_villages mod rather than provided by another mod. I will definetely take a look at all of this and adapt advanced_npc to use the new data provided by mg_villages.

Well, it's my mod, so the way I implement it there is most likely the way I like most :-) That doesn't mean that the villagers have to be that way. I just consider those family structures reasonable. Perhaps some beds might be left empty (husband/wife died, child not yet born, husband away working as lumberjack, travelling, wife&children visiting their parents, ...). It might even turn out to be impractical to try to simulate real village life too closely. The demands of gameplay are sometimes quite diffrent from those of a simulatrion. Guess we'll have to see and experiment. It's also quite likely that the diffrent villager mods will interpret things diffrently because we all have slightly diffrent preferences. That's not bad either. Just more to choose from :-)

zorman2000 wrote:As a preview of the capabilities of the schedule functionality, NPCs now trade from 1-6 and aren't able to receive gifts (if they are interested in relationships) in this timeframe. They will be able to receive gifts again after 6, and will be no longer interested in trading.

Hm :-) That still sounds very odd. Why not accept presents at any time? Sure, someone waking you up at night just to hand you a leaflet advertising for something *might* receive a less friendly welcome, but in general presents ought to be welcome. Giving an apple or bread to an npc is just an act of friendliness. No mating planned :-)

As to the jobs: There are buildings of the type "farm_full" - those are farmers that have enough land (somewhere) to be able to concentrate on farming and to live from it. The "farm_tiny" farms are smaller. Their owners don't have enough land to live from their farm alone and thus need to have an additional job. That's a simulation of medieval village life. In villages with too few houses, jobs at other locations (priest, miller, smith, ..) may be assigned to owners of a full farm who don't really have enough time and ought to be farmers. Or the jobs might not be assinged at all due to not enough people living there.

zorman2000 wrote:Surrounding building type: A building that have to be in the immediate surrounding of the hose the NPC spawned on. For example, a priest will spawn on a house with a church nearby, Or maybe a smith will spawn in a house with a forge nearby.

The assignment of jobs and inhabitants towards each other is handled diffrently in mg_villages. Distance inside the village does not play a role. Some types of houses are preferred for external jobs - huts and houses get a job first (the inhabitants there really don't have anything else to do), then farm_tiny, then farm_full (ought to be farmers...but sometimes they have to jump in).

zorman2000 wrote:Also, I have mentioned the words schedules and actions many times. I will explain this in a coming post, but basically, there are currently 14 action commands a NPC can be given on, and are executed as a queue of tasks every 1 second or at a specified interval (default is 1 sec). The 14 commands include simple actions like walking one step, standing, sitting, laying, rotating, taking and placing an item from an external inventory, etc. It also includes a series of actions (called tasks) that are for using furnaces, using sit nodes, using beds and walking to a specific position. In the future, I will also include an action for digging and placing nodes.

Breaking down actions to those basics does seem to be a good plan. Can't wait to have those villagers really run around and simulate village life :-)
A list of my mods can be found here.
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: matyilona200 and 3 guests