
Client for interacting with the Virtual Home API, enabling environment reset, character management, scripted action rendering and async-friendly remote control of multi-agent grounded language simulations.
This repository contains a Kotlin Multiplatform library for interacting with the Virtual Home API. It supports JVM, Linux (X64), and JavaScript (Node.js). Virtual Home is a multi-agent platform for grounded language learning. You can find more information about Virtual Home on the official website: http://virtual-home.org/
To use this library in your JVM project, add the following to your build.gradle.kts file:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.ugaikit:vh:0.6")
}The library can be compiled to a Node.js module.
./gradlew jsNodeProductionLibraryDistributionThe generated module can be found in build/compileSync/js/main/productionLibrary/kotlin/.
Here is a simple example of how to use the VirtualHomeClient:
import io.github.ugaikit.vh.VirtualHomeClient
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
val client = VirtualHomeClient()
// Reset the environment to scene 0
client.reset(0)
// Add a character to the scene
client.addCharacter()
// Define a script for the character to execute
val script = listOf(
"<char0> [WALK] <tv> (106)",
"<char0> [TOUCH] <tv> (106)"
)
// Render the script
client.renderScript(script)
}To use the library in a Node.js project, require the generated module. Note that functions are asynchronous and return Promises.
const vh = require('./build/compileSync/js/main/productionLibrary/kotlin/VirtualHome.js');
const VirtualHomeClient = vh.io.github.ugaikit.vh.VirtualHomeClient;
async function main() {
const client = new VirtualHomeClient("localhost", 8080);
// Reset the environment to scene 0
await client.reset(0);
// Add a character
await client.addCharacter();
console.log("Setup complete");
}
main();You can find the API documentation here.
To build the library from source, you will need to have Gradle installed. Then, run the following command in the root of the repository:
./gradlew buildThis repository contains a Kotlin Multiplatform library for interacting with the Virtual Home API. It supports JVM, Linux (X64), and JavaScript (Node.js). Virtual Home is a multi-agent platform for grounded language learning. You can find more information about Virtual Home on the official website: http://virtual-home.org/
To use this library in your JVM project, add the following to your build.gradle.kts file:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.ugaikit:vh:0.6")
}The library can be compiled to a Node.js module.
./gradlew jsNodeProductionLibraryDistributionThe generated module can be found in build/compileSync/js/main/productionLibrary/kotlin/.
Here is a simple example of how to use the VirtualHomeClient:
import io.github.ugaikit.vh.VirtualHomeClient
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
val client = VirtualHomeClient()
// Reset the environment to scene 0
client.reset(0)
// Add a character to the scene
client.addCharacter()
// Define a script for the character to execute
val script = listOf(
"<char0> [WALK] <tv> (106)",
"<char0> [TOUCH] <tv> (106)"
)
// Render the script
client.renderScript(script)
}To use the library in a Node.js project, require the generated module. Note that functions are asynchronous and return Promises.
const vh = require('./build/compileSync/js/main/productionLibrary/kotlin/VirtualHome.js');
const VirtualHomeClient = vh.io.github.ugaikit.vh.VirtualHomeClient;
async function main() {
const client = new VirtualHomeClient("localhost", 8080);
// Reset the environment to scene 0
await client.reset(0);
// Add a character
await client.addCharacter();
console.log("Setup complete");
}
main();You can find the API documentation here.
To build the library from source, you will need to have Gradle installed. Then, run the following command in the root of the repository:
./gradlew build