Page 1 of 1

[Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Fri Sep 02, 2016 03:52
by Byakuren
This is a mod providing an interface like I described in viewtopic.php?f=47&t=15331.

License: Apache 2.0
Mod dependencies: none
Download: Not yet (but you can still view and download from Github)

Github: https://github.com/raymoo/cmi
API docs: https://cmi-minetest.github.io
Implementation Guide (For mob framework writers): https://github.com/raymoo/cmi/blob/mast ... MENTING.md
Code Examples: https://github.com/raymoo/cmi_examples

I would like feedback from both modders who want to use the interface, and authors of mob frameworks. For modders using the interface, what do you think needs to be added/changed/removed in the interface? For mob framework writers, do you forsee any problems in implementing the interface? After writing the interface I did a quick check through Mobs Redo and it looks like it would be easy to integrate there, but that might not cover all cases. If you want to say something, I'm fine with it being posted in this thread or as an issue on the github repository.

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Sat Sep 03, 2016 20:20
by Byakuren
If you think the API looks great, you can say that too.

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Sat Sep 03, 2016 22:51
by Christian9
Looks neat, but if this is for creating mobs is there a template for mob creation?

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Sun Sep 04, 2016 04:42
by Byakuren
Christian9 wrote:Looks neat, but if this is for creating mobs is there a template for mob creation?

It's neither. It's a standard interface you can put on top of existing or new mob frameworks so that modders who want to interact with those mobs only need to know about the CMI interface, instead of writing separate code for every mob mod that exists.

Concretely, the mod provides some callback registration functions and something sort of like an attribute system for mobs. You can use these features with any mobs that implement the interface.

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Sun Sep 04, 2016 06:51
by Krock
The Lua code is well documented but even with the implementation helpfile I have no clue how to use this framework/interface in a mobs mod. An example file would help here a lot to see how it could look like.

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Sun Sep 04, 2016 07:13
by Byakuren
Krock wrote:The Lua code is well documented but even with the implementation helpfile I have no clue how to use this framework/interface in a mobs mod. An example file would help here a lot to see how it could look like.

Alright, I'll put making an example on my todo list. I've mentioned this mod to tenplus1 in IRC, so either he'll implement it or I'll start making PRs (that's not meant to be a threat), and that will be an additional "live example".

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Tue Sep 06, 2016 03:09
by Byakuren
I've added an implementation code example (check the OP). You can do /spawnentity cmi_examples:mob to spawn the example mob. I plan on adding examples for other parts of the API later.

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Mon Jan 16, 2017 02:56
by Byakuren
It's been a while, but I think I'm about ready to release. Any comments from anyone who is interested in the project?

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Mon Jan 16, 2017 02:59
by Christian9
Excited to test it out

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Mon Jan 16, 2017 03:32
by Byakuren
Christian9 wrote:Excited to test it out

Thanks

Though really I just replied so I can say something extra: I'm specifically interested in complaints about the API (both on the library-user and implementor sides).

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Tue Jan 17, 2017 07:46
by D00Med
This seems very interesting, especially this: "Modders can write mobs that don't use any framework, by just implementing the interface"
Now I just have to get my head around how to use the mod :]

Re: [Mod] [Draft] Common Mob Interface [cmi]

PostPosted: Tue Jan 17, 2017 09:42
by Byakuren
D00Med wrote:This seems very interesting, especially this: "Modders can write mobs that don't use any framework, by just implementing the interface"
Now I just have to get my head around how to use the mod :]

Just in case there's any misunderstanding, this just means CMI can be used on your mob as long as it implements the interface. CMI won't make your mob walk around or attack players by itself, that would have to be coded by the mob author.