Note
You can now use the @reality/api
APM package for the most streamlined way to create Reality
agents.
Check out some example agents below. To get started with adding agents to your own World, check out the World Guide.
These agents work as static entities, and are fixed in place so cannot move. They can be added to the world's RealityEntitiesStatic
table manually.
- Fantasy Llama
- A simple NPC that listens to the
Default
(click) interaction and writes in the Chat.
- A simple NPC that listens to the
- Llama Joker
- A more complex NPC that makes use of the
SchemaFormExternal
interaction, that allows the user to pay $LLAMA coin and request a joke in a given topic. This NPC usesaos-sqlite
, and AI to generate jokes. See the source code for more details on how to set this up.
- A more complex NPC that makes use of the
To add any of these agents to your world, spin up a new process for the agent, configure CHAT_TARGET
in the agent source to point to your world process ID, and add the agent to your World's RealityEntitiesStatic
table (as described in the respective source files).
Dynamic entities must send a registration message to the world process (instead of being manually added to the world's RealityEntitiesStatic
table). Dynamic entities are able to update their position and other parameters in real-time, just like players.
You'll need to set your process up to use the Cron
system, so that they can run periodic tasks.
Before loading the agent's source, you should configure the TARGET_WORLD_PID
global to your desired world Id. You may also want to change the Position
s to line up with your world's coordinate system.
- Llama Complainer
- Listens to the chat, if there are more than a couple messages he will complain about it.
- Llama Runner
- Players can instruct him to run around Llama Land in a loop.
Note
To prevent your agents from disappearing due to inactivity, you can fix the agent's visibility by sending the following message from the Agent's process:
Send({
Target = TARGET_WORLD_PID,
Tags = {
Action = 'Reality.EntityFix',
},
})
Read the Reality Protocol docs for more information on how to configure agents in your world. See the Schema Protocol for more information on how to configure custom interactions with your agents.