Mobkit - Entity API [mobkit][alpha]

User avatar
Lone_Wolf
Member
Posts: 2428
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » Post

Could also wait until 5.4 releases to drop support
My ContentDB -|- Working on Voxel Knights -|- Minetest Forums Dark Theme!! (You need it)

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

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

by Gundul » Post

Termos wrote:
Sun Nov 22, 2020 17:57
I see.
Well, maybe I'm going to query minetest.features and try to support 5.2 for a little bit longer if it turns out to be not too much of a PITA.
Then it'll be up to the mods to decide if they want to make use of collision info or not.
No support, just having a branch on github or a release in ContentDB to download if you accidentally deleted your outdated mobkit :)
My servers: Jungle, Lilly in the valley click for my mods

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

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

by Gundul » Post

runs wrote:
Sun Nov 22, 2020 18:30
The pausible solution, gundul, is if it's an old server, which can't be updated, then continue with the frozen 5.2 mobkit,
That is what I meant. Me, and maybe others too, might need a source to download an outdated mobkit for minetest < 5.3. That is all. No support needed.
My servers: Jungle, Lilly in the valley click for my mods

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

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

by runs » Post

Gundul wrote:
Mon Nov 23, 2020 17:49
runs wrote:
Sun Nov 22, 2020 18:30
The pausible solution, gundul, is if it's an old server, which can't be updated, then continue with the frozen 5.2 mobkit,
That is what I meant. Me, and maybe others too, might need a source to download an outdated mobkit for minetest < 5.3. That is all. No support needed.
Not necessarily outdated. The core is already stable and functional. Even the new version would be more instable, cos new features/improvements.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by runs » Post

Thermos, the new minetest.get_objects_in_area function was merged for 5.4.

I think that this would be an improvement for the mobkit's "sensors" function (self.nearby_objects). For terrestrial mobs would be more suitable a rectangle area than a sphere = less nodes to check (?) and more relevant ones (not much higher nodes to check). Maybe self.view_range (now only a horizontal range) in conjunction with self.jump_height too to flatten the rectangle.

Image

For aerial ones not, I guess. And either not suitable for aerial-terrestrial predator-preys.

Best Regards.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by Termos » Post

runs wrote:
Tue Dec 29, 2020 22:30
minetest.get_objects_in_area function was merged for 5.4.
Actually, at first I assumed get_objects_inside_radius() worked that way, wouldn't expect anybody to go the trouble of making it a proper spherical radius.

Yes, I'll probably make use of it some time after 5.4 is out and widely adopted.

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

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

by Termos » Post

Update 210105

mobkit
  • moved all example behaviors to a separate file example_behaviors.lua so it's clear what is part of the core library and what's not.
  • added the file behaviors2override.lua. It's basicly a copy of example_behaviors.lua with the prefix 'mobkit' replaced with the string '[yournamespace]' where needed, so to start using modified example behaviors just copy all the contents to your mod/game and replace all occurences of '[yournamespace]' to your namespace of choice.
  • mobkit.get_spawn_pos_abr() - fixed the bug when spawns happened more often than intended on very laggy servers with dtime comparable to a second.
  • added mobkit.get_box_intersect_cols()
    returns all {x=,z=} columns that a box intersects with.
  • added mobkit.get_box_displace_cols()
    returns all {x=,z=} columns that a box would enter if it moved by a specified vector
    this is the basis for large box movement support (whales, dinos etc.). I'm going to elaborate here later.
  • [experimental] added mobkit integrity control
    gets a checksum of mobkit global table contents and issues an error if modified by another mod.
    This uses undocumented features of minetest.serialize so we'll see how it goes
  • mobkit now makes use of collision info, it should also be available from inside logic and behaviors via 'colinfo' variable (MT 5.3.0 and later)
  • various fixes and possibly new bugs. This one might be a bit rushed but I'm not sure when I'll get some time to work on this again
MT 5.0 - 5.2 compatibility should still be preserved.

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

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

by runs » Post

Thanks.

I get "mobkit namespace inconsistent", I mean even with mobkit alone (no more mobkit related stuff). I've checked it putting mobkit in the "devtest game" and the same problem.

Do calculate the hash with the "devtest" game.

On the other hand, I've fixed my Petz mod cos it was some namespace functions taken.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by Termos » Post

Yeah I might have to remove that one. minetest.serialize adds some machine specific bits and I might not have been able to remove all of them.
Maybe the output is also os specific, are you using linux?

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

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

by runs » Post

Termos wrote:
Wed Jan 06, 2021 09:28
Yeah I might have to remove that one. minetest.serialize adds some machine specific bits and I might not have been able to remove all of them.
Maybe the output is also os specific, are you using linux?
Yes, Linux. In my system, with "devtest" and only mobkit, crc is "3e94b7e61cec2ed13b96be0425c24b8e4697e654"
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by runs » Post

Other thing, in 5.4-dev, a warning:

2021-01-06 12:14:16: WARNING[Server]: Call to deprecated function 'get_player_velocity', please use 'get_velocity' at /opt/minetest/bin/../games/juanchi/mods/mobkit/init.lua:233

https://github.com/minetest/minetest/pull/10173
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by Termos » Post

Runs can you please output something like minetest.serialize(mobkit.turn2yaw) and post me the result string?
I dont have access to a linux machine at the moment

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

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

by runs » Post

If I do "minetest.log(minetest.serialize(mobkit.turn2yaw))", it gives me an error on the screen: "<Invalid UTF-8 STRING>"


The result is:

Code: Select all

2021-01-06 19:41:40: [Server]: return loadstring("\27LJ\2\0008@/opt/minetest/bin/../games/juanchi/mods/mobkit/init.luaµ\3\0\3\
\3\4\3A|\2\17\14\0\1\0X\3\1€)\1\0\0\14\0\2\0X\3\1€)\2\6\0009\3\0\0\18\4\3\0009\3\1\3B\3\2\2-\4\0\0 \3\4\3-\4\0\0 \4\4\1-\5\0\0\24\5\0\5$\1\5\4-\4\1\0009\5\2\0\"\5\2\5-\6\2\0!\7\3\1B\6\2\2-\7\0\0\24\7\0\7$\6\7\6B\4\3\2-\5\2\0!\6\3\1B\5\2\2-\6\0\0\1\6\5\0X\5\2€)\5ÿÿX\6\1€)\5\1\0\1\3\1\0X\6\3€\24\6\1\5\12\5\6\0X\7\1€\24\5\2\5\"\6\5\4 \6\6\3-\7\0\0\24\7\0\7$\6\7\0069\7\0\0\18\8\7\0009\7\3\7-\9\0\0!\9\9\6B\7\3\1\5\6\1\0X\7\5€+\7\2\0-\8\0\0!\8\8\6J\7\3\0X\7\4€+\7\1\0-\8\0\0!\8\8\6J\7\3\0K\0\1\0\1À\7À\0À\12set_yaw\
dtime\12get_yaw\11object\4\2þÿÿÿ\31\1\1\1\2\2\2\3\3\3\3\4\4\5\5\5\5\5\7\7\7\7\7\7\7\7\7\7\9\9\9\9\9\9\9\9\9\
\
\
\
\
\
\12\12\12\12\12\13\13\13\13\13\13\15\15\15\15\15\15\15\16\16\16\16\17pi\0min\0abs\0self\0\0Btyaw\0\0Brate\0\0Byaw\0\0117step\0\17&dir\0\9\29nyaw\0\11\18\0\0")
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

User avatar
Lone_Wolf
Member
Posts: 2428
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » Post

runs wrote:
Wed Jan 06, 2021 18:45
If I do "minetest.log(minetest.serialize(mobkit.turn2yaw))", it gives me an error on the screen: "<Invalid UTF-8 STRING>"


The result is:

Code: Select all

2021-01-06 19:41:40: [Server]: return loadstring("\27LJ\2\0008@/opt/minetest/bin/../games/juanchi/mods/mobkit/init.luaµ\3\0\3\
\3\4\3A|\2\17\14\0\1\0X\3\1€)\1\0\0\14\0\2\0X\3\1€)\2\6\0009\3\0\0\18\4\3\0009\3\1\3B\3\2\2-\4\0\0 \3\4\3-\4\0\0 \4\4\1-\5\0\0\24\5\0\5$\1\5\4-\4\1\0009\5\2\0\"\5\2\5-\6\2\0!\7\3\1B\6\2\2-\7\0\0\24\7\0\7$\6\7\6B\4\3\2-\5\2\0!\6\3\1B\5\2\2-\6\0\0\1\6\5\0X\5\2€)\5ÿÿX\6\1€)\5\1\0\1\3\1\0X\6\3€\24\6\1\5\12\5\6\0X\7\1€\24\5\2\5\"\6\5\4 \6\6\3-\7\0\0\24\7\0\7$\6\7\0069\7\0\0\18\8\7\0009\7\3\7-\9\0\0!\9\9\6B\7\3\1\5\6\1\0X\7\5€+\7\2\0-\8\0\0!\8\8\6J\7\3\0X\7\4€+\7\1\0-\8\0\0!\8\8\6J\7\3\0K\0\1\0\1À\7À\0À\12set_yaw\
dtime\12get_yaw\11object\4\2þÿÿÿ\31\1\1\1\2\2\2\3\3\3\3\4\4\5\5\5\5\5\7\7\7\7\7\7\7\7\7\7\9\9\9\9\9\9\9\9\9\
\
\
\
\
\
\12\12\12\12\12\13\13\13\13\13\13\15\15\15\15\15\15\15\16\16\16\16\17pi\0min\0abs\0self\0\0Btyaw\0\0Brate\0\0Byaw\0\0117step\0\17&dir\0\9\29nyaw\0\11\18\0\0")
minetest.serialize() is for tables, and will probably break like that given any other input. Try dump()
My ContentDB -|- Working on Voxel Knights -|- Minetest Forums Dark Theme!! (You need it)

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

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

by runs » Post

Lone_Wolf wrote:
Thu Jan 07, 2021 05:15
runs wrote:
Wed Jan 06, 2021 18:45
If I do "minetest.log(minetest.serialize(mobkit.turn2yaw))", it gives me an error on the screen: "<Invalid UTF-8 STRING>"


The result is:

Code: Select all

2021-01-06 19:41:40: [Server]: return loadstring("\27LJ\2\0008@/opt/minetest/bin/../games/juanchi/mods/mobkit/init.luaµ\3\0\3\
\3\4\3A|\2\17\14\0\1\0X\3\1€)\1\0\0\14\0\2\0X\3\1€)\2\6\0009\3\0\0\18\4\3\0009\3\1\3B\3\2\2-\4\0\0 \3\4\3-\4\0\0 \4\4\1-\5\0\0\24\5\0\5$\1\5\4-\4\1\0009\5\2\0\"\5\2\5-\6\2\0!\7\3\1B\6\2\2-\7\0\0\24\7\0\7$\6\7\6B\4\3\2-\5\2\0!\6\3\1B\5\2\2-\6\0\0\1\6\5\0X\5\2€)\5ÿÿX\6\1€)\5\1\0\1\3\1\0X\6\3€\24\6\1\5\12\5\6\0X\7\1€\24\5\2\5\"\6\5\4 \6\6\3-\7\0\0\24\7\0\7$\6\7\0069\7\0\0\18\8\7\0009\7\3\7-\9\0\0!\9\9\6B\7\3\1\5\6\1\0X\7\5€+\7\2\0-\8\0\0!\8\8\6J\7\3\0X\7\4€+\7\1\0-\8\0\0!\8\8\6J\7\3\0K\0\1\0\1À\7À\0À\12set_yaw\
dtime\12get_yaw\11object\4\2þÿÿÿ\31\1\1\1\2\2\2\3\3\3\3\4\4\5\5\5\5\5\7\7\7\7\7\7\7\7\7\7\9\9\9\9\9\9\9\9\9\
\
\
\
\
\
\12\12\12\12\12\13\13\13\13\13\13\15\15\15\15\15\15\15\16\16\16\16\17pi\0min\0abs\0self\0\0Btyaw\0\0Brate\0\0Byaw\0\0117step\0\17&dir\0\9\29nyaw\0\11\18\0\0")
minetest.serialize() is for tables, and will probably break like that given any other input. Try dump()
Dump does not work, the result is: '<function>"
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

User avatar
LRV
Helper
Posts: 271
Joined: Mon Dec 19, 2016 17:29
GitHub: Mooncarguy
In-game: Mooncarman Moonvehicleman LunarRovingVehicle LRV Mooncarguy

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

by LRV » Post

Is there/will there be the ability to set movement and viewing direction independantly from each other?
LRV wrote:
LRV wrote:I got another food mod xtraarmor, of course a customleather item needs to be added, but the chainmaila nd leather armor would be pretty fitting.
Why is there food in my sentence? XD
Why didn't my siganture show up completly til' I did that?

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

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

by Termos » Post

Thanks runs.

dump() is a minetest utility, i guess LW meant string.dump()
Looks like in case of functions minetest.serialize() returns same thing as dump except nondisplayable characters are converted to displayable representation.

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

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

by Termos » Post

LRV wrote:
Thu Jan 07, 2021 13:20
Is there/will there be the ability to set movement and viewing direction independantly from each other?
Mobkit doesn't enforce the concept of viewing direction. Entities have access to all objects in range and it's up to the modder to decide which of them they can notice.

zombiestrd for example. Zombies can see in the front arc only, but they can 'hear' sounds coming from all directions.

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

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

by Termos » Post

runs wrote:
Wed Jan 06, 2021 18:45
The result is:
Hmm, the string is identical on my end, except the header containing the path which is being stripped so it doesn't matter.
I've got two ideas: sort order and line breaks.
I'd like to make it work, some means of control of libraries integrity could bring some order to this mess.

Can anyone else confirm they get the red error message despite mobkit being the only mod enabled?

ps. runs could you try the dev version here https://github.com/TheTermos/mobkit/archive/dev.zip ?
It works on a sorted array and line breaks are stripped from the strings.

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

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

by runs » Post

Termos wrote:
Thu Jan 07, 2021 19:59
runs wrote:
Wed Jan 06, 2021 18:45
The result is:
Hmm, the string is identical on my end, except the header containing the path which is being stripped so it doesn't matter.
I've got two ideas: sort order and line breaks.
I'd like to make it work, some means of control of libraries integrity could bring some order to this mess.

Can anyone else confirm they get the red error message despite mobkit being the only mod enabled?

ps. runs could you try the dev version here https://github.com/TheTermos/mobkit/archive/dev.zip ?
It works on a sorted array and line breaks are stripped from the strings.
I got the same error:

Image
Attachments
error.png
(49.6 KiB) Not downloaded yet
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

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

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

by Gundul » Post

I get the same message in a freshly generated world with only mobkit, water_life and unified_inventory as mods.
Minetest5.3.0 stable on arch linux
My servers: Jungle, Lilly in the valley click for my mods

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

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

by Termos » Post

Thanks guys.

I've updated the dev branch with the atomic option.
If you'd be so kind to help me out more, please run it and PM me the part of the log starting with "WARNING[Main]: namespace dump:" and the following warnings as a file.

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

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

by Termos » Post

Update 210109

mobkit
  • removed the integrity check error message
Found a way to test it and were able to reverse engineer the output of string.dump() to a degree, so it'll probably return later.

User avatar
Lone_Wolf
Member
Posts: 2428
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

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

by Lone_Wolf » Post

Termos wrote:
Thu Jan 07, 2021 17:05
Thanks runs.

dump() is a minetest utility, i guess LW meant string.dump()
Looks like in case of functions minetest.serialize() returns same thing as dump except nondisplayable characters are converted to displayable representation.
No I meant for him to use dump(). It shows that mobkit.turn2yaw is a function. Which I guess makes sense now that I look at it again. There is no () at the end turning it into a function call instead of a 'function pointer'
My ContentDB -|- Working on Voxel Knights -|- Minetest Forums Dark Theme!! (You need it)

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

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

by Termos » Post

Lone_Wolf wrote:
Sat Jan 09, 2021 16:22
No I meant for him to use dump(). It shows that mobkit.turn2yaw is a function. Which I guess makes sense now that I look at it again. There is no () at the end turning it into a function call instead of a 'function pointer'
what dump() seems to do to functions is return the string "<function>" so all functions look identical to it.
minetest.serialize() does serialize functions, just the specifics of that process aren't documented.

Post Reply

Who is online

Users browsing this forum: Google [Bot], MisterE and 3 guests