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

Post Reply
Gundul
Member
Posts: 1023
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

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

by Gundul » Post

Water_Life

Image


Credits:
  • - whale model and animation by DOOMed
    - shark model and animation by Termos
    - riverfish model and animation by Melkor
    - Piranha, Sea urchin model and animation by ElCeejo
    - Coral-, Clownfish and gulls models and animations by Sapier
    - Crocodile (Mr. Croc) model and animation by APercy
    - Rattlesnake, Tokeh and Beaver model and animation by MisterE
    - pathfinder code by burli viewtopic.php?f=9&t=17406
Description:
a mod which adds mobs living in or around water
so far there are whales, sharks, riverfish, piranhas, sea urchins,
clownfish, coralfish, clams and jellyfish.
Animals like crocodiles and rattlesnakes can live in water and
on land, too.
New:beavers

Also there is muddy water for jungle and savannah biome and it has
an documented api to use with your own mod if you like. For example
there is a radar function using raycasts which might help you navigating
flying mobs or mobs with large collisionboxes,


License:
CC BY-SA 3.0 UNPORTED. Created by D00Med for model/texture of whale
whale_1.ogg - CC0 Public Domain - https://en.wikipedia.org/wiki/File:Humpbackwhale2.ogg
MIT License - Copyright (c) 2019 TheTermos for sharks
CC-BY-NC-SA 3.0 Riverfish by Melkor (memberlist.php?mode=viewprofile&u=301)
CC-BY-SA 3.0 for coral-, clownfish and gulls by Sapier
CC-BY-SA 3.0 for piranha and sea urchin from ElCeejo
CC-BY-SA 3.0 for crocodile from APercy
CC0 for all models from MisterE

URL: http://creativecommons.org/licenses/by- ... /legalcode
https://creativecommons.org/publicdomain/zero/1.0/

Dependencies:
mobkit:viewtopic.php?f=9&t=22112
default

Github:
Code: https://github.com/berengma/water_life
Download Zip: https://github.com/berengma/water_life/ ... master.zip

WIP MineClone2 Version
Download zip: https://github.com/berengma/water_life/archive/mcl.zip
Code: https://github.com/berengma/water_life/tree/mcl

I hope this will grow to a collection of water mobs supporting the new mobkit.
It all starts with a whale. i took that from dmobs so all credits for textures and model go to
doomed. Now it already has sharks (thanks TheTermos for model and animation) and the
newest addition is a small riverfish (thanks to Melkor for model/animation)


I did the coding and added an api.
api documentation you can find in the lua_api.txt file
Last edited by Gundul on Thu Oct 22, 2020 16:07, edited 55 times in total.
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Now this is just huge. ;)
Can't wait to visit Lilly and check it out.

One thing of importance: aqua_radar is suited for smaller mobs up to one node wide, and tests only one node in front of them, so whales using it might try to fit in small rivers.
But there's one function just made for such monstrosities: check mobkit.get_nodes_in_area.

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

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

by Gundul » Post

Termos wrote:Now this is just huge. ;)
...so whales using it might try to fit in small rivers.
But there's one function just made for such monstrosities: check mobkit.get_nodes_in_area.
Yes whales tend to strand on beaches as well. I need to add something to whales brain to keep them in deep waters.
My servers: Jungle, Lilly in the valley, 3xile

User avatar
runs
Member
Posts: 1813
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

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

by runs » Post

Gundul wrote:
Termos wrote:Now this is just huge. ;)
...so whales using it might try to fit in small rivers.
But there's one function just made for such monstrosities: check mobkit.get_nodes_in_area.
Yes whales tend to strand on beaches as well. I need to add something to whales brain to keep them in deep waters.
mobkit.is_in_deep(target)
Day 42 of the quarantine

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Gundul wrote:Yes whales tend to strand on beaches as well.
Just like the real thing, I'm afraid.

I must say you undertook quite an ambitious endeavor. Moving large boxes is a little bit tricky, haven't tackled it myself yet.

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

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

by Gundul » Post

runs wrote:
mobkit.is_in_deep(target)
unfortunatley whales are too big, that this would work
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

Termos wrote:
Gundul wrote:Yes whales tend to strand on beaches as well.
Just like the real thing, I'm afraid.

I must say you undertook quite an ambitious endeavor. Moving large boxes is a little bit tricky, haven't tackled it myself yet.
I got a pretty nice sonar function scanning what is 20 nodes in front of the whale.
But somehow I do not get that turn around working:

Code: Select all

mobkit.clear_queue_high(self)
mobkit.hq_aqua_turn(self,30,yaw-pi,1)
This should do a 180 degree turnaround, no ?


Edit:
I think I got it working now.
But I think I have to write a custom hq_aqua_roam function for huge water mobs.
One that makes less turns.
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Gundul wrote: But I think I have to write a custom hq_aqua_roam function for huge water mobs.One that makes less turns.
Yes, that and turn rate could be reduced as well, fast turns don't look right on such a massive object.
I recommend taking these behaviors and making em your own. Just copy them over to your mod and remember to rename, as other mods might be using the builtin version.

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

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

by Gundul » Post

Update

whales have an own movement function now, better sonar
and avoid stranding or collision with buildings in the sea.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

updated again sonar function, whales now even better in avoiding things
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Much better now.
One final improvement I'd make, instead of reducing turn angle to reduce turn rate.
mobkit.turn2yaw(self,tyaw,rate) takes turn rate expressed in radians per second, I guess values around 1.0 or less should be appropriate for these giants.

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

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

by Gundul » Post

updated whales again:

- decision making, a whale will choose if better turn left or right
- dive on attack, when hitting a whale he will try to dive
- smoother turning movements with new turn function
My servers: Jungle, Lilly in the valley, 3xile

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

Sharks

by Gundul » Post

--- Sharks ---


added sharks to water_life mod.


All credits go to Termos. This mod is isolated from his zombiestrd mod where you can have zombies together
with the sharks. A demo mod for his mob api: mobkit.

Image

I changed a bit af code, so that the sharks do avoid whales. That also brings an advantage for you. Swimming with whales keeps you safe from sharks :)


coming next:
- drops when killing whale or shark
- smaller fish near corals
- special weapon for whale hunters


if someone is good in design and texturing and would like to paint some fish or other sea animals, please
contact. I have many talents, but designing or painting is none of them.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

little update:

- only one globalstep function to do the spawnstep.
- whales can remember their last decision about turning right, or left
- but whales can also forget about decisions after some time
- clean up code
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

updated again:

mobs now do give drops when killed
drops can be registered in the entity definition table {name,chance,min,max}
(for example {name = "farming:bread", chance = 2, min = 1, max = 5,},)
a table of drops is possible


started adding an api to handle global functions
first is water_life.handle_drops(self)

the whales are harder to kill and now show remaining hp in % in nametag
My servers: Jungle, Lilly in the valley, 3xile

User avatar
NoctisLabs
New member
Posts: 6
Joined: Mon Sep 30, 2019 00:44
GitHub: NoctisLabs
IRC: NoctisLabs
In-game: NoctisLabs
Location: Falcon Heavy, LEO

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

by NoctisLabs » Post

I like the audio warning for sharks, but the electric guitar is a bit jarring and if there's multiple sharks it can get really loud with all the music overlapping.

What if instead we played a simple heart beat sound if any shark is nearby? Maybe the heartbeat could get faster/louder as the sharks get closer.

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

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

by Gundul » Post

NoctisLabs wrote:I like the audio warning for sharks, but the electric guitar is a bit jarring and if there's multiple sharks it can get really loud with all the music overlapping.

What if instead we played a simple heart beat sound if any shark is nearby? Maybe the heartbeat could get faster/louder as the sharks get closer.
That would be possible, but need some extra power to calculate for each player the distance to each shark.
I will check if there is not a more cpu friendlier way to handle shark sounds maybe.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

Whales fixed


Whales are fixed and behave like they should again.
No problem anymore with newest mobkit version.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

new api to add any mob on sharks' menu

water_life.register_shark_food(name)

name is the name of the entity, for example "wildlife:deer"
deer and wolf is automatically added if wildlife mod is present.
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Gundul wrote:That would be possible, but need some extra power to calculate for each player the distance to each shark.
I will check if there is not a more cpu friendlier way to handle shark sounds maybe.
Sharks can play sounds on behalf of individual players, just use minetest api function for that, as mobkit doesn't touch anything player related by design.

The following could happen on init of the attack behavior:

A shark should look into player's metadata in order to make sure only one sound is played at a time
- no metadata entry: write the entry with a timestamp and play the sound
- entry present: check if tstamp older than the sound duration/ yes: overwrite and play/ no: nop

That's pretty much a cpu free solution.

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

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

by Gundul » Post

Termos wrote: Sharks can play sounds on behalf of individual players, just use minetest api function for that, as mobkit doesn't touch anything player related by design.

The following could happen on init of the attack behavior:

A shark should look into player's metadata in order to make sure only one sound is played at a time
- no metadata entry: write the entry with a timestamp and play the sound
- entry present: check if tstamp older than the sound duration/ yes: overwrite and play/ no: nop

That's pretty much a cpu free solution.
Yes that would be a cpu friendly solution, and not too difficult to implement.

But requested was this :)
Maybe the heartbeat could get faster/louder as the sharks get closer.
And that would mean I had to check frequently players and sharks position, at least of the nearest shark to each
player and adjust volume of shark sound.
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 328
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Maybe the heartbeat could get faster/louder as the sharks get closer.
Doesn't seem to be worth it, I'd personally fake it by just having the sound fade in, this would match what's happening 95% of the time.

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

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

by Gundul » Post

Termos wrote:
Maybe the heartbeat could get faster/louder as the sharks get closer.
Doesn't seem to be worth it, I'd personally fake it by just having the sound fade in, this would match what's happening 95% of the time.
I am still undecisioned about what to do tith shark sound.
Like in this mod when you swim near a whale a shark will not attack, but turn around. Come back, then turn again.
That means the sound would loop over and over again until you leave the neighbourhood of the whale.

And I am planning to do something like shark net which you can install next to your beach to keep them off.
That would be another source of looping shark sounds.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

added raw_meat which can be processed in furnace to meat. belongs to the meat group


also started a small river fish, but I am still struggeling with blender models and textures, so this
is not yet finished

whales and sharks give meat as drops when killed. In very rare situations there might be some
diamonds in their stomachs.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by Gundul » Post

little update:

stranded whales will get damage and die if they do not find out of shallow waters

fine tune spawning function to reduce lag and overpopulation
My servers: Jungle, Lilly in the valley, 3xile

Post Reply

Who is online

Users browsing this forum: LibraSubtilis, MoNTE48 and 5 guests