ssube / textual-engine

an event-driven text adventure engine for both narrative story telling and procedural dungeon crawling
MIT License
16 stars 2 forks source link

Run in browser #575

Closed tvb closed 11 months ago

tvb commented 1 year ago

As mentioned here the engine can run in make or docker, how can I run this engine in a browser?

ssube commented 1 year ago

You'll need to serve the files somehow. It looks like I have not added the dev server plugin to the esbuild configuration, so you can add that, or use an external server (like http-server or nginx).

To build the browser bundle, start with make bundle. That will produce out/index.html and out/browser.mjs, which are the files you need to serve. Using something like https://www.npmjs.com/package/http-server, that should be http-server ./out.

I often use the server container, and you can mount the files there, so you don't have to restart every time you build them. That looks like podman run -v ./out:/usr/share/nginx/html:ro docker.io/nginx.