Mobkit - Entity API [mobkit][wip]

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

Postby runs » Fri Feb 22, 2019 9:34 pm

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.
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby runs » Fri Feb 22, 2019 10:29 pm

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.
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Sokomine » Sat Feb 23, 2019 12:07 pm

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.
Sokomine
Member
 
Posts: 3742
Joined: Sun Sep 09, 2012 5:31 pm
GitHub: Sokomine

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

Postby Termos » Sat Feb 23, 2019 5:20 pm

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: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby Termos » Sat Feb 23, 2019 5:27 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby runs » Sat Feb 23, 2019 10:29 pm

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
    })
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Termos » Sat Feb 23, 2019 11:46 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby runs » Sun Feb 24, 2019 9:50 am

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>
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Termos » Sun Feb 24, 2019 6:08 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby runs » Sun Feb 24, 2019 6:10 pm

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. :-)
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby runs » Sun Feb 24, 2019 6:16 pm

I've tested it. Kitty is happy, now it can jump the hole :-D All is OK.
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Termos » Mon Feb 25, 2019 6:40 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby Lone_Wolf » Thu Feb 28, 2019 3:04 am

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...
Lone_Wolf
Member
 
Posts: 2113
Joined: Sun Apr 09, 2017 5:50 am
GitHub: LoneWolfHT
In-game: Lone_Wolf

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

Postby Termos » Fri Mar 01, 2019 9:12 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby runs » Fri Mar 01, 2019 9:51 pm

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
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Termos » Mon Mar 04, 2019 8:30 pm

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.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby runs » Mon Mar 04, 2019 9:51 pm

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.
runs
Member
 
Posts: 329
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

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

Postby Termos » Fri Mar 08, 2019 6:31 pm

Turns out I hate him too.
Image

5.x's all new set_rotation()
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby Termos » Mon Mar 11, 2019 7:10 pm

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: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby R-One » Wed Mar 13, 2019 12:54 pm

Here is a project that looks promising!

Small questions:

- would it be possible to integrate a variable that would list the blocks on which the mobs could not walk and jump? for example as fences.

- Is the mod mobkit zip up-to-date?

- Is there any integration of different gameplay such as feeding, taming ...?

- Will it be possible to generate flying or swimming mobs?

thank you for everything
R-One
Member
 
Posts: 79
Joined: Wed Dec 20, 2017 11:06 pm

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

Postby Termos » Wed Mar 13, 2019 9:20 pm

R-One wrote:- would it be possible to integrate a variable that would list the blocks on which the mobs could not walk and jump? for example as fences.

This being an api, I want to keep it free of any dependencies, so mobkit will probably never reference any specific node names or groups. However it is aware of these properties as they are exposed by minetest api.
Example: there's a separate function to check if a mob can move to a neighbor node, it takes an optional parameter - a list of no-go node names or groups. A modder can modify behaviors which use this function by passing the list.

In short, it's the modder's job to provide specific names based on his needs and whatever mods or subgames he's using, it's the api's job to make this task as straightforward and easy as possible.
R-One wrote:- Is the mod mobkit zip up-to-date?

No, it's just a preview, quite outdated. The current state of the api is so I could make an alpha release soon, but I feel an example mod should be included, something more than an aimlessly walking clown, and this may take time.
R-One wrote:- Is there any integration of different gameplay such as feeding, taming ...?

These are very specific, I don't think it's a good idea for an api to implement one of many possible ways to do these things. Again, my goal is rather to make coding such behaviors easy.
Taming for example, 'follow' and 'stay' behaviors are already in, what's left is to decide the condidtions under which a creature becomes tame, which is best left to modders.

But the bundled example mod might implement some of these at some point.
R-One wrote:- Will it be possible to generate flying or swimming mobs?

Definitely.
I started with land borne creatures only because they are the most needed and the most tricky to make move around.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby Termos » Mon Mar 18, 2019 8:01 pm

Which one is gonna win?
Image
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby R-One » Wed Mar 20, 2019 9:43 am

Excellent work !

Can we have an exit time and a roadmap?

I can not wait to test this in the games I'm developing, it's so cool to be able to give a unique character to each mob.

Did you update the preview?
R-One
Member
 
Posts: 79
Joined: Wed Dec 20, 2017 11:06 pm

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

Postby Termos » Fri Mar 22, 2019 10:42 pm

I'm afraid I can't offer any date estimates, I don't get to work on it with any regularity.

I can only say I'm going to update the download as soon as I finish the example mod. I'm hoping it's done in the next couple of weeks, but I can't promise.
Termos
Member
 
Posts: 55
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby R-One » Sun Mar 24, 2019 9:01 am

Thank you very much, I understand it.

I can not wait to see the result of your work. ;-)
R-One
Member
 
Posts: 79
Joined: Wed Dec 20, 2017 11:06 pm



Return to WIP Mods



Who is online

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