Mobkit - Entity API [mobkit][alpha]

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

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

by Gundul » Sat Oct 05, 2019 17:08

Termos wrote:Quick update 191005



I get crashes now:

Code: Select all
2019-10-05 19:04:28: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'sharks' in callback luaentity_Step(): /home/.minetest/mods/mobkit/init.lua:180: attempt to index field 'node_box' (a nil value)
2019-10-05 19:04:28: ERROR[Main]: stack traceback:
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:180: in function 'get_node_height'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:211: in function </home/.minetest/mods/mobkit/init.lua:207>
2019-10-05 19:04:28: ERROR[Main]:       (tail call): ?
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1387: in function 'okpos'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1401: in function 'aqua_radar_dumb'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:1451: in function 'func'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:682: in function 'execute_queues'
2019-10-05 19:04:28: ERROR[Main]:       /home/.minetest/mods/mobkit/init.lua:901: in function </home/mars/.minetest/mods/mobkit/init.lua:790>

Last edited by Gundul on Sun Oct 06, 2019 12:16, edited 1 time in total.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

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

by Gundul » Sun Oct 06, 2019 09:31



again ? I thought that was fixed already.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Sun Oct 06, 2019 11:49

No, sorry, not yet, runs' modification is a workaround, while get_node_height needs a rework to be more 5.0 compatible.

By the way, do you guys know which mod registers that nodeboxless nodebox, what name it is, maybe why it's done that way?
 

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

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

by Gundul » Sun Oct 06, 2019 12:14

Termos wrote:No, sorry, not yet, runs' modification is a workaround, while get_node_height needs a rework to be more 5.0 compatible.

By the way, do you guys know which mod registers that nodeboxless nodebox, what name it is, maybe why it's done that way?

Not yet, but I had the same issue on Zombietest, after last mobkit update. There aren't too many mods on it.
Nevertheless I think checking for nil is not wrong, you never know what someone runs on his server :D
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Gundul » Sun Oct 06, 2019 12:22

---
deleted
---

sry wrong info
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Gundul » Tue Oct 08, 2019 04:43

I found it. It is the melon from farming_redo:

2019-10-07 22:39:00: ACTION[Server]: [mobkit] farming:melon_8 uses nodebox without node_box defined
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Tue Oct 08, 2019 17:54

Another quick fix then: mobkit version 191008

Gundul wrote:I found it. It is the melon from farming_redo:
2019-10-07 22:39:00: ACTION[Server]: [mobkit] farming:melon_8 uses nodebox without node_box defined

Thanks a ton!
The Melon of Doom shouldn't cause any problems anymore.

I looked at their code, there doesn't seem to be any purpose to that drawtype choice, probably just slipped through because the engine doesn't enforce the node_box field.
Boxless nodebox seems to be interpreted as a full node by the engine.
 

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

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

by Gundul » Wed Oct 09, 2019 16:43

I was wondering if it is better to define only one spawnstep function for all animals in my mod or if it would be better
to have a spawnstep for each animal separated ? Or doesn't it matter at all ?
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Wed Oct 09, 2019 17:59

Definitely just one for all.

get_spawn_pos_abr retuns just a position, then your function could determine what's there (nodes, biomes etc), then iterate over minerest.registered_entities and put eligible names in another table, then pick one randomly and spawn it.
 

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

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

by Termos » Sun Oct 13, 2019 16:26

.
Weeee!

Image
Attachments
weeee2.gif
(810.08 KiB) Not downloaded yet
 

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

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

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

by Gundul » Sun Oct 13, 2019 17:17

I get seasick X)

at least no sharks around, when I sink :)
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Tue Oct 15, 2019 10:22

Quick update 191015

changes:
    * breaking: mobkit.go_forward_horizontal(self,speed) - removed redundant yaw parameter

    * mobkit.turn2yaw() now returns resulting yaw in addition to boolean

    * added mobkit.drive_to_pos(self,tpos,speed,turn_rate,dist)
    moves in yaw direction while gradually turning towards tpos, returns true in dist distance from tpos. Preserves y velocity.

    * added mobkit.dot(v1,v2) - returns dot product of two 3d vectors (should be in vector btw)
 

User avatar
ElCeejo
Member
 
Posts: 45
Joined: Thu Feb 28, 2019 23:29
In-game: ElCeejo

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

by ElCeejo » Wed Oct 16, 2019 08:23

I'm inclined to believe this has to do with the lack of support for large collision boxes, but I'm asking anyway. I'm working on some rather large mobs with boxes set to the max you recommended (-1, -1, -1, 1, 1, 1). The problem is; when said large mob attacks another large mob with the same size box, it can't land a hit at all, but it can hit other, smaller mobs.
 

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

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

by Termos » Wed Oct 16, 2019 10:52

ElCeejo wrote:I'm inclined to believe this has to do with the lack of support for large collision boxes

Just a bit of clarification, mobkit does support large collision boxes, see what Gundul done with whales.
It's some builtin behaviors which assume horizontal box dimensions are < 1, but large boxes are entirely possible using custom behaviors.

Also the restriction only applies to horizontal dimensions, you should be able to use 2 node high boxes no problem.

ElCeejo wrote:The problem is; when said large mob attacks another large mob with the same size box, it can't land a hit at all, but it can hit other, smaller mobs.

What's their attack range? make sure it's greater than collisionbox[1]*1.42, otherwise they won't be able to hit diagonally.

If it still fails, as a temp solution try copying the following into your mod, it will override api version:
Code: Select all
function mobkit.lq_jumpattack(self,height,target)
   local phase=1      
   local tgtbox = target:get_properties().collisionbox
   local func=function(self)
      if not mobkit.is_alive(target) then return true end
      if self.isonground then
         if phase==1 then   -- collision bug workaround
            local vel = self.object:get_velocity()
            vel.y = -mobkit.gravity*sqrt(height*2/-mobkit.gravity)
            self.object:set_velocity(vel)
            mobkit.make_sound(self,'charge')
            phase=2
         else
            return true
         end
      elseif phase==2 then
         local dir = minetest.yaw_to_dir(self.object:get_yaw())
         local vy = self.object:get_velocity().y
         dir=vector.multiply(dir,6)
         dir.y=vy
         self.object:set_velocity(dir)
         phase=3
      elseif phase==3 then   -- in air
         local tgtpos = target:get_pos()
         local pos = self.object:get_pos()
         -- calculate attack spot
         local yaw = self.object:get_yaw()
         local dir = minetest.yaw_to_dir(yaw)
         local apos = mobkit.pos_translate2d(pos,yaw,self.attack.range)

         if mobkit.is_pos_in_box(apos,tgtpos,tgtbox) then   --bite
            target:punch(self.object,1,self.attack)
               -- bounce off
            local vy = self.object:get_velocity().y
            self.object:set_velocity({x=dir.x*-3,y=vy,z=dir.z*-3})   
               -- play attack sound if defined
            mobkit.make_sound(self,'attack')
            phase=4
         end
      end
   end
   mobkit.queue_low(self,func)
end
 

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

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

by Termos » Thu Oct 17, 2019 11:54

Update 191017

changes:
    * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior
 

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

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

by Termos » Fri Oct 18, 2019 13:02

Updated zombiestrd

Funny thing, looks like objects that players are attached to become players themselves, so sharks would try to attack boat hulls for example, quite hillarious.
Sharks now ignore players having parents, so to speak.

This update is only essential if using sharks along with boats or other aquatic objects that players can attach to.
 

User avatar
ElCeejo
Member
 
Posts: 45
Joined: Thu Feb 28, 2019 23:29
In-game: ElCeejo

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

by ElCeejo » Thu Oct 24, 2019 09:22

So pretty much, mob sees the thing it wants to attack, it begins chasing the thing it wants to attack, in the process of chasing the thing it wants to attack it falls in water, and the game crashes, giving me this error.

Code: Select all
2019-10-24 02:19:15: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'paleotest' in callback luaentity_Step(): Invalid float vector dimension range 'y' (expected -2.14748e+006 < y < 2.14748e+006 got -inf).
2019-10-24 02:19:15: ERROR[Main]: stack traceback:
2019-10-24 02:19:15: ERROR[Main]:    [C]: in function 'set_acceleration'
2019-10-24 02:19:15: ERROR[Main]:    ...s\cjcur\Saved Games\Minetest\bin\..\mods\mobkit\init.lua:890: in function 'stepfunc'
2019-10-24 02:19:15: ERROR[Main]:    ...mes\Minetest\bin\..\mods\paleotest/mobs/velociraptor.lua:252: in function <...mes\Minetest\bin\..\mods\paleotest/mobs/velociraptor.lua:251>
 

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

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

by Termos » Thu Oct 24, 2019 12:13

ElCeejo wrote:in the process of chasing the thing it wants to attack it falls in water, and the game crashes, giving me this error.

That must have been a hell of a fall!

Looks like there's some sort of a limit in place, update is on the way.
 

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

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

by Gundul » Thu Oct 24, 2019 16:44

Termos wrote:Update 191017

changes:
    * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior


Whales behaving strange now. Did you change something with negative speed ?
I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.
My servers: Jungle, Lilly in the valley, ZombieTest
 

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

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

by Termos » Thu Oct 24, 2019 17:34

Gundul wrote:Did you change something with negative speed ?

Nope, technically speaking there's no much of a difference between positive and negative speed, maybe check your yaw calculations, when moving backwards the real yaw is really yaw-pi.

Gundul wrote:I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.

If using Blender and b3d plugin, try rotating it around the z axis so it's looking towards positive y (the green one).
 

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

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

by Gundul » Thu Oct 24, 2019 19:19

Termos wrote:
Gundul wrote:Did you change something with negative speed ?

Nope, technically speaking there's no much of a difference between positive and negative speed, maybe check your yaw calculations, when moving backwards the real yaw is really yaw-pi.

Gundul wrote:I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.

If using Blender and b3d plugin, try rotating it around the z axis so it's looking towards positive y (the green one).

thanks, I will need to read your commits, what actually really changed. On Lilly all works fine, but on Zombies after the update whales suddenly move backwards or do not know anymore to avoid obstacles.

I tried Blender but the gui is so overloaded I do net even know where to click X)
My servers: Jungle, Lilly in the valley, ZombieTest
 

Eran
Member
 
Posts: 86
Joined: Fri May 03, 2019 16:46

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

by Eran » Thu Oct 24, 2019 19:34

Gundul wrote:I tried Blender but the gui is so overloaded I do net even know where to click X)


To use blender you have to know the keyboard shortcuts, if you want to learn I recommend youtube tutorials.

Select the whale by left or right clicking depending on your settings and blender version
then 'R' to rotate
press 'Z' to only rotate on the z axis
type '180' or however many degrees you want it to rotate
press enter to actually rotate

Then you can export it as b3d.
 

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

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

by runs » Thu Oct 24, 2019 20:35

Gundul wrote:
Termos wrote:Update 191017

changes:
    * mostly under the hood stuff, shouldn't affect existing mods, but the new example requires latest version.
    * ensured MT 5.1 compatibility
    * improved lq_jumpattack behavior


Whales behaving strange now. Did you change something with negative speed ?
I was using negative speed because the model is upside down and I did not
know how to turn it around, So using negative speed was easy solution.


Use "rotate" in minetest.register_entity.
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 3 guests