Mobkit - Entity API [mobkit][alpha]

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

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

by Termos » Sun May 12, 2019 18:36

They are coming

Image

MCL2 models that is. I have to employ existing models as test subjects, cause I don't have time to make my own in required variety.
This is a stress test, 100+ mobs active at same time.
 

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

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

by R-One » Wed May 15, 2019 22:46

just one word: "wow !!!!"

Once again, thank you for your quality work.

how are the animations handled and declared ?
 

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

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

by Termos » Thu May 16, 2019 21:35

R-One wrote:how are the animations handled and declared ?


What I came up with for now is a structure corresponding to minetest api.

animation = {
walk={range={x=0,y=40},speed=25,loop=true},
...


and a function:
mobkit.animate(self,anim)

this function does nothing if:
- anim is not defined for given entity
- anim animation is currently active

That's about it, because behaviors are queued and modular, usually all you need to do is call it on a behavior function's init and you're done.

In the clip above you can see some frames skipping, but that's my bad, messing around I put one of the calls in wrong spot.
 

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

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

by Gundul » Sun May 19, 2019 13:34

I downloaded it from the contentdb. A wolve chasing two deers in my testserver looks
very convincing. Like real animals. First the deers fled together, then they parted, so
the wolve had to chose one of them and then ... the server chrashed :)

Code: Select all
2019-05-18 13:16:06: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'wildlife' in callback luaentity_Step(): .minetest/mods/mobkit/init.lua:250: attempt to index a nil value
2019-05-18 13:16:06: ERROR[Main]: stack traceback:
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:250: in function 'is_neighbor_node_reachable'
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:285: in function 'get_next_waypoint'
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:364: in function 'goto_next_waypoint'
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:767: in function 'func'
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:481: in function 'execute_queues'
2019-05-18 13:16:06: ERROR[Main]:    .minetest/mods/mobkit/init.lua:1063: in function <.minetest/mods/mobkit/init.lua:955>
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Sun May 19, 2019 18:23

Gundul wrote:A wolve chasing two deers in my testserver looks
very convincing. Like real animals. First the deers fled together, then they parted, so
the wolve had to chose one of them and then ... the server chrashed :)


Much appreciated.
Fixed version download is available on the first page in this thread
ContentDB version pending approval.

This is how important feedback is.
This bug happened because animals ran into an unloaded area, which apparently doesn't happen on my setup.

I also somehow managed to upload the wrong file previously, there were some leftover diagnostic messages popping up on the screen. Should be quiet now.

I'll be grateful for any further feedback people.
 

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

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

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

by Termos » Mon May 20, 2019 20:38

runs wrote:So animations still not implemented?

Animation support is implemented, but not released yet.
The very next release will support them, although the example mod probably won't make use of them, because my models aren't even rigged yet, and I don't consider rigging a priority (unless it turns out people use Wildlife and there's demand)
 

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

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

by Extex » Wed May 22, 2019 20:12

5.x's all new set_rotation()

I can't seem to find any documentation on it and of course that's exactly the thing I need for a mod I'm making
How do you use set_rotation()?
Player of PK, RIP. Creator of the light_tool mod. Working on another mod which is pretty cool so far
 

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

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

by Termos » Thu May 23, 2019 18:10

Extex wrote:I can't seem to find any documentation on it and of course that's exactly the thing I need for a mod I'm making
How do you use set_rotation()?


The whole documentation is this:
"'rot' is a vector (radians). X is pitch (elevation), Y is yaw (heading)
and Z is roll (bank)."


I've been using only the Z component so far, so I might not be accurate, but from testing so far I think it works like this:

Y (yaw) - rotation around the vertical axis. Zero is facing positive world Z axis direction, pi and -pi are negative Z.
X (pitch) - rotation around the horizontal axis perpendicular to yaw direction. Zero is upright, pi/2 facing zenith, -pi/2 facing straight down
Z (roll) - rotation around the object's longitudinal axis. Zero is upright, plus is right, minus is left, pi and -pi are upside down


This also might help:
https://en.wikipedia.org/wiki/Aircraft_principal_axes
 

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

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

by Termos » Sat Jun 01, 2019 19:30

Image

This time I call it an alpha
The first post was updated with the release 0.10.0

There are many improvements like sound and animation support, but the most important is
the documentation file located at mobkit\mobkit_api.txt
I'd be grateful for any feedback: if the documentation is clear, should I elaborate on some topics, any bad English etc.

There's also included a new example minimod called:

Zombies - The Real Deal

Yet another cliche zombie mod to undeaden the still plains of Minetest games,
except these work differently than the usual MC based approach.

Normally zombies are not very perceptive, they usually just stand about wobbling and salivating, and can be easily snuck up on from behind, but it is common knowledge, that they are attracted to sounds and become suspicious if there's too much noise, so keep punching nodes and they will come swarming at you. Sounds of battle and noises made by other zombies can alert them as well.

To defeat a zombie one has to go for the head, everybody knows that, so equip something harder than wood and hit them in the cranium once - no more, no less. Hit them hard, only full punches count.
Otherwise nothing happens, except maybe more zombies are attracted.

Note: to my knowledge, the model used is licensed under CC-BY-SA and the attribution goes to one BlockMen, if that's incorrect please let me know.
 

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

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

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

by Termos » Sat Jun 01, 2019 21:43

This is interesting...

Can you please provide more info: MT version, game being used, any other mods running?
Is it reproducible?
 

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

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

by runs » Sat Jun 01, 2019 22:34

I get the following error:

Code: Select all
2019-06-02 00:31:00: 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:1047: attempt to index field 'lastvelocity' (a nil value)
2019-06-02 00:31:00: ERROR[Main]: stack traceback:
2019-06-02 00:31:00: ERROR[Main]:    /opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:1047: in function </opt/minetest/bin/../games/bogart/mods/mobkit/init.lua:1040>


It raises when I insert an 'on_activate' custom event (even empty).

Code: Select all
    on_activate = function(self, staticdata)
    end,


Another question:
animation = {
[name]={range={x=[num],y=[num]},speed=[num],loop=[bool]},
...
}

The range are the start and end frame?
 

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

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

by Termos » Sat Jun 01, 2019 23:24

runs wrote:It raises when I insert an 'on_activate' custom event (even empty).

Currently on_activate has to be = mobkit.actfunc, anything else will fail

What kind of tasks do you want to perform in on_activate?
If it's preserving some information, this is what mobkit.remember() is for

runs wrote:Another question:
animation = {
[name]={range={x=[num],y=[num]},speed=[num],loop=[bool]},
...
}

The range are the start and end frame?

Exactly, the table layout corresponds to minetest api set_animation().
 

User avatar
Lone_Wolf
Member
 
Posts: 2185
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 Jun 02, 2019 03:34

Termos wrote:This is interesting...

Can you please provide more info: MT version, game being used, any other mods running?
Is it reproducible?

Hmmmm. That was weird. Starting a new world fixed it. The old world had once had your wildlife mod enabled. Must have been controlling some spawned entities still.
I've played around with it a little. Some suggestions:

  • Visual Feedback - I couldn't tell if I was damaging the zombies or not
  • Slightly better attack (Zombie side) - If I circled a zombie group they would always miss me. Allowing me to kill them all pretty easily

Some of them jumped into the water (Failed attacks) and just froze once they reached the dry ground
Image
They move in water a little slowly too. Bug or feature?

All that aside: Awesome work! This is looking VERY promising...
 

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

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

by runs » Sun Jun 02, 2019 09:32

Termos wrote:Currently on_activate has to be = mobkit.actfunc, anything else will fail
What kind of tasks do you want to perform in on_activate?
If it's preserving some information, this is what mobkit.remember() is for
Exactly, the table layout corresponds to minetest api set_animation().


I want to set some vars on activate only once.

Now I made:
Code: Select all
on_activate = set_vars, --on_activate

set_vars = function(self)
  mobkit.actfunc(self)   
  local greeting = mobkit.recall(self, "greeting")
  if (greeting== nil) then
      minetest.chat_send_player("singleplayer", "Var is set") --It appears this message on screen and when reinit game
      mobkit.remember(self, "greeting", "hello")   
  end
end


But the var is not set. What am I doing wrong?
 

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

Mobkit - little Testserver

by Gundul » Sun Jun 02, 2019 12:27

I like that mobkit api very much already :) wildlife and zombies do show
very good what already is possible.

i set up a little server for testing in multi player enviroment:

gundul.ddnss.de Port 39155

kill as many zombies as you can and enter the leaderboard
type /score to see it.


No rules, just go crazy and kill them all, any chrashes will be reported here.
Minetest version is 5.1.0 dev
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

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

by runs » Sun Jun 02, 2019 15:36

Lone_Wolf wrote:
Termos wrote:This is interesting...

Can you please provide more info: MT version, game being used, any other mods running?
Is it reproducible?

Hmmmm. That was weird. Starting a new world fixed it. The old world had once had your wildlife mod enabled. Must have been controlling some spawned entities still.
I've played around with it a little. Some suggestions:

  • Visual Feedback - I couldn't tell if I was damaging the zombies or not
  • Slightly better attack (Zombie side) - If I circled a zombie group they would always miss me. Allowing me to kill them all pretty easily

Some of them jumped into the water (Failed attacks) and just froze once they reached the dry ground
Image
They move in water a little slowly too. Bug or feature?

All that aside: Awesome work! This is looking VERY promising...


Yes, mobs put in creative are able to jump to ground, but not if they pushed (in an attack i.e.)
 

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

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

by Termos » Sun Jun 02, 2019 16:56

runs wrote:set_vars = function(self)
mobkit.actfunc(self)


Wrong parameters passed to on_activate, it should be:
set_vars = function(self,staticdata,dtime_s)
mobkit.actfunc(self,staticdata,dtime_s)

Turns out I made the code too safe, It would have been better if it crashed in this case.

That said, the memory item should be set correctly regardless, maybe check the code that displays the greeting, I'll check mine.

runs wrote:run_speed?

I'll probably rename walk_speed to max_speed, because that's what it really is.
Built in behaviors just use this parameter and reduce multiplying by some number in (0,1) if needed.
Last edited by Termos on Sun Jun 02, 2019 17:44, edited 1 time in total.
 

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

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

by Termos » Sun Jun 02, 2019 17:43

Lone_Wolf wrote:[Visual Feedback - I couldn't tell if I was damaging the zombies or not

Technicly you don't ever damage them, the usual hitpoint thing doesn't apply.
You either one hit kill them or do no harm at all, just like the movies ;) so if they're still kicking, you done no damage at all.

One thing I added may be confusing:
I find the default tool meele range of 4 meters to be bit ridiculous. I'm trying to keep it not dependent and didn't want to mess with mining anyway, so I reduced the range to 2 just for zombie combat, so object selection boxes appear before they can be hit.

Lone_Wolf wrote:Slightly better attack (Zombie side) - If I circled a zombie group they would always miss me. Allowing me to kill them all pretty easily

I could factor in target velocity, but that might turn out to be too brutal. I meant it as a distraction during normal building/mining gameplay, rather than meat grinder.
But yeah, the final attacking behavior should lead the target I think.

Lone_Wolf wrote:Some of them jumped into the water (Failed attacks) and just froze once they reached the dry ground

Some builtin behaviors are still not too refined and mobs can get stuck sometimes.
But the gist of the api is it's modular, so what needs to be done to improve it is to modify one isolated function, in this case hq_swimto. I'm gonna look into this.

Lone_Wolf wrote:They move in water a little slowly too. Bug or feature?

This is intended, shouldn't make much difference atm, because for now all they can do while in water is swim towards the land. Water requires all new set of behaviors which are still missing.
 

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

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

by runs » Sun Jun 02, 2019 17:59

I think my problem is with 'self.object:set_properties':

Code: Select all
on_activate = set_vars, --on_activate

set_vars = function(self, staticdata, dtime_s)
  mobkit.actfunc(self, staticdata, dtime_s)   
  local greeting = mobkit.recall(self, "greeting")
  if (greeting== nil) then
      minetest.chat_send_player("singleplayer", "Var is set") --It appears this message on screen and when reinit game
      mobkit.remember(self, "greeting", "hello")   
      self.object:set_properties("textures", "texture.png")
  end
end


When I do that (set_properties), the entity clears its data.
Last edited by runs on Sun Jun 02, 2019 18:34, edited 4 times in total.
 

User avatar
Lone_Wolf
Member
 
Posts: 2185
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 Jun 02, 2019 18:24

Termos wrote:
Lone_Wolf wrote:Visual Feedback - I couldn't tell if I was damaging the zombies or not

One thing I added may be confusing:
I find the default tool meele range of 4 meters to be bit ridiculous. I'm trying to keep it not dependent and didn't want to mess with mining anyway, so I reduced the range to 2 just for zombie combat, so object selection boxes appear before they can be hit.

Ah, that would be it. A red message warning (About the range) next to the download button would be handy
Good to know lol
 

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

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

by runs » Sun Jun 02, 2019 18:55

I'll probably rename walk_speed to max_speed, because that's what it really is.
Built in behaviors just use this parameter and reduce multiplying by some number in (0,1) if needed.


I mean that current run speed or follow is fast a lot.

Check it:
https://streamable.com/qlu0z
 

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

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

by Termos » Sun Jun 02, 2019 19:14

runs wrote:I think my problem is with 'self.object:set_properties':
Code: Select all
      self.object:set_properties("textures", "texture.png")
end


I'm surprised it doesn't crash, set_properties() is supposed to take a table as parameter, not strings.
maybe try something like:

local props = self.object:get_properties()
props.textures = {'texture.png'}
self.object:set_properties(props)


runs wrote:I mean that current run speed or follow is fast a lot.

Check it:
https://streamable.com/qlu0z

Dat look good! ;)

You mean their follow speed is too fast?
hq_follow uses maximum speed for mobs to try and keep up with the player. I you feel it's too fast, you might want to modify hq_follow, or just reduce entity walk_speed overall.
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 5 guests