Mob/NPC API

Post Reply
CIB
New member
Posts: 7
Joined: Sat May 07, 2011 11:32

Mob/NPC API

by CIB » Post

There are various mob/NPC frameworks, all do similar things, all do them a bit differently. I'd like to add some DwarfFortress-like features to the game, but for that I'd first need a functional, solid and extensible mob/NPC API. It makes sense to develop this with the community, as mobs/NPCs are a desired feature anyway, and compatability between my work and that of others would be a good thing.

Here's what I currently need:

- Unified NPC/mob API: High level commands like "goto X", "Follow X", "Pay attention to X", etc.
- A behavior callback API that lets you implement the way these commands are carried out for individual mobs/NPCs
- An abstract pathfinding API, with possible implementations ranging from simple "move directly toward the target tile", to elaborate pathfinding mechanisms that involve building and storing a topology map of a chunk(C++ implementations must be possible for obvious reasons)

Optional features:
- An AI API that implements goals and planning
- Some blueprint implementations of movement/animation for some generic body types, because frankly, the ones I've tried looked terrible

I'd like to take feedback on this and work it into the design, then hopefully get to a point where a bunch of us can agree on an API.

EDIT: To elaborate a bit on the pathfinding idea, I think it'd make sense for it to be based on tiles. So you'd use it, for example, for a builder NPC who needs to path a way to some resource stockpile, and then from there to the build destination. The NPC would then plan as if they were a tile-based mover, and only interpolate the "analogous" steps as they actually move along the path. This would reduce cost of pathfinding significantly, while not looking too terrible.

User avatar
Krock
Developer
Posts: 4648
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Mob/NPC API

by Krock » Post

I would like to have an API for mobs in the engine and already had the idea about an unified mob API earlier

This is definitely something which would increase Minetest's popularity.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Casimir
Member
Posts: 1204
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Mob/NPC API

by Casimir » Post

That is what I tired to start with "mobapi". But I don't have the time to develop this and there are no other contributers. So it is not that much different from the API that is included in simple_mobs. Also there are many things that better should be done in the engine (Like tool wearout).
I would be happy if some people pick this topic up and create something usable.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Mob/NPC API

by kaeza » Post

Spoiler
Image
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
Krock
Developer
Posts: 4648
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Mob/NPC API

by Krock » Post

True, some older mob mods are not developed anymore and could be counted as those 14. But the 15th standard would contain all developed and new mobs.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Casimir
Member
Posts: 1204
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Mob/NPC API

by Casimir » Post

Currently all those mods come with their own mobs and own core code, there is no standard api. What I did it to take the existing - sort of - standard of the simple_mobs code and make it accessible.

TG-MyinaWD
Member
Posts: 356
Joined: Thu May 08, 2014 21:22
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .
Location: Far Eden

Re: Mob/NPC API

by TG-MyinaWD » Post

Yeah I think the Player And Mob API Needs Knockback and better turning and such animations.

But as of right now there lots we implementing that I think We need focus on something huge and get it done.

I would like in the game.conf a mods folder naming like..

mods_dir_folder_name = FolderName
as of default it will be mods like as now.

Might not be to hard to rewrite if people added the menu folder.

Now for rewrite work with older versions might be simple.

But I'm really busy making my huge Minetest Project and I need to update it to latest MT Build before I get furthermore on it.

I hope to make an map for it to.
So release date is TBA.
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.

CIB
New member
Posts: 7
Joined: Sat May 07, 2011 11:32

Re: Mob/NPC API

by CIB » Post

We should probably start by making a list of existing mods and figuring out what features they have. I think most are based on PilzAdam's mod, because they all contain the same basic code.

Here are the ones I've found:
https://github.com/stujones11/minetest-npcf/
https://github.com/sapier/animals_modpack
https://github.com/jojoa1997/peaceful_npc
https://github.com/cornernote/minetest-towntest

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: Mob/NPC API

by twoelk » Post

CIB wrote:We should probably start by making a list of existing mods...
you might find this list useful: http://wiki.minetest.net/Mobs
Games that include mobs are not listed yet though.

User avatar
rubenwardy
Moderator
Posts: 6969
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Mob/NPC API

by rubenwardy » Post

I started writing a mob mod could YAMM, it was heavily modular, very nice code structure. Different mob states were different modules, eg walk, run, attack, eat, as well as different behaviour types. Modules could modify other modules. Flying mobs could have been supported, I just had to develop it.

But I lost the code.

Here is the only thing I have left, it is a very early prototype, I uploaded it for demonstration purposes: https://gist.github.com/rubenwardy/b5cd1a01049e0c935ecf
I now upload all my indev projects to bitbucket as private repos.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

CIB
New member
Posts: 7
Joined: Sat May 07, 2011 11:32

Re: Mob/NPC API

by CIB » Post

twoelk wrote:
CIB wrote:We should probably start by making a list of existing mods...
you might find this list useful: http://wiki.minetest.net/Mobs
Games that include mobs are not listed yet though.
Thanks, that's helpful.
rubenwardy wrote:I started writing a mob mod could YAMM, it was heavily modular, very nice code structure. Different mob states were different modules, eg walk, run, attack, eat, as well as different behaviour types. Modules could modify other modules. Flying mobs could have be
Too bad you lost it. :(

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Mob/NPC API

by Sokomine » Post

Don't forget to take a look at npcf. That was basicly the same - a mob api for player-like mobs. My own traders focus on the trading aspect. They don't move around at all.
A list of my mods can be found here.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests