Mobkit - Entity API [mobkit][alpha]

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

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

by Termos » Post

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: 160
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

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

by R-One » Post

just one word: "wow !!!!"

Once again, thank you for your quality work.

how are the animations handled and declared ?

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

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

by Termos » Post

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.

u18398

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

by u18398 » Post

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>

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

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

by Termos » Post

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: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

So animations still not implemented?

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

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

by Termos » Post

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)

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

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

by Extex » Post

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()?
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

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

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

by Termos » Post

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

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

by Termos » Post

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: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

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

by Lone_Wolf » Post

Image
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

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

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

by Termos » Post

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: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

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

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

by Termos » Post

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: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

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

by Lone_Wolf » Post

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...
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

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?

u18398

Mobkit - little Testserver

by u18398 » Post

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

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

run_speed?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

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

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

by Termos » Post

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

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

by Termos » Post

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: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

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: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

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

by Lone_Wolf » Post

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
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

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

by runs » Post

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

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

by Termos » Post

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.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 12 guests