RFC for Red Monkey

Hi monkeys,
I’d like to show off something that I have worked out. I called it Red Monkey.

What is it?

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.

The AI space

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 smart monkey

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 senseful monkey

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.

The JMonkey

Besides utilizing the gdx-ai, this library is built for CharacterControl and TerrainQuad.
The source is here:
https://github.com/QuietOne/MonkeyBrains/tree/master/src/redmonkey

The demo

On the demo, a monkey looks around for a “Tasty Banana”, then goes to (ahem) punch it and then returns home.

The script:

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

Conclusion

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!

5 Likes

Cool!

kewl!!