Mobkit - Entity API [mobkit][alpha]

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

Mobkit - Entity API [mobkit][alpha]

by Termos » Sun Feb 10, 2019 20:56

Image


Sep 27, 2019 alpha 190927 - Zombies - The Real Deal - Now With Sharks! details
Jul 08, 2019 Fixed server crash when a player disconnects while interacting with a mob.
Jun 01, 2019 Alpha release 0.10.0, contains a new example mod: Zombies - The Real Deal
May 03, 2019 Preview update - wildlife edition, now there's a new example mod included


For what I've seen here so far, it seems to me that the topic of entities/mobs deserves another look, so I decided to start another entity api from scratch. It's not very likely I'll be able to find the time to finish it, but sure I'm gonna try.

So far, I have the initial design roughly planned out, and all the basic concepts tested.
Here are some achievable goals I'm aiming for:

Inspired by physics:
Not any particular equations, but rather the spirit of physics translated into discrete step by step calculations. Gravity, buoyancy, friction, that kind of thing.

More like an actual API
That is, a collection of functions and mechanisms meant to be used and extended by modders to create complex entities and behaviors, rather than just a ready to go mod.

Easy async operation
Let's say you want a mob to turn smoothly to a specified yaw, then jump in the facing direction, then walk a few steps, then, say, explode.
You can issue these orders all in one go, they will keep on carrying them out in sequence until finished or interrupted.

Mob spatial awareness.
In Minetest, flat terrain tends to be an exception rather than a rule. No more walking in a random direction and checking if not stuck for seconds. By default, mobs will be aware of their immediate surroundings, know exactly where they want to get and take appropriate actions.

Consistency
I'm starting with very beginnings, with inanimate objects. More complex entities will inherit their properties and be subject to the same laws. For example, flying creatures are affected by gravity like everything else, just sometimes they exert force to counter it.

No dependencies.
This being an API, I want to keep it not dependent on any mods or subgames, even default.
The only dependence is latest stable Minetest release.
_________________

License: code: MIT | media: CC-BY-SA
MT version: 0.5.0 or later
Depends: mobkit:none | wildlife:mobkit | zombiestrd:mobkit
Download:
mobkit
wildlife
zombiestrd
Check it out online at: gundul.ddnss.de Port 39155

Attention: It is recommended to disable 'Show entity selection boxes' client setting.
They might be confusing because attack range has been reduced, but selection range hasn't.
___________________

Image

Some random clips:
+ Spoiler


Previous release:
mobkit.0.10.32.zip
(329.77 KiB) Downloaded 59 times
Last edited by Termos on Fri Sep 27, 2019 12:22, edited 25 times in total.
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Sun Feb 10, 2019 22:09

It sounds promising. But that and no more. Too much abandoned MOB projects in the past.

I would like the effort focused on Mobs Redo, the standard, right now, in fact, rather than in another zillionth mod. On the other hand 'mob spatial awareness' is a lack on Mobs Redo, the animals interact with enviroment in a dumb way.

But if you finish it, surely I will use it.
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Sun Feb 10, 2019 23:01

Well it says 'Redo', it would be rude not to try.

Seriously though, this isn't necessarily a direct competitor to Redo, which is more of a self contained mod than an API.
Currently I'm not planning to include a wide array of mobs and behaviors, just basic stuff, and ways to create your own entities, mobs and behaviors easily.
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mobs/Entities] Entity API [wip]

by ShadMOrdre » Mon Feb 11, 2019 06:27

Termos,

If you are interested in making this an API, then Mobs Redo is something to consider.

Pathfinder, AdvancedNPC, and NPCbuildqueue are APIs that expand on Mobs Redo. Pathfinder is a standalone mod that can be used with Mobs Redo with a simple code change to Mobs Redo api.lua file. AdvancedNPC and npcbuildqueue are APIs that expand Mobs Redo, registering their own mobs, based on Mobs Redo.

Your project sounds like it fits in here, if designed as either of the above use cases, from a modder standpoint.

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
TenPlus1
Member
 
Posts: 2611
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mobs/Entities] Entity API [wip]

by TenPlus1 » Mon Feb 11, 2019 08:02

Adding everything you have listed sounds ideal so long as it doesn't slow mobs down too much and cause lag on servers, the mobs redo api may be dumb in places but has been optimized for speed to keep things running as smooth as possible. Saying that I would like to see your code, maybe we could work together in adding as much as we can to the api :)
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Mon Feb 11, 2019 19:36

ShadMOrdre wrote:Termos,
If you are interested in making this an API, then Mobs Redo is something to consider.

I got to roughly know how it works when I modified the MCL2 Redo version.
Redo can be modified just as everything else, but it isn't really designed as an API. It's great if you want something similar to what it does already, however if you want something significantly different it may not be the best option.

TenPlus1 wrote:Adding everything you have listed sounds ideal so long as it doesn't slow mobs down too much and cause lag on servers

In my estimates it should end up being about as fast or faster, but The Engine Fights Back - I've had to do some workarounds for weird engine operation already, which may turn out to be expensive, we'll see.

TenPlus1 wrote:I would like to see your code, maybe we could work together in adding as much as we can to the api :)

Sure, I'll try to post some previews as soon as I have something usable put together.
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Mon Feb 11, 2019 22:51

TenPlus1 wrote:Adding everything you have listed sounds ideal so long as it doesn't slow mobs down too much and cause lag on servers, the mobs redo api may be dumb in places but has been optimized for speed to keep things running as smooth as possible. Saying that I would like to see your code, maybe we could work together in adding as much as we can to the api :)


Sometimes I sound rude, sorry but in my country we are like that, direct people (too much I believe). I love the Mobs Redo mod, I use it in fact.
 

User avatar
sorcerykid
Member
 
Posts: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mobs/Entities] Entity API [wip]

by sorcerykid » Tue Feb 12, 2019 02:59

This sounds a lot like my new Avatars mod. It was built from the ground up to provide a complete OOP mob development framework for building more realistic NPCs, monsters, friendly animals, etc. in Minetest.

The GenericAvatar class for example implements the underlying Action API and dispatcher (for scripted-sequences of commands to be executed asynchronously), Travel API and dispatcher (for terrain-based pathfinding to random, directional, and designated waypoints), and Target API (for sensory analysis of environmental cues and propogation of events based on discrete awareness levels).

The BasicAvatar class implements all of the decision making systems (via the sensory pipeline) and behavioral responses (retreat, follow, attack, search, patrol, and wander), most of which were inspired by Thief: The Dark Project. All of this functionality ties in with my new pathfinder, motion mechanics, and physics APIs to add a truly lifelike quality to mobs.

To give an idea of what is possible with the Avatars mod: A sheriff NPC patrolling around a castle, upon sighting a bone block, would become suspicious and start searching for intruders in the area. If a rustling sound is heard from a nearby bush, the sheriff would shout out for help. Two castle guards would leave their posts, and begin engaging in the search near the bush. After some time, if the player remains hidden in shadow and doesn't move, the guards and sheriff will lose interest and walk away but remain in a heightened state of awareness.

As mentioned above, I also overhauled the API for LuaEntitySAOs so that mobs can simulate true "player like" movement without the need for excessive and repetitious trigonometry calculations. In addition, the globalstep callback has been extended to provide continuous feedback about collisions and movement state. There's still much more testing to do, in addition to further refactoring and optimizing. But for the most part, the API is nearing completion after 7 long weeks of development (I think I'm approaching about 2500 lines of code). With any luck, my goal is to have at least an alpha version of Avatars and the CPP patches ready by mid-March :)
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Tue Feb 12, 2019 14:13

Now this does sound ambitious. In March already? Looks like I'm gonna have to hurry up.

Meanwhile, a new shipment of Testguins has arrived.
Image
They're still dumb as hell, but they'll learn.
 

User avatar
Andrey01
Member
 
Posts: 2308
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: [Mobs/Entities] Entity API [wip]

by Andrey01 » Tue Feb 12, 2019 17:53

As i see from the first screenshot the mod is already enough advanced if differ it with Mobs Redo. Entities can push off the walls. Could you also make entities can turn their heads?
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Tue Feb 12, 2019 21:00

I'm making a farming animals mod (Minetest Style). Your mod would suit with it, maybe.
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Tue Feb 12, 2019 21:08

sorcerykid wrote:This sounds a lot like my new Avatars mod. It was built from the ground up to provide a complete OOP mob development framework for building more realistic NPCs, monsters, friendly animals, etc. in Minetest.
:)


It's what I said, a lot of new API mobs mod. It is like Linux, a lot of distros, but no one can get the throne... 'This is the year of Linux' I'm tired really.

Mobs Redo is not perfect, but it is the only maintained thru the years.

I'm doing a animals mod, and I really desire a good API/Framework...
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Tue Feb 12, 2019 22:28

Andrey01 wrote:Could you also make entities can turn their heads?

I'm assuming you mean in a specific direction, like they are looking at the player.

I haven't thought about it.
Just off the top of my head, it should be no problem syncing two entities so they act like one, this would allow it to turn the head in horizontal plane. Vertical plane is another story though, maybe if the head was rigged to a single bone, but for that I would need some help from one of the Blender guys, it's been more than a decade since I done any 3d modelling.
This is the question of the future though, basics must come first.
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Tue Feb 12, 2019 22:34

runs wrote:I'm making a farming animals mod (Minetest Style). Your mod would suit with it, maybe.

Just say what specific features you have in mind, I'm still considering what behaviors are most basic and most needed to be included out of the box.
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Thu Feb 14, 2019 22:38

Termos wrote:
runs wrote:I'm making a farming animals mod (Minetest Style). Your mod would suit with it, maybe.

Just say what specific features you have in mind, I'm still considering what behaviors are most basic and most needed to be included out of the box.


Basic things hahaha: Wander, AI, avoid falling, flee when hurt, a kind of pathfinding, neutral/aggressive...
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Thu Feb 14, 2019 22:43

sorcerykid wrote:This sounds a lot like my new Avatars mod. It was built from the ground up to provide a complete OOP mob development framework for building more realistic NPCs, monsters, friendly animals, etc. in Minetest.

The GenericAvatar class for example implements the underlying Action API and dispatcher (for scripted-sequences of commands to be executed asynchronously), Travel API and dispatcher (for terrain-based pathfinding to random, directional, and designated waypoints), and Target API (for sensory analysis of environmental cues and propogation of events based on discrete awareness levels).

The BasicAvatar class implements all of the decision making systems (via the sensory pipeline) and behavioral responses (retreat, follow, attack, search, patrol, and wander), most of which were inspired by Thief: The Dark Project. All of this functionality ties in with my new pathfinder, motion mechanics, and physics APIs to add a truly lifelike quality to mobs.

To give an idea of what is possible with the Avatars mod: A sheriff NPC patrolling around a castle, upon sighting a bone block, would become suspicious and start searching for intruders in the area. If a rustling sound is heard from a nearby bush, the sheriff would shout out for help. Two castle guards would leave their posts, and begin engaging in the search near the bush. After some time, if the player remains hidden in shadow and doesn't move, the guards and sheriff will lose interest and walk away but remain in a heightened state of awareness.

As mentioned above, I also overhauled the API for LuaEntitySAOs so that mobs can simulate true "player like" movement without the need for excessive and repetitious trigonometry calculations. In addition, the globalstep callback has been extended to provide continuous feedback about collisions and movement state. There's still much more testing to do, in addition to further refactoring and optimizing. But for the most part, the API is nearing completion after 7 long weeks of development (I think I'm approaching about 2500 lines of code). With any luck, my goal is to have at least an alpha version of Avatars and the CPP patches ready by mid-March :)


I want it :-D
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mobs/Entities] Entity API [wip]

by ShadMOrdre » Fri Feb 15, 2019 04:48

sorcerykid wrote:This sounds a lot like my new Avatars mod. It was built from the ground up to provide a complete OOP mob development framework for building more realistic NPCs, monsters, friendly animals, etc. in Minetest.

The GenericAvatar class for example implements the underlying Action API and dispatcher (for scripted-sequences of commands to be executed asynchronously), Travel API and dispatcher (for terrain-based pathfinding to random, directional, and designated waypoints), and Target API (for sensory analysis of environmental cues and propogation of events based on discrete awareness levels).

The BasicAvatar class implements all of the decision making systems (via the sensory pipeline) and behavioral responses (retreat, follow, attack, search, patrol, and wander), most of which were inspired by Thief: The Dark Project. All of this functionality ties in with my new pathfinder, motion mechanics, and physics APIs to add a truly lifelike quality to mobs.

To give an idea of what is possible with the Avatars mod: A sheriff NPC patrolling around a castle, upon sighting a bone block, would become suspicious and start searching for intruders in the area. If a rustling sound is heard from a nearby bush, the sheriff would shout out for help. Two castle guards would leave their posts, and begin engaging in the search near the bush. After some time, if the player remains hidden in shadow and doesn't move, the guards and sheriff will lose interest and walk away but remain in a heightened state of awareness.

As mentioned above, I also overhauled the API for LuaEntitySAOs so that mobs can simulate true "player like" movement without the need for excessive and repetitious trigonometry calculations. In addition, the globalstep callback has been extended to provide continuous feedback about collisions and movement state. There's still much more testing to do, in addition to further refactoring and optimizing. But for the most part, the API is nearing completion after 7 long weeks of development (I think I'm approaching about 2500 lines of code). With any luck, my goal is to have at least an alpha version of Avatars and the CPP patches ready by mid-March :)



Source code or it doesn't exist. This sounds very promising, but also sounds like a bunch of hype.

Sorcerykid, if you want to advertise your own mod, it is far better etiquette to create your own thread, instead of highjacking the "competition". And please use github for your projects. It is a well known, and trusted service used by the MT team.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Fri Feb 15, 2019 17:45

Guys, If I were you, I would have quoted that whole post twice, just to be sure.

Meanwhile, Ladies and Gents,
meet my new assistant, Testiclown, and behold his mad walking around and not falling skills.
Image
Proof of concept phase finished, now onto the utility function library, has to be robust in order to make coding behavior functions a breeze.
 

User avatar
sorcerykid
Member
 
Posts: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mobs/Entities] Entity API [wip]

by sorcerykid » Fri Feb 15, 2019 18:54

ShadMOrdre wrote:Source code or it doesn't exist. This sounds very promising, but also sounds like a bunch of hype.

Sorcerykid, if you want to advertise your own mod, it is far better etiquette to create your own thread, instead of highjacking the "competition". And please use github for your projects. It is a well known, and trusted service used by the MT team.


Some quick questions...

    a) How is this a competition? I don't see a published mod in this thread, just a list of ideas.

    b) How am I "advertising" my work when it's unreleased? I was suggesting a possible solution.

    c) How is posting a single reply about a related project construed as thread "hijacking"?

    d) Why isn't the OP being accused of a bunch hype and not providing any source code?

    e) The OP, TenPlus1, and many others don't use GitHub, why aren't you criticizing them?

    f) If you are opposed to advertising, why were you promoting four other mods in this thread?

On a sidenote I do use GitHub. Sorry you missed the obvious repo link under my name.

Seems like someone got up on the wrong side of the bed :P
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mobs/Entities] Entity API [wip]

by ShadMOrdre » Fri Feb 15, 2019 20:41

sorcerykid,

I certainly wasn't trying to start anything, and sorry for the delivery.

I only know right and left side of the bed, and I do wake up on the "right" side. Hence my attitude.

Thanks for pointing me to the obviously missed github link. :)
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Sat Feb 16, 2019 15:54

For a moment there I thought I had a problem determining node heights, which is essential for spatial awareness thing. I got it sorted now I think, but one question to more experienced modders:
I haven't found 'leveled' nodes being used anywhere. Do you know of any mods making use of this feature, so I could test it properly?
 

User avatar
texmex
Member
 
Posts: 1580
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mobs/Entities] Entity API [wip]

by texmex » Sun Feb 17, 2019 10:30

Good to see movement on mob intelligence, I'm following this work. As I wrote in another mob framework thread (though not specific to it):

texmex wrote:I was thinking. When fighting mobs, what if instead of punching a selection box and become wildly unimmersed the calculation for hit or miss and damage would use raycasting instead?

Essentially if a mob stands in front of (and within swinging range of) a player when the player weapon is swung it's a hit, regardless of whether selection box was selected or not. Selection boxes could then be completely hidden, increasing immersion.


Would this be interesting to you?
 

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

Re: [Mobs/Entities] Entity API [wip]

by runs » Sun Feb 17, 2019 11:57

Termos wrote:For a moment there I thought I had a problem determining node heights, which is essential for spatial awareness thing. I got it sorted now I think, but one question to more experienced modders:
I haven't found 'leveled' nodes being used anywhere. Do you know of any mods making use of this feature, so I could test it properly?


Make your query in the Modding Discussion section better.
 

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

Re: [Mobs/Entities] Entity API [wip]

by Termos » Mon Feb 18, 2019 21:43

Raycasting.
texmex wrote:Would this be interesting to you?

Possibly, when the feature in question makes it to a stable release.
I'm not sure it could help with the problem you describe though.
 

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

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

by Termos » Fri Feb 22, 2019 21:19

I decided to post some preview code, attachments in the first post.

As usual, this doesn't reflect the final version, most planned features are missing and everything may and probably will change. Just a selection of code that I consider least embarassing, yet it's somewhat functional - you can take hellomob:test for a walk and even try to alter or create new walking-related behaviors.

I'm still considering several options to make this as straightforward and user friendly as possible, which is not the case atm. Also that 'self' passing may be confusing because the self in question is not really self as in OOP.


No documentation yet, so here's a quick summary of main concepts:

brainfunc
Entity property (function). Mobs must have it, inanimate objects not necessarily so. This is where the most important cognitive processes take place: where do we come from, what is the purpose of meaning, and above all - what are we going to do next.

This function's job is managing the high level behavior function queue.
There will be a default brain, but most of the time this is best left for the users to develop their own brains.

high level queue functions.
These represent complex behaviors, walking around, following, running away, patrolling, being in combat etc.

Their job is managing the low level behavior function queue

low level queue functions
These are the most basic units of behavior, turns, steps, jumps, attacks, wing flaps etc.

Their job is moving mobs around in the world and making them do stuff.


Queue functions are meant to be called over and over on consecutive engine steps, so they follow specific definition pattern. In short, they must be closures, the enclosed function must take only one argument - self, and return a boolean - True means it's done and ready to be removed from their queue.
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: MSN [Bot] and 7 guests