This document outlines the steps to create a minimal, standalone version of the th-set server-authoritative state system, stripping away Aztec game-specific logic.
Goal: Enable development/testing without requiring a real Discord application or internet connection, while maintaining the data structure expected by the system.
- Modify
login/index.js: Update the simple login server to simulate the complex data structure returned by the Discord OAuth flow.- Instead of just passing
nick, construct a fullauthDataobject (simulating Discord user + guild member data). - Ensure
userDatapassed to Twine includes{ gameState, authData }.
- Instead of just passing
- Update
login/index.html: Ensure the login form sends necessary data (nickname) to generate the mock profile.
Goal: Remove Aztec-specific variables from the server's initial state.
- Create
leanVars.json: A minimal, effectively empty JSON file (e.g.,{}) to serve as the initial server state.- Note: Variables do not need to be pre-defined here. The
<<th-set>>macro allows dynamic variable creation from Twee.
- Note: Variables do not need to be pre-defined here. The
- Update
Webstack.js/ Config: Point the server to useleanVars.jsonto ensure a clean slate without Aztec leftovers.
Goal: Extract the <<th-set>> macro and related client-side logic into a clean file.
- Integrate
live-update: Fetched and integrated externallive-update.jsfor<<liveblock>>macro. - Extract
th-set: Moved<<th-set>>logic toTwine/modules/th-set.js. - Bundle Scripts: Moved
ClientDemo.js,lodash.js, etc. toTwine/modules/and updatedtweeGaze.jsto bundle them automatically viatweego. - Update
Twine/LeanDemo.twee: SimplifiedStory JavaScriptto only loadsocket.ioand callinitMultiplayerClient. - Remove Aztec Logic: Code verified as generic engine logic.
Goal: Create a simple "Hello World" style multiplayer demo.
- Create
Twine/LeanDemo.twee: A minimal story with chat and shared counter. - Update Config: Pointed server to
LeanDemo.html. - Style: Integrated
Twine/demo_style.cssinto the build process.
Goal: Create a simple "Hello World" style multiplayer demo.
- Create
Twine/LeanDemo.twee: A minimal story with:- A start passage.
- A display of a shared variable.
- A button to update that variable using
<<th-set>>. - Chat Example: A simple input and display area that shows how to use
<<th-set>>with an array of message objects (e.g.,[{user, text, time}]) and<<liveblock>>to show updates instantly for everyone.
- Update Config: Point the server to load
LeanDemo.tweeinstead of the Aztec story files.
- Remove unused files: Archive or delete
Twine/EngineDemo.twee,Twine/demo.twee, and other game-specific assets from the active build path.