Mobkit - Entity API [mobkit][alpha]

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

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

by Termos » Post

Gundul wrote:Assignment to undeclared global
Yup, my bad.
Update 191113 should fix it.

____________________________________________________________________

For those whom this may concern: download the flight preview:
aerotest.zip
(13.97 KiB) Downloaded 19 times
Image

usage:
  • say the word 'fly' to launch a plane model in camera direction.
implementation:
  • it's done using low level behaviors as opposed to plain functions, because pitch/roll changes must be gradual so there's a need to maintain states over time.

    function aerotest.lq_fly_pitch(self,lift,pitch,roll,acc,anim)
    • this one tries to maintain constant pitch. Flight looks stable, but the thing can stall and fall if velocity too low. The example uses this one exclusively.
    function aerotest.lq_fly_aoa(self,lift,aoa,roll,acc,anim)
    • tries to maintain constant angle of attack. makes them less prone to stalling, but they tend to oscillate after abrupt changes of flight parameters. this one's very WIP.
    params:
    • lift: [number]
      multiplier for lift. faster objects need less, slower need more. typical value: 0.6 for speeds around 4 m/s

      pitch: [degrees]
      angle between the longitudinal axis and horizontal plane. typical range: <-15.15>

      aoa:
      [degrees] angle of attack - the angle between the longitudinal axis and velocity vector.

      roll: [degrees]
      bank angle. positive is right, negative is left, this is how they turn. if set too large they'll loose height rapidly

      acc: [number]
      propulsion. use with positive pitch to make them fly level or climb, set it to 0 with slight negative pitch to make
      them glide. typical value: around 1.0

      anim: [string]
      animation.
The example uses two simple high level behaviors to keep them between 18 and 24 nodes above ground, seems good already for ambient type flying creatures.
warning: never set_velocity when using these behaviors.
_
Attachments
aerotest.gif
(142.54 KiB) Not downloaded yet

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

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

by Gundul » Post

I am happy I can already try it out. It works well on my desktop at home.

When uploading it to ZombieTest I got this:

Code: Select all

2019-11-13 17:40:32: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'aerotest' in callback luaentity_Step(): //.minetest/mods/aerotest/init.lua:131: attempt to call field 'cross' (a nil value)
2019-11-13 17:40:32: ERROR[Main]: stack traceback:
2019-11-13 17:40:32: ERROR[Main]:       /.minetest/mods/aerotest/init.lua:131: in function 'func'
2019-11-13 17:40:32: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:733: in function 'execute_queues'
2019-11-13 17:40:32: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:941: in function 'func'
2019-11-13 17:40:32: ERROR[Main]:       .../share/minetest/builtin/profiler/instrumentation.lua:106: in function <.../share/minetest/builtin/profiler/instrumentation.lua:100>
mobkit I updated before.
My servers: Jungle, Lilly in the valley, ZombieTest

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

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

by Termos » Post

Gundul wrote:attempt to call field 'cross' (a nil value)
I forgot, vector cross product has been introduced in 5.1.0

To make it work in an older version quick, copy over vector.cross function from 5.1.0's builtin/common/vector.lua

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

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

by Gundul » Post

Termos wrote: I forgot, vector cross product has been introduced in 5.1.0
minetest 5.1.0-dev isn't counting ? :)

nevermind I will try to copy the function
My servers: Jungle, Lilly in the valley, ZombieTest

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

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

by Extex » Post

Melkor wrote:
Extex wrote:Image
This is beautiful!
Wow thanks that's a lot coming from you Melkor (Silmarillion reader! ) I'm a big fan of your models

P.S. Do you think could help me fix the rigging on my eagle?

P.P.S. Termos: here's the model
Attachments
Eagle.zip
(113.4 KiB) Downloaded 11 times
Last edited by Extex on Thu Nov 14, 2019 18:59, edited 1 time in total.
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

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

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

by Gundul » Post

Termos wrote:
To make it work in an older version quick, copy over vector.cross function from 5.1.0's builtin/common/vector.lua
Thanks, that worked. Now it is running on Zombietest.
My servers: Jungle, Lilly in the valley, ZombieTest

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

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

by Melkor » Post

Thanks!
Extex wrote: P.S. Do you think could help me fix the rigging on my eagle?
I'll see what i can do :)

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

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

by Extex » Post

Melkor wrote:Thanks!
Extex wrote: P.S. Do you think could help me fix the rigging on my eagle?
I'll see what i can do :)
Thanks the feet are the most problematic rn
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

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

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

by Termos » Post

Gundul wrote:Thanks, that worked. Now it is running on Zombietest.
That's unexpected ;), I hope you enabled timeout at least, so they don't stay forever.
Melkor wrote:
Extex wrote: P.S. Do you think could help me fix the rigging on my eagle?
I'll see what i can do :)
If you guys don't mind my opinion, I think it would be best if the pivot point was somewhere between the wings instead at the feet, and if the body was oriented horizontally in flying pose.
And of course if it faced the front with it's head.

I tried to use the model anyway, but I don't know how to reorient it after it's already been rigged and keyframed.

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

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

by Extex » Post

Termos wrote: If you guys don't mind my opinion, I think it would be best if the pivot point was somewhere between the wings instead at the feet, and if the body was oriented horizontally in flying pose.
And of course if it faced the front with it's head.

I tried to use the model anyway, but I don't know how to reorient it after it's already been rigged and keyframed.
Yeah that'd be good XD Honestly I am pretty awful at rigging

I was planning on rotating the eagle into a flying position with the feet curled up during flight
and a Landing animation with bird leaning back and feet forward but feet don't work and I have to animate several bones to move the model

P.S. Even if your fixing it breaks my animations It'l be fine (I can redo them)
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

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

by Melkor » Post

Well, is done!
I changed the bones position in the feet, now they can pivot correctly, the weight painting/skinning/rigging was remade too. Some bones are not parented to the main bone, i don't know if this is intentional so i left it unchanged. The rest of the armature seems fine.
I took the liberty of modify the some of the mesh, and the texture where "compressed" a bit, resulting in a smaller image, playing with the UVmap can do interesting things. you will see :)
Another thing is the bones names, like "Back Toe L.", they should be something like this: "Back_Toe.L" notice the ".L" this is useful later when you have to mirror animations.
I hope I didn't make a mistake, good luck finishing the project!
Attachments
Eagle_armature_fix.zip
(115.89 KiB) Downloaded 13 times

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

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

by Gundul » Post

Termos wrote:
Gundul wrote:Thanks, that worked. Now it is running on Zombietest.
That's unexpected ;), I hope you enabled timeout at least, so they don't stay forever.
timeout is also a good idea. I set static_save to false, so when a mapblock is unloaded they will vanish.
My servers: Jungle, Lilly in the valley, ZombieTest

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

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

by Termos » Post

Melkor wrote:Well, is done!
This one I could reposition. How do you do that there are no keyframes just that neat diamond chart?
Image
What I had to do:
rotate it 180 around Z so it's facing the right way (for b3d plugin anyway)
translate down so visual center of mass is around 0,0,0
rotate around X so the body is parallel to Y
reduce texture lightness a lot.
Attachments
eggle.gif
(337.3 KiB) Not downloaded yet

User avatar
Melkor
Member
Posts: 358
Joined: Sat Sep 24, 2011 01:03
Location: Underground

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

by Melkor » Post

Termos wrote:This one I could reposition. How do you do that there are no keyframes just that neat diamond chart?
I'm glad that it worked!
If is about the animation please ask to Extex, i didn't touch anything of that

User avatar
ElCeejo
Member
Posts: 68
Joined: Thu Feb 28, 2019 23:29
In-game: ElCeejo
Location: The darkest corner in your house

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

by ElCeejo » Post

A fluidly flying mob? It's about time. Great work once again Termos! Even if it is in an early stage, it looks very impressive and I can't wait to use it in my own mods.

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

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

by Termos » Post

Gundul wrote:I set static_save to false, so when a mapblock is unloaded they will vanish.
Still they seem to be staying forever on ZT.
The demo wasn't intended to run on servers as is, I hope Extex doesn't mind if I package his model into another more server friendly demo.
ElCeejo wrote:A fluidly flying mob? It's about time. Great work once again Termos! Even if it is in an early stage, it looks very impressive and I can't wait to use it in my own mods.
Yeah, behaviors included in the demo can be used already, might be about time to start getting that pterodactyl model ready.

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

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

by Gundul » Post

Termos wrote:
Gundul wrote:I set static_save to false, so when a mapblock is unloaded they will vanish.
Still they seem to be staying forever on ZT.
The demo wasn't intended to run on servers as is, I hope Extex doesn't mind if I package his model into another more server friendly demo.
They vanish. I am doing the same with sharks and whales of water_life
My servers: Jungle, Lilly in the valley, ZombieTest

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

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

by Extex » Post

Termos wrote:I hope Extex doesn't mind if I package his model into another more server friendly demo.
Yeah I'd like to finish animating it after Melkor fixed it
Termos wrote: Image
Yeah XD that's the take off animation

Notice the head glitching up

I'm going to have a gliding animation, a flap after gliding animation, a seamless flapping animation, and a landing animation
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Imk
Member
Posts: 363
Joined: Mon Nov 05, 2018 19:15
In-game: Imk
Location: Crimea, Russia
Contact:

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

by Imk » Post

again

Code: Select all

2019-11-16 14:18:01: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): /home/imk/minetest/bin/../mods/mobkit/init.lua:120: Invalid float vector dimension range 'y' (expected -2.14748e+06 < y < 2.14748e+06 got nan).
2019-11-16 14:18:01: ERROR[Main]: stack traceback:
2019-11-16 14:18:01: ERROR[Main]:       [C]: in function 'set_acceleration'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:120: in function 'set_acceleration'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:828: in function 'physics'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:936: in function 'stepfunc'
2019-11-16 14:18:01: ERROR[Main]:       ...inetest/bin/../mods/petz/petz/petz/pigeon_mobkit.lua:82: in function <...inetest/bin/../mods/petz/petz/petz/pigeon_mobkit.lua:81>
it's been a long time since

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

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

by runs » Post

Imk wrote:again

Code: Select all

2019-11-16 14:18:01: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): /home/imk/minetest/bin/../mods/mobkit/init.lua:120: Invalid float vector dimension range 'y' (expected -2.14748e+06 < y < 2.14748e+06 got nan).
2019-11-16 14:18:01: ERROR[Main]: stack traceback:
2019-11-16 14:18:01: ERROR[Main]:       [C]: in function 'set_acceleration'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:120: in function 'set_acceleration'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:828: in function 'physics'
2019-11-16 14:18:01: ERROR[Main]:       /home/imk/minetest/bin/../mods/mobkit/init.lua:936: in function 'stepfunc'
2019-11-16 14:18:01: ERROR[Main]:       ...inetest/bin/../mods/petz/petz/petz/pigeon_mobkit.lua:82: in function <...inetest/bin/../mods/petz/petz/petz/pigeon_mobkit.lua:81>
it's been a long time since
A mobkit error, but can be caused by a follow or run away behaviour in flying mobs. I put on them the default terrestial behaviours but never worked well. I've checked that in some rare but possible circunstances they can fly with no top limit.

I've removed those bad implementations. Check the last version 5.10.
Day 42 of the quarantine

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

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

by Termos » Post

runs wrote: A mobkit error, but can be caused by a follow or run away behaviour in flying mobs.
The only way this could happen is if a collisionbox had height of zero. I bet that's unintended, if this is the case please make sure your mobs collsionbox y is nonzero.

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

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

by runs » Post

Termos wrote:
runs wrote: A mobkit error, but can be caused by a follow or run away behaviour in flying mobs.
The only way this could happen is if a collisionbox had height of zero. I bet that's unintended, if this is the case please make sure your mobs collsionbox y is nonzero.
Collissionbox is OK.
Day 42 of the quarantine

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

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

by Termos » Post

runs wrote:Collissionbox is OK.
Initial value might look allright, but mobkit is definitely receiving a zero height box, that's the only way division by zero can occur.
The colbox could be modified later on, also minetest set_properties() isn't bug free.

Anyway, dimension of 0 makes no sense as far as physics goes, so I put in a safety measure.

Update 191117

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

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

by runs » Post

Termos wrote:
runs wrote:Collissionbox is OK.
Initial value might look allright, but mobkit is definitely receiving a zero height box, that's the only way division by zero can occur.
The colbox could be modified later on, also minetest set_properties() isn't bug free.

Anyway, dimension of 0 makes no sense as far as physics goes, so I put in a safety measure.

Update 191117
I will check. Thanks.
Day 42 of the quarantine

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

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

by runs » Post

The code below is when a mob dies. The collisionbox is changed. I do not what it does, it was a suggestion from you.

Code: Select all

    local props = self.object:get_properties()
    props.collisionbox[2] = props.collisionbox[1]
    self.object:set_properties({collisionbox=props.collisionbox}) 
Day 42 of the quarantine

Post Reply

Who is online

Users browsing this forum: Google [Bot], Jan, Mineminer and 5 guests