Mobkit - Entity API [mobkit][alpha]

Termos
Member
Posts: 417
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 60 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
aerotest.gif (142.54 KiB) Viewed 420 times

u18398

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

by u18398 » 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.

Termos
Member
Posts: 417
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

u18398

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

by u18398 » 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

User avatar
Extex
Member
Posts: 245
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 48 times
Last edited by Extex on Thu Nov 14, 2019 18:59, edited 1 time in total.
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

u18398

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

by u18398 » 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.

User avatar
Melkor
Member
Posts: 373
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: 245
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
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][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: 245
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)
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Melkor
Member
Posts: 373
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 43 times

u18398

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

by u18398 » 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.

Termos
Member
Posts: 417
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
eggle.gif (337.3 KiB) Viewed 420 times

User avatar
Melkor
Member
Posts: 373
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: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's 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: 417
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.

u18398

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

by u18398 » 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

User avatar
Extex
Member
Posts: 245
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
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Imk
Member
Posts: 490
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: 3225
Joined: Sat Oct 27, 2018 08:32

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.

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

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.

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

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.

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

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}) 

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests