[mod] water_life - mobs for mobkit - V212301[water_life]

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

update again:

I wasn't happy with spawning function so I wrote it new from scratch.
It uses much less checks now and works faster and more accurate.
All spawnpositions are calculated in every players view direction
+- 45 degrees.

Number of max spawned sharks reduced. But sharks have faster attackspeed
and are much more sensible of what is in the water. (Viewrange is 75% of
active_object_send_block_range)

Whales now dive under platforms floating on the water surface.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

little update:

diving beneath floating platforms on water is working better now. Checking for is_gound_content is not
reliable for all nodes.

changed spawn chance of whale and shark to promille in init.lua. 10 promille = 1 percent


A big impact on cpu time was the spawning function again:

Code: Select all

local function spawnstep(dtime)

    timer = timer + dtime
    if timer > 5 then
        
        for _,plyr in ipairs(minetest.get_connected_players()) do
now only every 5 seconds we are iterating online players and check for spawns.

before every serverstep it was iterating all online players and threw a dice.
saved 10-20% cpu time on one core of ZombieTest.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Riverfish:


added small fish populating the rivers.
They need river_water_source to spawn and they
drop meat if killed.

There is no animation yet, as soon as I progress on how
to use blender, bones and armatures there will be in the future.


Image
My servers: Jungle, Lilly in the valley click for my mods

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [mod] water_life - mobs for mobkit[water_life]

by Melkor » Post

Nice mod!
Is just a suggestion, but it can be more pixelart/lowpoly like?
nice shark btw

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Melkor wrote:Nice mod!
Is just a suggestion, but it can be more pixelart/lowpoly like?
nice shark btw
For sharks all credits go to Termos, as the model and texture were from his zombiestrd mod.
Model and texture of the whale is not from me also. Should be mentioned in the first post and
in license.txt.
I wrote the most of the code, but did little design. I am totally new to blender so that may take a while
until I will get anything useful out of there X)
That is why the riverfish is, like it is. A free to download model and texture from the internet. :D

So if you or somebody else would like to provide a better, more suiting model/texture for riverfish I
would be happy to use it.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

new behaviour !

added new function to the water_life api:

function water_life.hq_swimfrom(self,prty,tgtobj)
this will make a mob flee from tgtobj until it is out of it's view range.

Introduced for the new riverfish, so when you get near them, they will try to
run off.

As the api is growing, I will do some documentation shortly.
My servers: Jungle, Lilly in the valley click for my mods

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [mod] water_life - mobs for mobkit[water_life]

by Melkor » Post

Gundul wrote:So if you or somebody else would like to provide a better, more suiting model/texture for riverfish I
would be happy to use it.
Nice, im going to give it a try. Im gonna make a cute lowpoly pixelart fish

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Melkor wrote:
Gundul wrote:So if you or somebody else would like to provide a better, more suiting model/texture for riverfish I
would be happy to use it.
Nice, im going to give it a try. Im gonna make a cute lowpoly pixelart fish
Hurray :)

I am already curious what it will look like :)
My servers: Jungle, Lilly in the valley click for my mods

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [mod] water_life - mobs for mobkit[water_life]

by Melkor » Post

I made this little fish, but im not sure if is good enough, it is even animated!
Image
Tell me what you think, i think the texture is a bit bland
Attachments
riverfish.gif
(858.08 KiB) Not downloaded yet

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Melkor wrote:I made this little fish, but im not sure if is good enough, it is even animated!
Tell me what you think, i think the texture is a bit bland
That looks already very nice.
The texture is also good, I think. Must see it when the fish is
swimming in the water. But it is a riverfish, not some tropical coral inhabitant :)
Only i'ts belly is maybe a bit too flat ?
I can't really imagine what it looks like when seen
from front or behind.
My servers: Jungle, Lilly in the valley click for my mods

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [mod] water_life - mobs for mobkit[water_life]

by Melkor » Post

Image

Here is the 7z, it has 6 files (license, .blend, a .png and the originals gimp files in case you need to edit them)
It has a couple of animations: a swimming and a idle animation. Actually im not too confident with my ability to animate, so i left this point to you, or someone else if you think it needs a improvement.
Good luck and happy modding!
Attachments
riverfish.7z
The 3D file
(142.27 KiB) Downloaded 24 times
riverfish001.png
(10.19 KiB) Not downloaded yet

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Melkor wrote:
Here is the 7z, it has 6 files (license, .blend, a .png and the originals gimp files in case you need to edit them)
It has a couple of animations: a swimming and a idle animation.
Thank you very much for your work.
I like the new riverfish and will try to add it today to water_life.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

New Riverfish with animations

Image

The riverfish has a new texture and even animations now. A big thank you
again to Melkor for painting and animating it.


riverfish needs default:river_water_source to live in and to spawn. It is a quiet small
fish giving only one piece of meat when killed. In very rare cases you can find a diamond
in his belly. When approaching riverfish, they will try to escape from you until out of their
eyesight.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Is there a way to turn the riverfish around z axis 180 degrees ?

I know how to turn around the model, by pressing r,z,180,enter but the bones
and stuff stay in place that case.

Because after exporting it to b3d it is moving backwards. It's butt is where should be it's
head :) So I am using negative speed to make it look like it is going forward :)
My servers: Jungle, Lilly in the valley click for my mods

Eran
Member
Posts: 123
Joined: Fri May 03, 2019 16:46

Re: [mod] water_life - mobs for mobkit[water_life]

by Eran » Post

Gundul wrote: Is there a way to turn the riverfish around z axis 180 degrees ?
Yes, instead of selecting the model you select the main bone, go to object mode and rotate it just like you would rotate the model. Since it's set as parent to everything else, the whole model should rotate. If something doesn't rotate you have selected the wrong bone.

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Eran wrote:
Gundul wrote: Is there a way to turn the riverfish around z axis 180 degrees ?
Yes, instead of selecting the model you select the main bone, go to object mode and rotate it just like you would rotate the model. Since it's set as parent to everything else, the whole model should rotate. If something doesn't rotate you have selected the wrong bone.
Thanks, that did it :)
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

little update.

I turned river_fish model into right position. That means it is not swimming backwards
anymore and position is centered in collisionbox.

little changes in the riverfish behavior.

started to move functions from init.lua to api.lua and make them globally available.

I hope next weekend I can start with documentation.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

----- Update

Riverfish can be caught and tamed by catching it with a bugnet. rightlick on a fish with bugnet in hand.

Tamed riverfish will be statically saved, can not be harmed or caught be other than the owner.
Caught riverfish can also be eaten rawly or you can use it as shark food.

You can also just make it swim in your pond or pool. Tamed fish will not escape if you come near them.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Update:
-------------


added api documentation in the lua_api.txt file.
api introduces new helper funczions and hq behaviors:

Code: Select all



---------------
Water_life Api:
---------------



useful constants:
------------------

water_life.abr = minetest.get_mapgen_setting('active_block_range') or 2
water_life.abo = minetest.get_mapgen_setting('active_object_send_range_blocks') or 3
water_life.maxwhales = 1 
water_life.maxsharks = water_life.abo/2
water_life.maxmobs = 30



helper functions:
-----------------



water_life.leftorright()

returns true with a possibility of 50% else returns false




water_life.register_shark_food(name)

register enitiy "name" as shark food. Will be attacked by sharks if in water and in sight




water_life.count_objects(pos,radius)

counts objects around pos with radius in nodes and returns a table:
table.all       -   total number of all objects
table.sharks    -   total number of sharks
table.whales    -   total number of whales
table.fish      -   total number of fish wild/tamed




water_life.handle_drops(self)

call this on death of an entity and define drops in entity definition like this:
chances are in 100/x. So chance =1 means 100%, 2 = 50%, 3 = 33 1/3 %, ...

drops = {
		{name = "default:diamond", chance = 5, min = 1, max = 5,},		
		{name = "water_life:meat_raw", chance = 2, min = 1, max = 5,},
	},
	


	
water_life.get_yaw_to_object(self,tgtobj)

returns 2D angle in rad tgtobj seen from self






HQ Behaviors:
-----------



water_life.hq_swimfrom(self,prty,tgtobj,speed)

mob will turn 90 degrees away from target and try to escape until target is out of viewrange + 50%




water_life.big_hq_aqua_turn(self,prty,tyaw,speed)

will turn mob with large collisionbox to tyaw with speed




water_life.big_aqua_roam(self,prty,speed)

mob with large collisionbox will roam the waters with given speed.
A bit like mobkit.hq_aqua_roam with less turns

My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Now all riverfish will avoid swim into sea water. Or if they do they will try to find back a way
to riverwater.



Also added new behaviour to water_life api:


-- swim to the next "node" which is inside viewrange or quit
function water_life.hq_swimto(self,prty,speed,node)

and helper function:


-- returns 2D angle from self to pos in radians
function water_life.get_yaw_to_pos(self,target)
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Update spawn function again.
Now using a custom way to find possible spawn points.
Also liquidflag is devided in "sea","river" or nil which helps
to save many unneeded checks.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

Update again:

New radar function which uses raycasting instead of
excessive checking for water nodes. It returns two
values for left or right depending on which side of the
mob were more obstacles found and how near they
were to its center position.

water_life.radar(pos ,yaw ,radius, water)

This will check starting from pos in direction yaw with a
distance of radius. If water is false it works as sonar.
(That means water nodes are like air nodes)

If water is true it will work as radar also in the future. I will
add two returned values for up and down.

all returned values are integer.

Using raycasting needs much less cpu than checking areas for nodes.
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

finished radar function:

it will return 6 integer values: left, right, up, down, under. above

the higher one of the values right, left, up and down the more
and the nearer an obstacle is to the entity

under tells you the distance from pos to ground below the entity
while above tells distance to the ceiling. If ground or ceiling is
deeper/higher than radius, radius will be returned

see complete documentation of calculations in lua_api.txt

added settingtypes.txt for easy changing values

api_only disables all animals and makes only api available
radar_debug prints debug of radar function in chat


I hope this function can maybe also help the eagle from
aerotest/mobkit find its way :)


my whales are using this function. Turn debug on to see
how it works
My servers: Jungle, Lilly in the valley click for my mods

Gundul
Member
Posts: 1189
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia
Contact:

Re: [mod] water_life - mobs for mobkit[water_life]

by Gundul » Post

implemented the new water_life.radar function in Termos aerotest mod featering Extex Eagle model and animation
viewtopic.php?f=9&t=22112&start=300#p361413

It is not yet perfect, but the eagle is already avoiding obstacels very well.

try yourself or join ZombieTest server to try it out.
"/eagle" will spawn an eagle in front of you, flying away in player's view direction
depends on : mobkit, water_life

All credits for Code goes to Termos, excapt radar implementation
Model/Texture by Extex
Attachments
aerotest.zip
Aerotest with radar from water_life
(76.5 KiB) Downloaded 15 times
Last edited by Gundul on Tue Jan 14, 2020 03:19, edited 1 time in total.
My servers: Jungle, Lilly in the valley click for my mods

User avatar
Extex
Member
Posts: 193
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [mod] water_life - mobs for mobkit[water_life]

by Extex » Post

Gundul wrote:implemented the new water_life.radar function in Termos aerotest mod featering ExTex Eagle model and animation
viewtopic.php?f=9&t=22112&start=300#p361413

It is not yet perfect, but the eagle is already avoiding obstacels very well.

try yourself or join ZombieTest server to try it out.
"/eagle" will spawn an eagle in front of you, flying away in player's view direction
depends on : mobkit, water_life

All credits for Code goes to Termos, excapt radar implementation
Model/Texture by ExTex
Cool I'll try it out. Also its Extex XD


Oh also could you please use the updated model and texture here: viewtopic.php?f=9&t=22112&start=375#p363312
The old one has a broken flap animation and the texture got discoloured somehow.

For some reason Termos isn't updating it
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 8 guests