Mobkit - Entity API [mobkit][alpha]

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

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

by runs » Fri Feb 22, 2019 21:34

Termos wrote:I decided to post some preview code, attachments in the first post.
.


cool! If you complete it, I will use it in the mobs mod I'm working on.
 

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

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

by runs » Fri Feb 22, 2019 22:29

I've tested with my kitty mob:

-Kitty seems to avoid jumping heights, it can fall but it has to think about that.
-Kitty is not stuck on obstacles: cool!
-Kitty seems to spin too much.
-Kitty acts like a submarine in the water.
-I would like that kitty to follow me.
 

Sokomine
Member
 
Posts: 3827
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

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

by Sokomine » Sat Feb 23, 2019 12:07

Termos wrote:Entity property (function). Mobs must have it, inanimate objects not necessarily so. This is where the most important cognitive processes take place: where do we come from, what is the purpose of meaning, and above all - what are we going to do next.

Sounds like a good plan if you can manage to implement it. Most mods that want to do something with a (more intelligent) mob don't really have to know how to do all the small steps necessary to accomplish the larger goal. Duplication of code can be avoided, behaviour simulated. The builders I need for my citybuilder mod could profit.
A list of my mods can be found here.
 

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

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

by Termos » Sat Feb 23, 2019 17:20

runs wrote:I've tested with my kitty mob:

-Kitty seems to avoid jumping heights, it can fall but it has to think about that.
With this behavior active, they shouldn't fall down farther than they can jump back up. Would you tell me more about how it happened? What jump_height setting?

-Kitty seems to spin too much.
This is because there are no pauses between moves (intentional for demonstration purposes), so they go back and forth in rapid succession sometimes. You can try dropping a mobkit.lq_idle near the end in hq_roam.

-Kitty acts like a submarine in the water.
Buoyancy coming soon.

-I would like that kitty to follow me.
This is probably the next most important behavior, it's the very next on the todo list.
 

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

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

by Termos » Sat Feb 23, 2019 17:27

Sokomine wrote:
Termos wrote:Most mods that want to do something with a (more intelligent) mob don't really have to know how to do all the small steps necessary to accomplish the larger goal.

Yup, this is the point, when this is more developed it should be easy to create different mobs quickly using a sizable library of built in behaviors.
These are humble beginnings, so there's only one atm, but more will follow.
 

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

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

by runs » Sat Feb 23, 2019 22:29

Termos wrote:
runs wrote:I've tested with my kitty mob:

-Kitty seems to avoid jumping heights, it can fall but it has to think about that.
With this behavior active, they shouldn't fall down farther than they can jump back up. Would you tell me more about how it happened? What jump_height setting?.


Kitty cannot jump out this hole (even changing jump_heigh 1, 2, 3...)
Image

Code: Select all
minetest.register_entity("petz:kitty", {
   -- common props
   physical = true,
   rotate = Rotate,
   damage = 8,
    hp_min = 4,
    hp_max = 8,
    armor = 200,
    --stepheight = 1,
   collide_with_objects = true,
   collisionbox = CollisionBox,
   visual = Visual,
   mesh = Mesh,
   textures = Textures,
   visual_size = VisualSize,
   on_step = mobkit.stepfunc, -- required
   on_activate = mobkit.actfunc, -- required
   -- api props
   springiness=0.5,
   walk_speed = 1,
   jump_height = 5,
   brainfunc = function(self)   -- dumbest brain possible
      if mobkit.is_queue_empty_high(self) then mobkit.hq_roam(self) end
   end
    })
 

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

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

by Termos » Sat Feb 23, 2019 23:46

Springiness is not intended to be used with mobs, this is probably the cause, my guess is she bounces off the walls, try setting it to zero.
Also, I'd reduce the hitbox size 3 to 4 times to match the model, horizontal dimensions should never exceed 1 anyway.
 

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

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

by runs » Sun Feb 24, 2019 09:50

Termos wrote:Springiness is not intended to be used with mobs, this is probably the cause, my guess is she bounces off the walls, try setting it to zero.
Also, I'd reduce the hitbox size 3 to 4 times to match the model, horizontal dimensions should never exceed 1 anyway.


The model size is inside a node. No hitbox, but collisionbox.

Code: Select all
CollisionBox = {-0.35, -0.5, -0.28, 0.35, -0.125, 0.28}


If I comment it (the collisionbox is defined by the mesh itself), I get the following errors:

Code: Select all
2019-02-24 10:46:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Activate(): /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:317: attempt to perform arithmetic on a nil value


That's the line:

Code: Select all
self.height = self.collisionbox[5] - self.collisionbox[2]


And also:

2019-02-24 10:45:25: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:159: attempt to perform arithmetic on field 'height' (a nil value)
2019-02-24 10:45:25: ERROR[Main]: stack traceback:
2019-02-24 10:45:25: ERROR[Main]: /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:159: in function 'is_neighbor_node_reachable'
2019-02-24 10:45:25: ERROR[Main]: /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:290: in function 'func'
2019-02-24 10:45:25: ERROR[Main]: /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:192: in function 'execute_queues'
2019-02-24 10:45:25: ERROR[Main]: /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:366: in function </opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:320>
 

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

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

by Termos » Sun Feb 24, 2019 18:08

Ok, the main reason is such a model alignment is not supported.

Probably it should be, as existing models' alignment seems to be all over the place, so now it is.
Tested with redo kitten model, mobkit reuploaded.
Thanks, good testin.

That box of yours is still way too big though, and there are no good reasons for horizontal dimensions not to be equal.
 

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

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

by runs » Sun Feb 24, 2019 18:10

Termos wrote:Ok, the main reason is such a model alignment is not supported.

Probably it should be, as existing models' alignment seems to be all over the place, so now it is.
Tested with redo kitten model, mobkit reuploaded.
Thanks, good testin.

That box of yours is still way too big though, and there are no good reasons for horizontal dimensions not to be equal.


I know it, I'm still in an early development stage. :-)
 

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

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

by runs » Sun Feb 24, 2019 18:16

I've tested it. Kitty is happy, now it can jump the hole :-D All is OK.
 

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

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

by Termos » Mon Feb 25, 2019 18:40

Proper knockback.

Image
Nothing fancy, giving it an initial velocity is enough.
That it stops when it should and then mobs continue their tasks is a byproduct of physics and behaviors.
 

User avatar
Lone_Wolf
Member
 
Posts: 2168
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][wip]

by Lone_Wolf » Thu Feb 28, 2019 03:04

Termos wrote:Proper knockback.

Nothing fancy, giving it an initial velocity is enough.
That it stops when it should and then mobs continue their tasks is a byproduct of physics and behaviors.

That was definitely needed lol. Don't think I could stand letting one of those things get close to me...
 

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

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

by Termos » Fri Mar 01, 2019 21:12

Haha, he's a looker, ain't he?
True, his appearance may not be appealing to everyone's sensibilities,
so for the next clip i went with the Internet gold standard.

They can see me.
Image
Now they are equipped with basic sensory apparata, it's time for more complex behaviors involving other entities and players, like following, running away, hunting, mating etc.
 

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

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

by runs » Fri Mar 01, 2019 21:51

Termos wrote:Haha, he's a looker, ain't he?
True, his appearance may not be appealing to everyone's sensibilities,
so for the next clip i went with the Internet gold standard.

They can see me.
Image
Now they are equipped with basic sensory apparata, it's time for more complex behaviors involving other entities and players, like following, running away, hunting, mating etc.


ohhh :-D
 

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

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

by Termos » Mon Mar 04, 2019 20:30

I gotta feeling somebody's following me

Image

The simplest follower brain which makes them follow the first player they encounter looks like this:
Code: Select all
   brainfunc = function(self)   
      if mobkit.is_queue_empty_high(self) then
         local plyr = mobkit.get_nearby_player(self)
         if plyr then mobkit.hq_follow(self,plyr) end
      end
   end,


Simple enough, huh?
Alas, coding particular behavior functions is not as simple as I would like it to be, yet.
 

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

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

by runs » Mon Mar 04, 2019 21:51

Termos wrote:I gotta feeling somebody's following me

Image

The simplest follower brain which makes them follow the first player they encounter looks like this:
Code: Select all
   brainfunc = function(self)   
      if mobkit.is_queue_empty_high(self) then
         local plyr = mobkit.get_nearby_player(self)
         if plyr then mobkit.hq_follow(self,plyr) end
      end
   end,


Simple enough, huh?
Alas, coding particular behavior functions is not as simple as I would like it to be, yet.


Oh, impressive.
 

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

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

by Termos » Fri Mar 08, 2019 18:31

Turns out I hate him too.
Image

5.x's all new set_rotation()
 

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

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

by Termos » Mon Mar 11, 2019 19:10

Probably the coolest thing so far.
A mob attack that is defendable, makes combat more skill based and doesn't necessarily require animation
Image
If I didn't dodge, it would have bit me.

They are inert during jump/charge, so there's time to react and predict where they're gonna land. It also scales up nicely - combat with one opponent is easy, but it goes downhill fast when outnumbered.
Of course it will be way cooler with a very short 'prepare to jump' animation.
 

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

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

by Termos » Fri May 03, 2019 13:43

Now that was an epic disaster, two months no backup ;) Luckily there's Ggl.
Reuploaded the latest preview package, see the first post.

Meanwhile, coming up next:
Buoyancy is relatively easy, but making them find closest dry land and come ashore is more tricky.
Image
(no find_node_nears have been abused during the making of this clip)
 

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

User avatar
Andrey01
Member
 
Posts: 2267
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

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

by Andrey01 » Fri May 03, 2019 18:10

Termos wrote:Now that was an epic disaster, two months no backup ;) Luckily there's Ggl.
Reuploaded the latest preview package, see the first post.

Meanwhile, coming up next:
Buoyancy is relatively easy, but making them find closest dry land and come ashore is more tricky.
Image
(no find_node_nears have been abused during the making of this clip)

Nice!
 

WayBack Machine
New member
 
Posts: 6
Joined: Fri May 03, 2019 19:42

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

by WayBack Machine » Sat May 04, 2019 13:14

Termos wrote:Now that was an epic disaster, two months no backup ;) Luckily there's...

https://web.archive.org/web/20190425074 ... 2&start=50

...because yours is a particularly interesting thread. KUTGW
 

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

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

by Termos » Sat May 04, 2019 20:29


Thanks! Does it stay forever?

Kurtzmusch wrote:why no git repo though?

At this early stage repo would be impractical.
I'm working alone - one hand testing and the other coding at the same time, so the code is constantly being modified locally.

I'm gonna Git it as soon as it makes sense.
 

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

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

by Termos » Wed May 08, 2019 16:20

Quick update:
Uploaded the new version of wildlife, it features improved movement code, buoyancy and basic swimming, among other improvements.

Wildlife becomes it's own thing now, and likely it won't be getting many updates because next I'm moving on to working with third party animated models, as I don't have time for modelling and learning skeletal animation.
I'm also trying to submit it to contentDB, but approval is taking forever this time.

Edit: it's up on contentDB already: https://content.minetest.net/packages/Termos/wildlife/
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: Lone_Wolf and 2 guests