Mobkit - Entity API [mobkit][alpha]

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Mon Sep 02, 2019 18:09

twoelk wrote:how about some jellyfish teaming up?

I'm not planning to do jellyfish atm, but it's definitely doable using mobkit, all it takes is a model and a couple of behavior functions, maybe someone else will?

Andrey01 wrote:Can I donwload dev version with those sharks?

I've been messing with the behaviors since, so dev version is in pieces atm. Turns out I'll be unable to work on this for a couple of weeks, all I can say is sharks are going to be included in the very next release, hopefully later this month.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Tue Sep 03, 2019 04:30

Termos wrote:Turns out I'll be unable to work on this for a couple of weeks, all I can say is sharks are going to be included in the very next release, hopefully later this month.


Nevermind, take your time. :)

I will be happy when I can add it to ZombieTest.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Sun Sep 15, 2019 16:04

Difficult to say when I'll have some time to work on this, no release this time, but should anyone be interested in checking out, the dev version seems to work somewhat. Sharks are in.

mobkit
zombiestrd

It's very crude and probably buggy as hell though.

By the way, does anyone know, in github, how to get rid of the branch suffix appended to the main folder name inside the download zip?
 

User avatar
Lone_Wolf
Member
 
Posts: 2218
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: Mobkit - Entity API [mobkit][alpha]

by Lone_Wolf » Sun Sep 15, 2019 17:01

Termos wrote:By the way, does anyone know, in github, how to get rid of the branch suffix appended to the main folder name inside the download zip?

Nope, but if you set the name of the mod in its mod.conf that shouldn't matter too much
Content DB -|- Working on Voxel Knights
 

Kurtzmusch
Member
 
Posts: 36
Joined: Sat Oct 21, 2017 18:12
In-game: Kurtzmusch

Re: Mobkit - Entity API [mobkit][alpha]

by Kurtzmusch » Sun Sep 15, 2019 17:30

you could drop those zip files and just work on a dev branch, leting people clone the stable master branch, once the dev is stable enough you can merge it, this makes it a lot easyer for people to update the mod with a git pull
Like Puzzles? Escape The Dungeon
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Mon Sep 16, 2019 18:37

Termos wrote:Difficult to say when I'll have some time to work on this, no release this time, but should anyone be interested in checking out, the dev version seems to work somewhat. Sharks are in.


the sharks are great. I am impressed. I could watch them swimming for hours :)

ZombieTest is updated :)
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Tue Sep 17, 2019 20:01

Tried coming a little bit closer yet?

I haven't had the time to test it properly, to make sharks spawn more often change line 175
if height and height >= 0 and
to
if height and

I don't see any good reasons for zombies not to spawn underground as well.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Tue Sep 17, 2019 21:58

Hi,

I've checked it. Cool.

The sharks do not respond to a 'max_speed' change. Always the same velocity fast).

:-)
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Wed Sep 18, 2019 07:48

runs wrote:The sharks do not respond to a 'max_speed' change. Always the same velocity fast

Only in the example mod - I didn't care to make use of this parameter.

Behaviors themselves all take the speed param, max_speed can be passed there from a mod's brainfunc.
I'm just not sure these wip behaviors make good examples, take them with a grain of salt.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Wed Sep 18, 2019 16:52

Termos wrote:Tried coming a little bit closer yet?

I did not have too much time to test yet. But what I saw when I manually spawned
3 or 4 of them is that they sometimes collide. Got stuck for a moment and then turn in an
other direction. I guess they would probably also collide with other water animals if there
were any. Maybe a check if an other entity is nearby and moving on same y level is needed ?

Termos wrote:I don't see any good reasons for zombies not to spawn underground as well.

For my taste it is good as it is. But a setting could manage this easily.


I just had an idea that it would be very cool to spawn water mobs in swarms
and also let them swim like a swarm does. Same for land animals like sheep or cattle in a herd.
Like this sharks, dolphins or other big fishes could come in packs of 5 or 6 animals at a time.
Last edited by Gundul on Thu Sep 19, 2019 04:28, edited 1 time in total.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Wed Sep 18, 2019 20:27

Thing is, what height>=0 effectively does is allow them to spawn only in the shallows, definitely not intended.

Gundul wrote:when I manually spawned 3 or 4 of them is that they sometimes collide.

They don't even try not to atm.
Object collision avoidance should be relatively easy to do using raycast, but so far this hasn't been a big issue, so I don't consider it a priority, which should be the api itself.
I already feel guilty of skipping to the cool stuff too soon.

Gundul wrote:I just had an idea that it would be very cool to spawn water mobs in swarms
and also let them swim like a swarm does.

Exactly the kind of cool stuff I'm trying not to skip to,
but somebody point me to a good animated reef fish model I could use and I'll probably make it happen.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Extex » Wed Sep 18, 2019 23:53

A suggestion:
If a player traps a shark they look for open water and jump out of the water to get out of the players trap
So they'll jump out of the smaller pool into the bigger one
Player of PK, RIP. Creator of the light_tool and christmas mods. Working on another mod which should be coming soon!
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Thu Sep 19, 2019 16:16

Termos wrote:I already feel guilty of skipping to the cool stuff too soon.

I do not think it is too soon and no reason to feel guilty :). People need something to see and feel.
I have seen many apis coming and vanishing in the past 4 years. If there is no advertisment of what the
api is actually capable to do, it is a useless api because most people can not imagine of what it can do.
It was a good idea to let it come together with a demo mod like wildlife. The Zombies are good and sharks are
best. there is no comparable shark mob for mobs_redo.

Termos wrote:Exactly the kind of cool stuff I'm trying not to skip to,
but somebody point me to a good animated reef fish model I could use and I'll probably make it happen.

I would if I could, but I have no talent in design. I can not even draw a fish with a pencil on paper. X)
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Sat Sep 21, 2019 14:04

Extex wrote:If a player traps a shark they look for open water and jump out of the water to get out of the players trap
So they'll jump out of the smaller pool into the bigger one

Now that's some suggestion. I'm pretty sure AAA titles wouldn't mind having AI like that.

Mobkit mobs typically can 'see' and make sense of 1 to 8 nodes at a time,
but being able to make out distinct map features consisting of at least hundreds of nodes in an ever changing environment is a whole new level entirely.

Wish that was possible though.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Sun Sep 22, 2019 13:21

I have seen that sharks spawn also in sweet water (river_water).
That means if you have valleys mapgen running, they sometimes even spawn in the smallest river ponds, just circling around in place :)

Maby before spawning a water mob, there should be a check of which water it is and if there is a minimum of
source nodes of it around spawning position.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Sun Sep 22, 2019 17:29

Gundul wrote:Maby before spawning a water mob, there should be a check of which water it is and if there is a minimum of source nodes of it around spawning position.

Yes, probably it should,
however, I refuse to depend on anything other than minetest api, so the examples work with any and all games and mods. It's up to you to modify them according to your setup.

Simplest way, there's this:
if liquidflag then -- sharks
around line 182

then, if you're using MTG
if liquidflag and mobkit.nodeatpos({x=pos2.x,y=height+0.01,z=pos2.z}).name=='default:water_source' then
should do the trick.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Mon Sep 23, 2019 16:31

Termos wrote:
Gundul wrote:Maby before spawning a water mob, there should be a check of which water it is and if there is a minimum of source nodes of it around spawning position.

Yes, probably it should,
however, I refuse to depend on anything other than minetest api, so the examples work with any and all games and mods. It's up to you to modify them according to your setup.

And this what I am talking about. Valleys mapgen is vanilla Minetest. So is default:riverwater_source. :)
I do not know if river_water is also used in other minetest mepgens.

An other question is, which part is handling the spawning of mobs ?
Is that your mobkit, or is it the mod with the containing mob itself. ?
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Mon Sep 23, 2019 17:34

Gundul wrote:Valleys mapgen is vanilla Minetest. So is default:riverwater_source. :)
I do not know if river_water is also used in other minetest mepgens.

For valleys it is mapgen_river_water_source, default:river_water_source is an MTG alias, and every other game is free to rename it as they please.
Actually, I'll see if mapgen node name can be accessed somehow via minetest api.
(edit: yup, minetest.registered_aliases)

Gundul wrote:An other question is, which part is handling the spawning of mobs ?
Is that your mobkit, or is it the mod with the containing mob itself. ?

There are many correct ways to do spawns, that's why I consider it a mod side thing and my examples use custom spawn functions - check spawnstep().

However, I added an abstraction of the method to mobkit should one want to use it, the function is mobkit.get_spawn_pos_abr(dtime,intrvl,radius,chance,reduction)
Called from a global step, most of the time it does nothing and thus consume no resources, but occasionally it gets a viable spawn position on behalf of one random connected player.

On some servers using redo's abm based spawns, I noticed the spawn chances have been tweaked to the point hardly any spawns ever happen (but abms still active and using up res).
With the mobkit function you can spawn away for next to zero resource cost.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Fri Sep 27, 2019 12:21

I git'd it at last.

Alpha release 190927
mobkit
wildlife
zombiestrd

Changes:

mobkit:
    added function mobkit.pos_translate2d(pos,yaw,dist)
    added function mobkit.go_forward_horizontal(self,yaw,speed)
    aquatic behavior mobkit.hq_aqua_roam(self,prty,speed)
    aquatic behavior mobkit.hq_aqua_turn(self,prty,tyaw,speed)
    aquatic behavior mobkit.hq_aqua_attack(self,prty,tgtobj,speed)
zombiestrd:
    added Shark aquatic mob

Sharks spawn only in at least two nodes deep regular water, they try to avoid obstacles and shallows, and will attack players on sight, given they are in at least 2 nodes deep water as well.
 

R-One
Member
 
Posts: 146
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

Re: Mobkit - Entity API [mobkit][alpha]

by R-One » Fri Sep 27, 2019 13:42

hi, as usual ... great job!

A quick question: Is it possible to have passive mobs reproduced?

for example, to program a brain that when they are in a padded enclosure that will be a feeder and a trough, they feed properly and then they have a chance to reproduce? that includes of course to have sexual mobs ...
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Sat Sep 28, 2019 09:15

R-One wrote:hi, as usual ... great job!

A quick question: Is it possible to have passive mobs reproduced?

for example, to program a brain that when they are in a padded enclosure that will be a feeder and a trough, they feed properly and then they have a chance to reproduce? that includes of course to have sexual mobs ...


My Petz mod have a fed/breed system close you describe. So yes, it is possible!
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Termos » Sat Sep 28, 2019 21:35

R-One wrote:for example, to program a brain that when they are in a padded enclosure that will be a feeder and a trough, they feed properly and then they have a chance to reproduce?

Sure it is possible, and has been done as runs said before.
I just don't care about introducing features based on MC to my example mods.

As to testing if they are penned, one way could be a behavior that simulates a mob walking in four directions and then checks how far they would get, but again, I don't see good reasons to restrict reproduction to penned animals, except if trying to recreate MC.
 

User avatar
ElCeejo
Member
 
Posts: 49
Joined: Thu Feb 28, 2019 23:29
In-game: ElCeejo

Re: Mobkit - Entity API [mobkit][alpha]

by ElCeejo » Sun Sep 29, 2019 00:54

Would it be possible to have mobs defend their owners when attacked, or attack anything their owner punches? I've tried accomplishing it using mobkit functions but I've had no luck so far.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by runs » Sun Sep 29, 2019 10:11

ElCeejo wrote:Would it be possible to have mobs defend their owners when attacked, or attack anything their owner punches? I've tried accomplishing it using mobkit functions but I've had no luck so far.


My Petz mod has mobs that defend owners (not when attacked, but against all player close to the owner after give them a order). But it would be trivial to do a check to init the attack only after a first punch. So yes for the first question.

I'd do it:

1) Grab the player that hit the owner (player_that_attack) in the on_punch event. And set a variable on the mob to mark the attack status (self.attack_player), maybe this variable would have to be reseted after a time.

2) In the behaviour:

Code: Select all
local player = mobkit.get_nearby_player(self) --get the player close
local player_name = player:get_player_name()
if prty < 10 then
 if player then
   if (self.owner == true and player_name ~= self.owner) then
          if vector.distance(pos, player:get_pos()) <= self.view_range then   -- if player close
      if self.attack_player == true and player_name == player_that_attack then --attack player                              
      mobkit.hq_warn(self, 10, player) -- try to repel them
      return      
          end
   end
end


For the second question I guess that yes too.

The problem with mobkit is to understand its behaviour philosophy based on priorities. And to do your own hq functions for advanced features. After that, you could do all you want.
 

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

Re: Mobkit - Entity API [mobkit][alpha]

by Gundul » Sun Sep 29, 2019 12:41

Termos wrote:I git'd it at last.

thanks, that makes it easier to work with your mods and api. :)
I think your api could advance to at least beta. It is running stable and reliably
and has much less cpu impact on server hardware than other mob apis.
I added mobkit, wildlife mod and the sharks from zombiestrd to my other server
'Lilly in the valley' to test if server can handle it. So far it runs very well, no lag
added.

Termos wrote:
    added Shark aquatic mob

Sharks spawn only in at least two nodes deep regular water, they try to avoid obstacles and shallows, and will attack players on sight, given they are in at least 2 nodes deep water as well.

I do not know if that was me, isolating the sharks from zombiestrd, or it is your mod. But first adding it to Lilly
sharks spawned everywhere on land where water was nearby. That means on farming land also, where you need a
water node to get wet_soil. I added a check for min # waternodes before spawning a shark:
https://github.com/berengma/sharks
My servers: Jungle, Lilly in the valley, ZombieTest
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 8 guests