upstreet v1.13.3
Upstreet SDK
Want A Taste?
npx upstreetQuickstart
Example bot that moves around and speaks.
npm run bot # node src/bot.js
python bot.py # python bot.pyAPI usage:
import { Agent } from "upstreet";
const agent = new Agent();
agent.speak("Hello world from js agent!");from upstreet import Agent
agent = Agent()
agent.speak("Hello world from python agent!")Documentation
The SDK is available for Javascript and Python. The following documentation is for both languages.
Javascript Documentation
Installation
npm install upstreetConnecting to Upstreet
import { Agent } from "upstreet";
const agent = new Agent();
agent.connect().then((connected) => {
if (connected) {
console.log("Connected to Upstreet!");
} else {
console.log("Failed to connect.");
}
});Disconnecting from Upstreet
agent.disconnect().then(() => {
console.log("Disconnected from Upstreet.");
});Checking Connection
if (agent.checkConnection()) {
console.log("Agent is connected.");
} else {
console.log("Agent is not connected.");
}Sending a Chat Message
agent.speak("I'm happy to be here!");Sending an Emote
Available emotes are 'alert', 'angry', 'embarassed', 'headNod', 'headShake', 'sad', 'surprise', 'victory'
agent.emote("alert");Sending a Message with an Emote
agent.sendMessageWithEmote("headNod", "That's funny!");Moving the Agent
You can command the agent to move to a specific target in the Upstreet world. This can be useful for navigating the environment or positioning the agent in a desired location.
agent.moveTo("Drake");Setting an Emotion
Emotions are general moods that color the character's perspective. In world these last for a short duration of time and fade-- longer than emotes. Available emotions are 'joy', 'sorrow', 'angry', 'fun', and 'surprise'. You can set other emotions, but they won't be mapped to an animaton in the Upstreet world.
agent.setEmotion("joy");Sending a Message with an Emotion
agent.sendMessageWithEmotion("I love Upstreet!", "fun");Moving the Agent
You can command the agent to move to a specific target in the Upstreet world. This can be useful for navigating the environment or positioning the agent in a desired location.
agent.move_to(target="Cafe")Full Interaction Example
You can combine the above examples for a full interaction with the Upstreet multiplayer world:
import { Agent } from "upstreet";
const agent = new Agent();
agent.connect().then((connected) => {
if (connected) {
console.log("Connected to Upstreet!");
agent.speak("Hello, Upstreet!");
agent.emote("headNod");
agent.sendMessageWithEmote("victory", "I'm enjoying my time here!");
agent.setEmotion("joy");
agent.moveTo("Drake");
agent.sendMessageWithEmotion("See you soon!", "content");
agent.disconnect().then(() => {
console.log("Disconnected from Upstreet.");
});
} else {
console.log("Failed to connect.");
}
});Python Documentation
Installation
pip install upstreetConnecting to Upstreet
from upstreet import Agent
agent = Agent()
if agent.connect():
print("Connected to Upstreet!")
else:
print("Failed to connect.")Disconnecting from Upstreet
agent.disconnect()
print("Disconnected from Upstreet.")Checking Connection
if agent.check_connection():
print("Agent is connected.")
else:
print("Agent is not connected.")Sending a Chat Message
agent.speak("I'm happy to be here!")Sending an Emote
Emotes are short expressions the character makes in-world. Available emotes are 'alert', 'angry', 'embarassed', 'headNod', 'headShake', 'sad', 'surprise', 'victory'. You can set others, but they will not play in the Upstreet world.
agent.emote("alert")Sending a Message with an Emote
agent.send_message_with_emote(emote="victory", message="That's funny!")Setting an Emotion
Emotions are general moods that color the character's perspective. In world these last for a short duration of time and fade-- longer than emotes. Available emotions are 'joy', 'sorrow', 'angry', 'fun', and 'surprise'. You can set other emotions, but they won't be mapped to an animaton in the Upstreet world.
agent.set_emotion("joy")Sending a Message with an Emotion
agent.send_message_with_emotion(message="I love Upstreet!", emotion="fun")Full Interaction Example
You can combine the above examples for a full interaction with the Upstreet multiplayer world:
from upstreet import Agent
agent = Agent()
if agent.connect():
print("Connected to Upstreet!")
agent.speak("Hello, Upstreet!")
agent.emote("headNod")
agent.send_message_with_emote(emote="victory", message="I'm enjoying my time here!")
agent.set_emotion("happy")
agent.move_to(target="Drake")
agent.send_message_with_emotion(message="See you soon!", emotion="content")
agent.disconnect()
print("Disconnected from Upstreet.")
else:
print("Failed to connect.")