I’d like to show off something that I have worked out. I called it Red Monkey.
Well, honestly I don’t know, but I know the problem it’s supposed to solve: to ease the implementation of AI for JME characters. To achieve this, it does several things. Let’s have a quick glance on them.
Red Monkey introduces another virtual 3d space, where items have a position and semantical tags. It is of course implemented as an AppState with a nice debug view.
The AI-capable items can be controlled by means of Behavior Trees (courtesy of libgdx-ai) and the scripts can be loaded by the asset manager. I’ve introduced the concept of Interruption for managing long-running tasks.
The AI-capable items are made aware of their surrounding by means of virtual senses that can be attached. By decoupling the sense from the AI it is possible to make interesting combinations of blind or deaf characters.
Besides utilizing the gdx-ai, this library is built for CharacterControl and TerrainQuad.
The source is here:
On the demo, a monkey looks around for a “Tasty Banana”, then goes to (ahem) punch it and then returns home.
# # Monkey tree # # Alias definitions import sense:"redmonkey.elements.monkey.SenseTask" import goto:"redmonkey.elements.monkey.GotoTask" import sleep:"redmonkey.elements.monkey.SleepTask" import eat:"redmonkey.elements.monkey.EatTask" # Tree definition (note that root is optional) root selector sequence sense tag:"Banana,Tasty" goto eat sense tag:"Home" goto sequence sleep times:5
The source of the demo is here:
Here is a video:
Wait, is red monkey finished? Of course not! :chimpanzee_winktongue:
Still more work to do, but in the mean time I’d like to get feedback.
Thanks for reading!