[mod] Mob Core [alpha] [mob_core]

Post Reply
User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

[mod] Mob Core [alpha] [mob_core]

by ElCeejo » Post

This mod is meant as an expansion of mobkit with new hq/lq functions and other functions similar to those used in mobs_redo that should allow for more consisent behaviors but won't force the user into using them.

Some things to note:
- This mod is in alpha, expect issues
- Because my coding skills improved a lot throughout development, a lot of the code is inconsistent
- A few things were taken from mobs_redo, so big thanks to that mod and it's contributors

To-do:
- Document HQ/LQ functions
- Re-code older function
- Optimize laggy functions
- Create a wider range of aquatic and aerial roam functions

License: GPL 3.0
Depends: mobkit
Optional Depends: default (for the mount system)
Download
Last edited by ElCeejo on Wed Jan 13, 2021 01:30, edited 1 time in total.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Mob Core [alpha] [mob_core]

by MisterE » Post

I hope this works out. Will we be able to easily port redo mobs to this?

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Re: [mod] Mob Core [alpha] [mob_core]

by ElCeejo » Post

The original goal for this mod was to be able to easily convert mobs redo mobs to mobkit but the goal changed when I realized that it was kinda redundant. Although, in it's current form simple mobs like the cow can be very quickly converted. I was able to convert the cow and chicken in under 5 minutes each.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Update 0.0.2

by ElCeejo » Post

Small update for Aquatic and Aerial mobs:

- Improved obstacle avoidance
- Reduced lag

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Mob Core [alpha] [mob_core]

by MisterE » Post

so does it improve the mob to convert it? If I understand correctly, mobkit has superior mob control functions. Is it worth it to convert? Or, is the purpose of this mod to make it easier for those coming from mobs_redo to start using mobkit?

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Re: [mod] Mob Core [alpha] [mob_core]

by ElCeejo » Post

so does it improve the mob to convert it?
Definitely. If it's converted correctly then you would see a lot less lag and much better behavior. Mobs_redo is good for very basic mobs but things fall apart when you try to implement your own movement behaviors or pathfinding. Mobkit can be used for basic mobs or advanced mobs, you just have to know what you're doing to use it.
is the purpose of this mod to make it easier for those coming from mobs_redo to start using mobkit?
I'd say that making it easier to go from mobs_redo to mobkit is one the goals, but not the central one. There functions that are more or less duplicates of mobs_redo functions such as feed_tame() and protect() that could be used to convert mobs_redo mobs. But the main goal is to have functions that can be used by many different mobkit mobs without having to repeat code, so if someone needed to have a mobs_redo-like feed/tame function for their mobkit mob they could use this mods instead of making their own and wasting space in their mod.

Adnunano
Member
Posts: 43
Joined: Thu Feb 13, 2020 09:28

Re: [mod] Mob Core [alpha] [mob_core]

by Adnunano » Post

ElCeejo wrote:
Thu Oct 29, 2020 18:30
I was able to convert the cow and chicken in under 5 minutes each.
Can you share it to us please?I want a better functioning cow and chicken.
NfAPhpmGaVphBjK8NIr9Mit5xNW2emD2

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Re: [mod] Mob Core [alpha] [mob_core]

by ElCeejo » Post

I will share it somewhat soon.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Mob Core [alpha] [mob_core]

by MisterE » Post

Please give some examples of this mod being used, so I can copy to other mobs
Edit: I found this: https://content.minetest.net/packages/E ... ter_fauna/

Thanks!

However, We still need better docs:

mob_core.register_spawn()
mob_core.growth()
mob_core.vitals()

And others. What do they do, how/when should they be used?

I got the above from the pig in better_fauna

I would really appreciate a simple example mob that has notes of what can go where to have different behaviors.

E.G.

What do I do to get the mob to be captured
what do I do to tame the mob
what mob properties are *required* and what others are not required, but useful
how to make baby animals
how to make an animal brain, a predator brain, how to replace nodes (eating), how to make a monster
how to call various sounds at proper times, etc...

basically, An api description like that in api.txt of mobs_redo. It doesn't cover everything, but definitely enough to get basic behaviors and no bugs in the 1st or 2nd try.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Re: [mod] Mob Core [alpha] [mob_core]

by ElCeejo » Post

Documentation is in the works. There's a lot of stuff that may be left out when I update it (hopefully soon) but there'll be more than what's there now.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Mob Core [alpha] [mob_core]

by MisterE » Post

BTW, I got this error:

2021-01-09 12:57:32: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback luaentity_Step(): ...netest/games/mesecraft/mods/mobkit/example_behaviors.lua:379: attempt to index local 'rot' (a nil value)
2021-01-09 12:57:32: ERROR[Main]: stack traceback:
2021-01-09 12:57:32: ERROR[Main]: ...netest/games/mesecraft/mods/mobkit/example_behaviors.lua:379: in function 'func'
2021-01-09 12:57:32: ERROR[Main]: /app/share/minetest/games/mesecraft/mods/mobkit/init.lua:627: in function 'execute_queues'
2021-01-09 12:57:32: ERROR[Main]: /app/share/minetest/games/mesecraft/mods/mobkit/init.lua:844: in function 'stepfunc'
2021-01-09 12:57:32: ERROR[Main]: /app/share/minetest/games/mesecraft/mods/mob_core/api.lua:976: in function 'on_step'
2021-01-09 12:57:32: ERROR[Main]: ...e/minetest/games/mesecraft/mods/better_fauna/api/api.lua:511: in function <...e/minetest/games/mesecraft/mods/better_fauna/api/api.lua:510>


This happended after I punched a walrus which I ported over to mobkit. I expect
better_fauna.hq_sporadic_flee(self, 20, puncher)
was called in the walrus's on_punch callback. (walrus depends on mob_core and better_fauna)

regardless, the debug points to this code:

function better_fauna.on_step(self, dtime, moveresult)
mob_core.on_step(self, dtime, moveresult)
if mobkit.timer(self, 1) then
if self.breeding_cooldown > 0 then
self.breeding_cooldown = self.breeding_cooldown - 1
end
mobkit.remember(self, "breeding_cooldown", self.breeding_cooldown)
end
end


specifically,
mob_core.on_step(self, dtime, moveresult)

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Patch 5

by ElCeejo » Post

Alpha Patch 5 is here!

Changes:

- Added mob_core.walkable_nodes table
- Added mob_core.find_val function
- Added pathfinding functions
- Re-Added mob_core.swim_to_next_waypoint
- Improved mob_core.fly_to_next_waypoint
- Improved spawn egg coloration
- Fixed crash when mobs die
- Fixed mob_core.is_mobkit_mob always returning false
- Fixed sound related crash
- Fixed mobs taking fall/fire damage when set to false
- Fixed mobs not defending owners when defend_owner is set to true

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Mob Core [alpha] [mob_core]

by MisterE » Post

Suggestion: add optional paramaters to call another spawn function when 1 spawn function is called
This would require optional 'spawn_def_name', 'call_spawn_by_name = {name = 'spawn_def_name',chance = int} and an optional 'disable_natural_spawn' paramaters.
then, you could disable natural spawns for a registered spawn function , but, for example, whenever you spawn a herd of deer, you have a chance of calling the spawn function with spawn_def_name = 'wolf_pack_5' which would spawn a pack of wolves hunting the deer

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Patch 6

by ElCeejo » Post

Alpha Patch 6 is here!

Changes

- Fixed group spawning crashes
- Fixed issues with wildlife mod
- Improved group spawning
- Improved pathfinding
- Renamed old pathfinding to mob_core.find_path_lite()
- Added new mob_core.register_on_spawn() function
- Added optional reliability param to register_spawn()

Note: The reliability param defaults to 3. The higher it is the more likely mobs are to successfully spawn at the minor cost of performance.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Patch 8 (Fix for Draconis and PaleoTest crashes)

by ElCeejo » Post

Alpha Patch 8 is here!

Changes

- Fixed crashes with flying PaleoTest mobs and Draconis mobs.
- Removed reliability param from register_spawn()
- Improved aerial function collision avoidance
- Improved lq_dumbwalk
- Improved spawning reliability
- Improved pathfinder reliability
- Added new dumb pathfinder for simple, quick paths.

I realize I forgot to add a changelog for Alpha Patch 7. If I were to type out an entire changelog it would take too much time, but in short: Patch 7 Improved various functions.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Patch 9 (Vastly improved A* Pathfinding)

by ElCeejo » Post

Alpha Patch 9 is finally ready!

This patch brings some small improvements to various functions, fixes crashes, and better API documentation. But the biggest improvement is the pathfinder.

The new pathfinder still uses A*, but offers up to 20x faster times over the previous A* pathfinder by burli, and offers similar performance to recent dumb pathfinders, making it the fastest and most flexible luaside A* pathfinder for Minetest. All of this works with a single function, rather than 5 unique functions that were needed previously. This pathfinder won't go unused, it will be present in updates for 2 of my mods that will be released very soon.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Important Announcement

by ElCeejo » Post

Development and support for Mob Core is ending soon. This will make more sense on February 10th, but until then don't expect any updates on this mod or it's dependents.

User avatar
ElCeejo
Member
Posts: 210
Joined: Thu Feb 28, 2019 23:29
GitHub: ElCeejo
In-game: ElCeejo
Location: Your Mother's house

Freedom

by ElCeejo » Post

Image
7 months of development, 2 years of planning, and over 7 years lingering in my head. It all culminates on February 10th.

Duvalon
Member
Posts: 43
Joined: Thu Jun 18, 2020 00:32
Location: Canada

Re: [mod] Mob Core [alpha] [mob_core]

by Duvalon » Post

What's on February 10th?

Duvalon
Member
Posts: 43
Joined: Thu Jun 18, 2020 00:32
Location: Canada

Re: [mod] Mob Core [alpha] [mob_core]

by Duvalon » Post

@ElCeejo, would you be open to a PR to support part of cmi? Namely the mob punching and dying (viewtopic.php?f=11&t=15448, https://github.com/raymoo/cmi, https://content.minetest.net/packages/Byakuren/cmi/)

I've recently submitted a PR to the awards mod which would enable achievements for punching or killing mobs. However, cmi is only supported by mobs_redo. Looking at the mobkit source code, it doesn't look appropriate to put it there as it only contains barebone functions. Mob_core however looks like it has the necessary plumbing for it. The only thing I couldn't quite figure out is who should be calling on_die(). I feel like vitals() should be taking care of it, but it doesn't.

Anyhow, let me know what you think.

Cheers.

wsor4035
Member
Posts: 182
Joined: Sun Aug 11, 2019 21:23
GitHub: wsor4035
IRC: wsor
In-game: wsor

Re: [mod] Mob Core [alpha] [mob_core]

by wsor4035 » Post

seems illogically to support a failed spec that died 5 years ago. just my two bent pennies
j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o

Duvalon
Member
Posts: 43
Joined: Thu Jun 18, 2020 00:32
Location: Canada

Re: [mod] Mob Core [alpha] [mob_core]

by Duvalon » Post

wsor4035 wrote:
Fri Mar 11, 2022 23:43
seems illogically to support a failed spec that died 5 years ago. just my two bent pennies
In my case it suits a very specific purpose: awards. For lack of a better alternative... I wouldn't call it failed so much as unfinished/incomplete (and abandoned).

The code seems of reasonably good quality to me, and the interface implemented is well documented. It has no dependencies, and isn't tightly coupled with minetest. For that reason, it's still as good as it was five years ago.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests