[mod] water_life - mobs for mobkit[water_life]

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

[mod] water_life - mobs for mobkit[water_life]

by Gundul » Fri Oct 04, 2019 15:02

Water_Life

Image


Descreption:
a mod which adds mobs living in or around water
so far there are whales and sharks

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 code

Dependencies:
mobkit:https://forum.minetest.net/viewtopic.php?f=9&t=22112

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


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. Code is taken from termos zombiestrd mod. All credits to him for the code.

I only tweaked a bit of code so that the whales do not move and spawn like the sharks :)

This is wip, so expect that not everything is already working like it should sometimes.
Last edited by Gundul on Wed Oct 09, 2019 16:27, edited 1 time in total.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Fri Oct 04, 2019 20:50

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Sat Oct 05, 2019 11:07

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, ZombieTest
 

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

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

by runs » Sat Oct 05, 2019 12:10

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)
 

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

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

by Termos » Sat Oct 05, 2019 15:06

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Sat Oct 05, 2019 15:55

runs wrote:
mobkit.is_in_deep(target)

unfortunatley whales are too big, that this would work
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Gundul » Sat Oct 05, 2019 15:59

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, ZombieTest
 

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

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

by Termos » Sat Oct 05, 2019 17:10

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Sun Oct 06, 2019 12:03

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, ZombieTest
 

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

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

by Gundul » Sun Oct 06, 2019 16:18

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

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

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

by Termos » Mon Oct 07, 2019 12:09

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Tue Oct 08, 2019 16:46

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, ZombieTest
 

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

Sharks

by Gundul » Wed Oct 09, 2019 16:40

--- 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, ZombieTest
 

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

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

by Gundul » Sat Oct 12, 2019 16:13

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, ZombieTest
 

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

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

by Gundul » Sun Oct 13, 2019 12:39

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, ZombieTest
 

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

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

by NoctisLabs » Tue Oct 15, 2019 18:05

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Tue Oct 15, 2019 18:36

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, ZombieTest
 

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

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

by Gundul » Sun Oct 27, 2019 10:10

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, ZombieTest
 

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

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

by Gundul » Sun Oct 27, 2019 11:08

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, ZombieTest
 

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

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

by Termos » Sun Oct 27, 2019 12:27

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Sun Oct 27, 2019 14:39

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, ZombieTest
 

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

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

by Termos » Sun Oct 27, 2019 18:04

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: 585
Joined: Thu Aug 27, 2015 10:55
Location: Europe/Asia
GitHub: berengma
IRC: Gundul

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

by Gundul » Wed Oct 30, 2019 05:26

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, ZombieTest
 

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

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

by Gundul » Fri Nov 01, 2019 16:52

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, ZombieTest
 

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

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

by Gundul » Sat Nov 09, 2019 16:42

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, ZombieTest
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: MSN [Bot] and 3 guests