[Mod] Creatures [git] [minetest_mods_creatures]

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Even more changes today. The inventory formspec and creature possession are now entirely defined by the creature set instead of hardcoded, and can be scripted to work in any way desired.

Further more, people complained that you could no longer possess mice and sheep, an ability which was lost when the right-click menu was implemented. This has been solved, and the player can become a mouse or sheep once again! If you right-click any creature as a ghost, the special button will say "Possess"... but if you click sheep or mice as a living creature, the special button will instead say "Take" or "Shear / Breed".
+ Spoiler
While I was at it, I also implemented grey and black sheep via the skin system. Obviously you will get the right type of wool when shearing each.
+ Spoiler
NOTE: You should do a /clearobjects on worlds which already contain creatures after you update from GIT.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Reworked much of the targeting logics again, and balanced the default creatures better. Mobs scan for nodes / creatures differently, and have more intelligent and optimal behaviors. The 'determination' trait now acts as randomization between targets within a priority threshold, making mobs who are low on this trait more likely to go back and forth between different tasks and act undecided.

More importantly, mobs can now dig nodes! This is achieved by simply giving a node target the 'attack' objective, whereas 'follow' and 'avoid' do the previous behaviors. Currently this is only enabled for sheep, which will eat grass when they get close to it.

Human mobs will now prefer going between man-made objects, such as furnaces / chests / etc. They will also prefer roaming around farmed fields in broad daylight, to do farming :) People will also stick to beds when it is dark. Screenshots of me testing mobs indoor:
+ Spoiler

User avatar
GingerHunter797
Member
Posts: 144
Joined: Sun Oct 13, 2013 15:36
In-game: GingerHunter797
Location: Indiana

Re: [Mod] Creatures [minetest_mods_creatures]

by GingerHunter797 » Post

Wow, looks very nice cant wait to try it! :D
http://i.imgur.com/gqXXUaI.png

3DS Friend Code: 2122-7173-2797
Add me as a friend! :D

Want to play a fun game? http://voxelands.com/

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Creatures [minetest_mods_creatures]

by Don » Post

Nice work!
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

As of now, GIT master includes a new addition: Bunnies! I adapted and included the model and texture ExeterDad kindly created and allowed me to integrate. As with all creatures, they will spawn as mobs around the world, and the player can possess one as a ghost to become one. Get the mod and try it out! Screenshots:
+ Spoiler

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Creatures [minetest_mods_creatures]

by Don » Post

I call it Exeterbunny
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] Creatures [minetest_mods_creatures]

by ExeterDad » Post

Don wrote:I call it Exeterbunny
Lol nice manly name. Thanks Buddy!

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

So I hope everyone here likes furries... because that's a thing that just got added to the mod! More precisely, there is now an anthropomorphic fox in the default creature set, with related species planned. This is primarily for a Minetest game I'm planning to design, but since I made one to begin with I saw no reason not to include it in the mainstream mod as well. Screenshots at the bottom of this post.

The model is based on the existing human model, to which I simply added a muzzle and ears and a tail... meaning it's technically compatible with all player skins but textures should seriously be designed for it to look okay. The textures were made by me and are also licensed WTFPL. Functionality wise, anthropomorphics have the same features as humans (such as inventory sizes) and the mobs behave in a similar fashion.

I also introduced the concept of neutrality in the mob logics. When the relationship between two mobs is too close to 0 (by default between -0.1 and 0.1), mobs will never take actions toward the other creature idly, although they might still attack if provoked (punched). When you are neutral toward another creature, the alliance text will appear yellow in the right-click menu. Humans and anthropomorphics are neutral toward each other in the world.
+ Spoiler

Ivà
Member
Posts: 115
Joined: Sun Feb 22, 2015 07:11
GitHub: melzua
IRC: melzua
In-game: melzua
Location: Catalonia

Re: [Mod] Creatures [minetest_mods_creatures]

by Ivà » Post

Nice job MirceaKitsune. Lovely creatures those anthropomorphics fox :-)

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Thank you! I spent the day texturing the other species I plan to include: Wolf, leopard, rabbit, squirrel. The textures are ready and committed, but the creature definitions will be in tomorrow since they still need tweaking. Never the less, here are the screenshots:
+ Spoiler

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Busy day for the mod today. First of all, I added settings for all of the new species: Foxes will spawn in all biomes but more rarely, wolves will only spawn in snow biomes, rabbits on grass, leopards in desert biomes, and squirrels in trees. Foxes have no special traits, wolves are heavier than other mobs, rabbits can jump much higher, leopards can walk faster, and squirrels are lighter. Also, all monsters will now spawn at night while people will spawn during the day... this model is a lot more consistent at this stage.

I also refractored the register_spawn function, so it is defined easily and cleanly through fields like other functions. There are also a few new settings you can customize... such as the ability to specify which neighbors the node must have in order to spawn mobs, the ABM interval, and a minimum height (previously there was only a maximum).

I lastly tried to improve pathfinding. Haven't gotten far, but mob movement now uses a hybrid system: If pathfinding fails to generate a path, the classic system is used instead. Therefore it's safe to add "pathfinding=true" in minetest.conf, and let it work only when it happens to work.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Added builtin damage particles, which act similar to the dig particles on nodes (pieces of the texture flying out). I managed to achieve this effect with the minetest.add_particlespawner function by using the "[combine" function to randomly select pieces of the texture, which obey the selected skin as well as multiple materials (it will select one randomly). The feature works for both players and mobs. Screenshots below.

Additionally, mob HP is now persisted. Upon restarting the server, mobs will retain the health you left them with.
+ Spoiler

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Crazy new changes were added to the mod during the last two days, and are currently still being worked on. To begin with, the human skins were replaced with the NPC textures from Lord of the Test, given that both quality theme and license are better. Now for the important stuff:

Creatures is now the first mob mod for Minetest to support texture overlays and scripted color definitions. A new function lets you define multiple layers in a table, each containing any number of texture sets and colors. The textures and colors are merged into all possible combinations and output to a single table, which is applied directly to the textures field and used by the existing skin system. The magic is done through texture modifiers... specifically "^" to combine the textures, "(" and ")" to separate colored layers in one go, and "^[colorize" to apply the colors. Here's an exact example of such a definition:

Code: Select all

local colors_fur = {
	"#ff0000", -- red
	"#ffcc00", -- orange
	"#ffff00", -- yellow
	"#ffffff", -- white
	"#cccccc", -- gray
	"#000000", -- black
}

local colors_eyes = {
	"#ff0000", -- red
	"#ffff00", -- yellow
	"#00ff00", -- green
	"#00ffff", -- cyan
	"#0000ff", -- blue
	"#cc00ff", -- purple
}

local colors_hair = {
	"#ff0000", -- red
	"#ffcc00", -- orange
	"#ffff00", -- yellow
	"#00ffff", -- cyan
	"#0000ff", -- blue
	"#ff00ff", -- pink
	"#ffffff", -- white
	"#000000", -- black
}

local outfit_fox_female = creatures:outfit({
	{
		textures = {{"mobs_anthro_fox_fur.png"},},
		colors = colors_fur,
		colors_ratio = 96,
	},
	{
		textures = {{"mobs_anthro_fox_detail.png"},},
	},
	{
		textures = {{"mobs_anthro_fox_eyes.png"},},
		colors = colors_eyes,
		colors_ratio = 128,
	},
	{
		textures = {{"mobs_anthro_fox_hair.png"},},
		colors = colors_hair,
		colors_ratio = 192,
	},
})
For the time being, only anthros were adapted to use the new system. They will have random fur, eye, and hair colors. Colored textures obviously contain an alpha channel, and were saved as grayscale images to further reduce file size. Screenshots of code colored mobs:
+ Spoiler

User avatar
Sokomine
Member
Posts: 4014
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Creatures [minetest_mods_creatures]

by Sokomine » Post

MirceaKitsune wrote: Creatures is now the first mob mod for Minetest to support texture overlays and scripted color definitions. A new function lets you define multiple layers in a table, each containing any number of texture sets and colors. The textures and colors are merged into all possible combinations and output to a single table, which is applied directly to the textures field and used by the existing skin system. The magic is done through texture modifiers... specifically "^" to combine the textures, "(" and ")" to separate colored layers in one go, and "^[colorize" to apply the colors. Here's an exact example of such a definition:
That is very good to hear! It ought to allow easy application of clothes, without them having to be treated like armor. That loom from the wardrobe mod may finally be put to gut use! Does it have any effect on connection time? I havn't checked, but I guess the combined textures are generated on the fly by the client when needed?
MirceaKitsune wrote: Human mobs will now prefer going between man-made objects, such as furnaces / chests / etc. They will also prefer roaming around farmed fields in broad daylight, to do farming :) People will also stick to beds when it is dark. Screenshots of me testing mobs indoor:
That's something that'd be very nice for the village inhabitants as well. Right now, my traders just stand around. Can you isolate the behavioural parts so that they may be used in combination with other mods?
A list of my mods can be found here.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Sokomine wrote:That is very good to hear! It ought to allow easy application of clothes, without them having to be treated like armor. That loom from the wardrobe mod may finally be put to gut use! Does it have any effect on connection time? I havn't checked, but I guess the combined textures are generated on the fly by the client when needed?
Not at all. Textures are combined client-side (in tile.cpp), so the server only needs to transfer the original images. Outfits created this way are composed of smaller textures, and my mod was actually reduced by a few dozen Kb after I converted the skins.

I'm not sure however if each resulting texture is copied in the memory, meaning that too many large textures could result in a heavy RAM increase client-side. Wouldn't be noticeable in this case of course, since each texture is way under 10 Kb.
Sokomine wrote:That's something that'd be very nice for the village inhabitants as well. Right now, my traders just stand around. Can you isolate the behavioural parts so that they may be used in combination with other mods?
Isolate in what way?I don't think so however: You simply define lists of nodes, what type of targets they are, and under what circumstances they become targets. Here's the definition for the default human mobs, which uses all possible parameters:

Code: Select all

local nodes_human = {
	-- go to bed if it's dark
	{nodes = {"group:bed"},
	light_min = 0,
	light_max = 7,
	objective = "follow",
	stay = true,
	priority = 0.75,},
	-- interact with functional nodes (chests, furnaces, etc) if it's not midday
	{nodes = {"default:chest", "default:chest_locked", "default:furnace", "default:furnace_active", "default:sign_wall", "default:bookshelf", "group:door"},
	light_min = 7,
	light_max = 14,
	objective = "follow",
	priority = 0.5,},
	-- do some farming if it's midday
	{nodes = {"group:field"},
	light_min = 15,
	light_max = 15,
	objective = "follow",
	priority = 0.5,},
	-- wander around idly
	{nodes = {"group:crumbly", "group:cracky", "group:choppy"},
	light_min = 7,
	light_max = 15,
	objective = "follow",
	priority = 0.1,},
}
Anyway: I finished porting the human skins to the new system. Each human gets a randomized body design, hair (including facial hair), clothing, and eye colors. Although all possible combinations are theoretically pre-defined, I think we can call them randomly generated outfits... and I like how different people now look from one another!
+ Spoiler

User avatar
Sokomine
Member
Posts: 4014
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Creatures [minetest_mods_creatures]

by Sokomine » Post

MirceaKitsune wrote: Isolate in what way?I don't think so however: You simply define lists of nodes, what type of targets they are, and under what circumstances they become targets.
Isolate it insofar as that part of your code ought to enable mobs from *other* mods to act in a similar way. It's something I'd love to have for the traders in my villages :-)
MirceaKitsune wrote: Anyway: I finished porting the human skins to the new system. Each human gets a randomized body design, hair (including facial hair), clothing, and eye colors. Although all possible combinations are theoretically pre-defined, I think we can call them randomly generated outfits... and I like how different people now look from one another!
That, too, is very fine and would be great for mobs in general.
A list of my mods can be found here.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Sokomine wrote:Isolate it insofar as that part of your code ought to enable mobs from *other* mods to act in a similar way. It's something I'd love to have for the traders in my villages :-)
Don't think that one's possible, sorry. Mobs simply choose targets from creatures and nodes around them, and carry out the task with the biggest priority.

But this should allow making villagers behave in enough detail. Also note that you can, of course, define multiple human creatures based on any criteria, using the same model and possibly other settings. So you can use the existing options to make normal villagers wonder around a lot, but traders to normally just sit in place and such.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Tweaked the skins and colors for better looking results. Humans now have 3 different skin colors: Black (african), white (caucasian), yellow (asian). Obviously all are combined with random clothes and every outfit is possible.
+ Spoiler
Light damage also got fixed up: You can now define the exact light level at which mobs take damage. If you use a negative value, the effect is reversed... meaning creatures can now take damage when it's darker than the given amount instead, and require light to stay unharmed.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Yesterday I discussed the mod on IRC, and performance was brought up. Although mobs in this mod are pretty lightweight, too many mobs will still increase CPU usage visibly. I decided to see if I could improve performance further, and realized I had missed an important optimization.

The problem was that both movement and target selection were preformed based on a single timer, which was typically between 0.25 and 1 seconds per mob. Movement is pretty cheap to calculate, but target scanning is rather expensive. The value had to be set low for movement to work properly, but still high to avoid the heavy target loop.

So now the two are executed separately; Movement and other AI essentials are handled by a new "think" setting, which defaults to around 0.5. Target selection is instead controlled by the "intelligence" trait (now called decision_interval), which typically ranges from 1 to 4 seconds. This means that mobs follow their target with quick and responsive movement, but will decide whether to change this target much more slowly.

The improvement is great: Previously, having 12 active human mobs caused Minetest to use around 14% CPU. Now however, Minetest uses about 8% CPU with 12 human mobs. Without active mobs, Minetest uses around 4%. My CPU is an Intel Core i7 920 (4 cores, 8 threads) clocked to 3.0 GHz. The only downside is that monsters take longer to attack you, but since movement is what the player sees perceived performance is mostly unaffected.

Notice: You absolutely must do a /clearobjects or start a new world after this commit! Old mobs will crash the server.

User avatar
Sokomine
Member
Posts: 4014
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Creatures [minetest_mods_creatures]

by Sokomine » Post

MirceaKitsune wrote: The improvement is great: Previously, having 12 active human mobs caused Minetest to use around 14% CPU. Now however, Minetest uses about 8% CPU with 12 human mobs.
That's very good to hear! Mobs really don't need to think about changing target so often. I wonder how the Lord of the Test mobs do it. They occour in pretty high amounts, interact with each other - and still the server is responsive to a degree.
A list of my mods can be found here.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [minetest_mods_creatures]

by MirceaKitsune » Post

Sokomine wrote:That's very good to hear! Mobs really don't need to think about changing target so often. I wonder how the Lord of the Test mobs do it. They occour in pretty high amounts, interact with each other - and still the server is responsive to a degree.
FYI: My calculations weren't fully correct. I was looking at the CPU usage of Minetest in singleplayer, which is apparently also affected by what is being rendered. I tested again both with and without active mobs, but this time looking down into the ground each time. I estimate that 10 human mobs increase CPU usage with at most 2%, which is even better than what I first thought!

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

Re: [Mod] Creatures [minetest_mods_creatures]

by TenPlus1 » Post

When testing mobs I find it easier to create a sandstone platform 100 high which lets you test speed and other settings without world abm's interfering around you...

User avatar
Sokomine
Member
Posts: 4014
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Creatures [minetest_mods_creatures]

by Sokomine » Post

TenPlus1 wrote: When testing mobs I find it easier to create a sandstone platform 100 high which lets you test speed and other settings without world abm's interfering around you...
My skyplatform could then be of use to you. It also has a border around which prevents mobs from hopping to their death.
A list of my mods can be found here.

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by MirceaKitsune » Post

I made two changes of interest to the mod today. First off, I created a new spawn function which allows mods to spawn any mob at any location. This was already possible using minetest.env:add_entity(pos, name), but more complicated and less officially supported. The change was done to support integration with the Structures mod.

The second important change is that anthros may how have outfits! The same cloth textures as humans are used, so the change was pretty much a single line of code. Clothes are also now optional for both humans and anthros. And calm down, humans aren't butt naked... they already used a separate fabric texture for color, so this just adds a new simplistic outfit. Screenshots:
+ Spoiler

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

Re: [Mod] Creatures [git] [minetest_mods_creatures]

by MirceaKitsune » Post

Today I started working on the first default module distributed in the creatures modpack. As you might remember, modules are separate mods meant to run on top of Creatures, intended to add new functionality for players and mobs.

The upcoming module is called items, and it will be an optional interface which handles special interactions between mobs / players and items in inventories. The first feature, which is currently in the process of being implemented, are 3D wielded items. Not only for the wielded item itself, which is of course visible in the right hand, but the first X items in creature's inventory are also visible on the person's belt! The number of slots and item's position are customizable per creature, meaning you can make anyone have a given number of items from their inventory attached to their body as you see fit.

Latest GIT contains the implementation for players. The mob component should be in tomorrow, which will allow mobs to have random inventories given at spawn time and the first 4 items hanging from their belt. It shall also eventually have logics to teach mobs how to use items. I'm additionally considering implementing pickpocketing support, since the entities used to represent items should be possible to select and right-click... but that will be at a later stage. Screenshots:

Image
Image
Image

Post Reply

Who is online

Users browsing this forum: Diamond knight and 1 guest