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 APIThat 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 operationLet'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.

ConsistencyI'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._________________

Attachments below are just code preview for the curious to see where it's going. It's not meant to be used for development yet.

A clip of the springiness parameter testing.So, football matches in Minetest? - sure why not.Note: I borrowed the model from Redo just for testing purposes, it's not going to be included in any release.

Random roaming behavior

Last edited by Termos on Sun May 19, 2019 18:27, edited 13 times in total.

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.

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.

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.

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

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.

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.

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

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 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.

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

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.

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.Proof of concept phase finished, now onto the utility function library, has to be robust in order to make coding behavior functions a breeze.

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?

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?

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.

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?

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.

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.