Kit is a lightweight, extensible 2D framework for game development in the Vylocity Game Engine. Designed to be simple and modular, Kit empowers developers to build complex projects quickly through a robust plugin-driven architecture.
bun install -g @evitcastudio/kit
Note: The
-gflag ensures thekitCLI tool is globally available in your PATH.
The kit init command provides an interactive walkthrough to quickly scaffold a new project for the Vylocity Game Engine.
# Start the interactive walkthrough
kit init
# Or scaffold a project with flags
kit init <project-name> --single # For single-player
kit init <project-name> --multi # For multiplayer
The command will create a structured directory for your project, including pre-configured package.json, essential Vylocity files, and a local development environment.
After scaffolding, follow these steps to get started:
cd <project-name>bun installbun run buildNote: This process is preconfigured for you if you used
kit init
The kit build command locates all Vylocity engine-related resources in your source directory, anonymizes them, and moves them to a deploy-ready output directory.
kit build -i ./<in-dir> -o ./<out-dir>
# To learn more about this command
kit build --help
Executing this command automatically generates a resource.json map in your project's directory.
Best Practice: Exclude resource.json from version control (.gitignore), as it is a build artifact.
Note: This process is preconfigured for you if you used
kit init
Kit.setResources()should be called beforeVYLO.load().
import resourceJSON from 'resource.json';
// Initialize the engine with mapped resources
await Kit.setResources(resourceJSON);
Once your project is scaffolded and dependencies are installed and the project has been built, you can run your game locally.
# For Single-Player or Multiplayer games
bun run host
The server will be available at the following locations after being hosted:
Singleplayer
http://localhost:8090 defined in./bun-serve.ts
Multiplayer or Singleplayer & Multiplayer
http://localhost:30000 defined in./src/server/settings.json
import { Plugin } from 'custom-plugin';
// Register a single plugin
const plugin = Kit.registerPlugin(Plugin);
// Register multiple plugins
import { Plugin1 } from 'custom-plugin1';
import { Plugin2 } from 'custom-plugin2';
const plugins = Kit.registerPlugins([Plugin1, Plugin2]);
// After being registered, kit can find the plugin by name.
const plugin1 = Kit.getPlugin('plugin1-name');
const plugin2 = Kit.getPlugin('plugin2-name');
Plugins emit events, this is how they pass relevant data to other plugins or the main thread. By listening to these events you can act on this data.
const listener = (pEvent: EmitterEvent) => {
const { data, timestamp } = pEvent;
// Here you can use the data that the event sent down.
}
// Choose to listen to specific event from a plugin
Kit.on('plugin-name', 'event-name', listener);
// You can also stop listening for an event
Kit.off('plugin-name', 'event-name', listener);
For more information check out the wiki