🎱Customize your own simulation
NOTE: every time you change character data, you should re-run npx convex run testing:wipeAllTables and then npm run dev to re-upload everything to Convex. This is because character data is sent to Convex on the initial load. However, beware that npx convex run testing:wipeAllTables WILL wipe all of your data.
Create your own characters and stories: All characters and stories, as well as their spritesheet references are stored in characters.ts. You can start by changing character descriptions.
Updating spritesheets: in
data/characters.ts, you will see this code:export const characters = [ { name: 'f1', textureUrl: '/assets/32x32folk.png', spritesheetData: f1SpritesheetData, speed: 0.1, }, ... ];You should find a sprite sheet for your character, and define sprite motion / assets in the corresponding file (in the above example,
f1SpritesheetDatawas defined in f1.ts)Update the Background (Environment): The map gets loaded in
convex/init.tsfromdata/gentle.js. To update the map, follow these steps:Use Tiled to export tilemaps as a JSON file (2 layers named bgtiles and objmap)
Use the
convertMap.jsscript to convert the JSON to a format that the engine can use.
node data/convertMap.js <mapDataPath> <assetPath> <tilesetpxw> <tilesetpxh><mapDataPath>: Path to the Tiled JSON file.<assetPath>: Path to tileset images.<tilesetpxw>: Tileset width in pixels.<tilesetpxh>: Tileset height in pixels. Generatesconverted-map.jsthat you can use likegentle.js
Adding background music with Replicate (Optional)
For Daily background music generation, create a Replicate account and create a token in your Profile's API Token page.
npx convex env set REPLICATE_API_TOKEN # tokenThis only works if you can receive the webhook from Replicate. If it's running in the normal Convex cloud, it will work by default. If you're self-hosting, you'll need to configure it to hit your app's url on
/http. If you're using Docker Compose, it will behttp://localhost:3211, but you'll need to proxy the traffic to your local machine.Note: The simulation will pause after 5 minutes if the window is idle. Loading the page will unpause it. You can also manually freeze & unfreeze the world with a button in the UI. If you want to run the world without the browser, you can comment-out the "stop inactive worlds" cron in
convex/crons.ts.Change the background music by modifying the prompt in
convex/music.tsChange how often to generate new music at
convex/crons.tsby modifying thegenerate new background musicjob
Last updated