Closed benknoble closed 1 year ago
@winny- points out on Discord that the nat-traversal
library implements a best-interface-ip-address
function, among others.
Relevant docs:
Next up: player summons. The design for these will probably inform how monsters work, too, since they have some similar concerns around being able to change how many there are.
Also: Change initiative slider to some other kind of input for ease of use (or make it width: 80%
or something).
My design notes for summons:
`(player ,c)
observable -> SSE path.)summon-xexpr
, which is shared with the main page generation function, composed with xexpr->string
or similar.embed/url
to send the client to a form (formlet
?) to give information to create the summon, and then send them back (after posting an action) to the main page.Since that worked, let's try monsters?
We can add an option to start a local HTTP server that players can use to enter their names, HP, and even adjust initiative. The implementation would likely consist of a servlet with forms which trigger updates to game-state observables (completing #12 might help organize this). The manager would need updates to the GUI to show the current actual state, in case of conflict (say, typing a name after someone has entered it through the server—how do we know which name is actually used?).
Starting the server should always be optional; that is, playing with a single "controller" as things stand currently should always be possible. If the server is started, there should be an informational display at the bottom of the manager (possibly with a more detailed display of logs on request). The info should at least consist of some indicator that the server is running and how it can be accessed (e.g.,
http://IP/frosthaven-manager.rkt
).It might be possible to display more game state (such as the main screen, or loot, etc.) in the served pages, but handling updates will be tricky.
The following is a "hello world" servlet:
If you
curl http://$(getip)/servlets/standalone.rkt
after running this code, you'll see the response. (Note thatgetip
is defined asipconfig getifaddr en0
on my machine.)cf. https://defn.io/2020/02/12/racket-web-server-guide/ because of weirdness with
serve/servlet
and servlet paths: by default, all the demo servlets are available, too.