Register sounds on the client and play them from gameplay code.
import { provideClientModules } from "@rpgjs/client"; provideClientModules([ { sounds: [ { id: "item-pickup", src: "sounds/item-pickup.mp3" }, { id: "battle-theme", src: "sounds/battle-theme.mp3" } ] } ]);
player.playSound("item-pickup");
map.playSound("battle-theme", { volume: 0.8, loop: true });
provideServerModules([ { maps: [ { id: "town", sounds: ["town-bgm", "town-ambience"] } ] } ]);