Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Preliminary API for 'new' brains AI system for mobs

Open sowelipililimute opened this issue 1 year ago • 6 comments

Would fix #10443 if done.

This is a rough proposal for abstracting over the brains AI system for mobs for plugins to make use of, similar to the Goals API. I don't think it's feasible to attempt to make the new AI conform to the old interfaces.

At the moment I understand the rough skeleton and arteries of the system, though I'm still trying to piece together what does what in user-facing terms. 'get the mob to walk somewhere' has been unsuccessful so far.

As far as API stability concerns, as long as the exposed set of tasks isn't too 1:1 with what Mojang has, then we should be fine (until the next Big Rewrite:tm: whenever that is) considering the general stability of the system across versions since its introductions.

There are still some unanswered questions in the API design:

  • do events make sense to have here? I'd say no considering the amount of lambdas in the Minecraft implementation that make any real introspection API unfeasible.
  • do we care to expose sensors/make them modifiable? It could probably be done in a followup PR to make custom tasks & sensors a thing, as I'm mostly concerned about exposing what exists in Vanilla at the moment.
  • is the arrangement of the entrypoints to the new API sensical?

Test plugin is included in PR to ease testing of the new API until it's ready to ship.

sowelipililimute avatar Apr 27 '24 03:04 sowelipililimute

Feel free to reference https://github.com/PaperMC/Paper/pull/6968

This should support creating own sensors/memories via the bootstrap api.

Owen1212055 avatar Apr 27 '24 16:04 Owen1212055

how does the way tasks are exposed look?

sowelipililimute avatar Apr 28 '24 01:04 sowelipililimute

need to figure out generating the SensorTypeKeys in a more type-safe manner

sowelipililimute avatar May 10 '24 23:05 sowelipililimute

can someone explain the CI failure to me I don't really get it and also I can't reproduce it locally

sowelipililimute avatar Aug 18 '24 14:08 sowelipililimute

GeneratedFrom("1.20.6")

electronicboy avatar Aug 18 '24 15:08 electronicboy

can someone explain the CI failure to me I don't really get it and also I can't reproduce it locally

As @electronicboy said in the short form. You need to regenerate the classes with the updated version. So just remove the comment in paper-api-generator project, so that it will be recognized as a project. Then run the main method in that project to regenerate the classes. It'll automatically update the code and of course the annotation.

yannicklamprecht avatar Aug 18 '24 23:08 yannicklamprecht