[PoC] NPC Build Queue [npcbuildqueue]
- IcyDiamond
- Member
- Posts: 175
- Joined: Fri Mar 30, 2018 08:55
- GitHub: LunaSquee
- IRC: IcyDiamond
- In-game: IcyDiamond
- Location: Estonia
- Contact:
[PoC] NPC Build Queue [npcbuildqueue]
This is a proof-of-concept which instructs your NPCs to "build" schematics. Requires Mobs Redo by Tenplus1.
Instead of just placing a schematic in the world, this PoC will allow you to instruct your NPCs to "act out" the building of a schematic! This means that the NPC will be breaking and placing nodes in order, in layers.
See the Demonstration Video.
Source Code: https://gitlab.icynet.eu/evert/npcbuildqueue
License: CC0
Instead of just placing a schematic in the world, this PoC will allow you to instruct your NPCs to "act out" the building of a schematic! This means that the NPC will be breaking and placing nodes in order, in layers.
See the Demonstration Video.
Source Code: https://gitlab.icynet.eu/evert/npcbuildqueue
License: CC0
Last edited by IcyDiamond on Sat Jan 19, 2019 17:45, edited 1 time in total.
Web developer | Systems Administrator
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Wow. This is really great.
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Nicely done IcyDiamond :) love it.
- IcyDiamond
- Member
- Posts: 175
- Joined: Fri Mar 30, 2018 08:55
- GitHub: LunaSquee
- IRC: IcyDiamond
- In-game: IcyDiamond
- Location: Estonia
- Contact:
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Thanks, guys! Glad you like it.
Web developer | Systems Administrator
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Nice mod, Icy.
Would it be possible to enable the NPC to randomly choose a schem from a folder, instead of having it hard coded?
Shad
Would it be possible to enable the NPC to randomly choose a schem from a folder, instead of having it hard coded?
Shad
Re: [Mod] NPC Build Queue API [npcbuildqueue]
You could add blueprint items for each build and when you right-click an NPC with one of the blueprints they build it where they stand :)
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Do the NPCs need the required nodes in inventory to complete the build? If not that would be a good feature I think. Optionally they could perhaps be made to start out building with what they have?
Re: [Mod] NPC Build Queue API [npcbuildqueue]
How about a schematic store block that takes what it needs for the builds from your inventory and returns a blueprint item you can use on npc's to build it :)
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: [Mod] NPC Build Queue API [npcbuildqueue]
The NPC running around and building the house looks very nice in the video. However, this isn't the first mod that does this kind of thing; Towntest existed a lot earlier. The main difference seems to be that this mod is mobs_redo based? That's good because that's a very popular mod supported by many. I hope this mod gets further developped than all those previous attempts.
My mod citybuilder (or, to be more preceise, the handle_schematics mod behind it) takes a slightly diffrent approach at mobs building schematics. Instead of letting the mob do all the work and build from scratch, the idea is to let the player choose a schematic with a special build chest (the same one that is used for copying/saving buildings) and spawn the selected building with special nodes that indicate what needs to be done where and how in order to create the structure. There are two special nodes: A "dig here" indicator (upside-down red pickaxe) and a scaffolding node that acts like a ladder. It's not perfect yet but you can test it already if you place a handle_schematics:build chest in your singleplayer world, revoke your creative priv and spawn a building.
The advantage of this approach is that players and (multiple) mobs can build on the same structure without too much confusion arising. It boils down to find all the dig_here-indicators in the area and right-click them often enough until they go away. Afterwards, find all the scaffolding nodes and similarily right-click them until they, too, go away. If that's done, the structure ought to stand there more or less (doors and other status-changing nodes may need manual updates). Players who want to help need to have the nodes that are to be placed inside their inventory. There isn't any tool required for digging the nodes with the dig-here-indicator yet.
I'm looking for a mob that can help with this build process. The mob would have to search for the two nodes of intrest in the desired area (or just in its environment), walk there as closely as possible and call a function in those nodes. There's no inventory handling for such potential mobs yet. Wielding the right tool or block might look more impressive to players who watch the process. The scaffolding nodes allow players and mobs to get closer to the place where they want to do something. Trouble is that mobs won't know about nodes they can climb.
My mod citybuilder (or, to be more preceise, the handle_schematics mod behind it) takes a slightly diffrent approach at mobs building schematics. Instead of letting the mob do all the work and build from scratch, the idea is to let the player choose a schematic with a special build chest (the same one that is used for copying/saving buildings) and spawn the selected building with special nodes that indicate what needs to be done where and how in order to create the structure. There are two special nodes: A "dig here" indicator (upside-down red pickaxe) and a scaffolding node that acts like a ladder. It's not perfect yet but you can test it already if you place a handle_schematics:build chest in your singleplayer world, revoke your creative priv and spawn a building.
The advantage of this approach is that players and (multiple) mobs can build on the same structure without too much confusion arising. It boils down to find all the dig_here-indicators in the area and right-click them often enough until they go away. Afterwards, find all the scaffolding nodes and similarily right-click them until they, too, go away. If that's done, the structure ought to stand there more or less (doors and other status-changing nodes may need manual updates). Players who want to help need to have the nodes that are to be placed inside their inventory. There isn't any tool required for digging the nodes with the dig-here-indicator yet.
I'm looking for a mob that can help with this build process. The mob would have to search for the two nodes of intrest in the desired area (or just in its environment), walk there as closely as possible and call a function in those nodes. There's no inventory handling for such potential mobs yet. Wielding the right tool or block might look more impressive to players who watch the process. The scaffolding nodes allow players and mobs to get closer to the place where they want to do something. Trouble is that mobs won't know about nodes they can climb.
A list of my mods can be found here.
- Andrey01
- Member
- Posts: 2579
- Joined: Wed Oct 19, 2016 15:18
- GitHub: Andrey2470T
- In-game: Andrey01
- Location: Russia, Moscow
Re: [Mod] NPC Build Queue API [npcbuildqueue]
I`ve watched Demonstration video and i can say the NPC builds realistically. However, why can they build through blocks? 1:29 - 1:50 (One NPC built his roof that being behind the wall).
- Andrey01
- Member
- Posts: 2579
- Joined: Wed Oct 19, 2016 15:18
- GitHub: Andrey2470T
- In-game: Andrey01
- Location: Russia, Moscow
Re: [Mod] NPC Build Queue API [npcbuildqueue]
And btw, here is an error with NPC (it happened when i had clicked him):
Minetest version is 5.0.0-dev.
Code: Select all
2018-07-25 00:05:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'npcbuildqueue' in callback luaentity_Step(): ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: attempt to call method 'yaw' (a nil value)
2018-07-25 00:05:34: ERROR[Main]: stack traceback:
2018-07-25 00:05:34: ERROR[Main]: ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: in function 'do_custom'
2018-07-25 00:05:34: ERROR[Main]: ...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2734: in function <...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2676>
- IcyDiamond
- Member
- Posts: 175
- Joined: Fri Mar 30, 2018 08:55
- GitHub: LunaSquee
- IRC: IcyDiamond
- In-game: IcyDiamond
- Location: Estonia
- Contact:
Re: [Mod] NPC Build Queue API [npcbuildqueue]
I cannot reproduce this. More details?Andrey01 wrote:And btw, here is an error with NPC (it happened when i had clicked him):Minetest version is 5.0.0-dev.Code: Select all
2018-07-25 00:05:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'npcbuildqueue' in callback luaentity_Step(): ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: attempt to call method 'yaw' (a nil value) 2018-07-25 00:05:34: ERROR[Main]: stack traceback: 2018-07-25 00:05:34: ERROR[Main]: ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: in function 'do_custom' 2018-07-25 00:05:34: ERROR[Main]: ...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2734: in function <...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2676>
Web developer | Systems Administrator
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: [Mod] NPC Build Queue API [npcbuildqueue]
Icy,
I did encounter the same error, using 0.4.16. My solution was to comment out the call to mobs:yaw.
I think this might be related to using different player models, and trying to have the NPC "look" at where they are building.
As a side note, at first the NPCs were invisible, and I had to copy the default character.b3d file into the mod folder and rename it to mobs_character.b3d. Perhaps this is the incorrect player model file, and the above call to mobs:yaw would work with a correct model. Neither your mod or mobs_redo had a mobs_character.b3d file, so I used the one from MT game default mod.
Shad
I did encounter the same error, using 0.4.16. My solution was to comment out the call to mobs:yaw.
I think this might be related to using different player models, and trying to have the NPC "look" at where they are building.
As a side note, at first the NPCs were invisible, and I had to copy the default character.b3d file into the mod folder and rename it to mobs_character.b3d. Perhaps this is the incorrect player model file, and the above call to mobs:yaw would work with a correct model. Neither your mod or mobs_redo had a mobs_character.b3d file, so I used the one from MT game default mod.
Shad
- IcyDiamond
- Member
- Posts: 175
- Joined: Fri Mar 30, 2018 08:55
- GitHub: LunaSquee
- IRC: IcyDiamond
- In-game: IcyDiamond
- Location: Estonia
- Contact:
Re: [Mod] NPC Build Queue API [npcbuildqueue]
That's weird because :yaw is a mobs_redo API function https://notabug.org/TenPlus1/mobs_redo/ ... i.lua#L171ShadMOrdre wrote:Icy,
I did encounter the same error, using 0.4.16. My solution was to comment out the call to mobs:yaw.
I think this might be related to using different player models, and trying to have the NPC "look" at where they are building.
As a side note, at first the NPCs were invisible, and I had to copy the default character.b3d file into the mod folder and rename it to mobs_character.b3d. Perhaps this is the incorrect player model file, and the above call to mobs:yaw would work with a correct model. Neither your mod or mobs_redo had a mobs_character.b3d file, so I used the one from MT game default mod.
Shad
And yes, the example was made with mobs_npc enabled.
Web developer | Systems Administrator
- Andrey01
- Member
- Posts: 2579
- Joined: Wed Oct 19, 2016 15:18
- GitHub: Andrey2470T
- In-game: Andrey01
- Location: Russia, Moscow
Re: [Mod] NPC Build Queue API [npcbuildqueue]
When i had clicked one NPC i got that error. And it can not find a model for your npc (just unknown one that like doesn`t exist). As i said i use 5.0.0-dev.IcyDiamond wrote:I cannot reproduce this. More details?Andrey01 wrote:And btw, here is an error with NPC (it happened when i had clicked him):Minetest version is 5.0.0-dev.Code: Select all
2018-07-25 00:05:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'npcbuildqueue' in callback luaentity_Step(): ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: attempt to call method 'yaw' (a nil value) 2018-07-25 00:05:34: ERROR[Main]: stack traceback: 2018-07-25 00:05:34: ERROR[Main]: ...user/opt/minetest/bin/../mods/npcbuildqueue/init.lua:229: in function 'do_custom' 2018-07-25 00:05:34: ERROR[Main]: ...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2734: in function <...home/user/opt/minetest/bin/../mods/mobs_redo/api.lua:2676>
Re: [Mod] NPC Build Queue API [npcbuildqueue]
This probably means that you are calling yaw() on the wrong object (maybe self.object:yaw() instead of self:yaw()).
- j0j0n4th4n
- Member
- Posts: 256
- Joined: Tue Jan 26, 2021 06:45
Re: [PoC] NPC Build Queue [npcbuildqueue]
Is the git repository still up? I'm unable to reach the server.
cdb_894a100ddd76
Re: [PoC] NPC Build Queue [npcbuildqueue]
yes, all there links should have gitlab swaped with git
j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o
Who is online
Users browsing this forum: No registered users and 36 guests