Carl Worth [Fri, 23 Dec 2022 01:13:55 +0000 (17:13 -0800)]
Add initial structure of a Magic School Bus puzzle
This has the same sort of introduction as the TARDIS puzzle (zooming
into the time machine), but this time it's the Magic School Bus, not
the TARDIS, of course.
Then, there's an interactive form for making some turtle art, and an
image showing the result. Currently, the result is hard-coded inside
the script, but it should be simple to make it consume the form input,
(which is already being sent to the server at least).
Carl Worth [Thu, 22 Dec 2022 03:39:45 +0000 (19:39 -0800)]
Add a closing message and make the reboot button functional
Also fix a bunch of state transitions, (joining the game in-progress,
rebooting from anywhere, reloading from anywhere).
With the sloppy DOM-manipulation approach I'm using it's pretty
painful to get all of those right, (could have used React or
something, but that has its own set of problems), so I won't promise
that everything is perfect, but I think it's pretty close.
Carl Worth [Thu, 22 Dec 2022 02:27:42 +0000 (18:27 -0800)]
Implement the logic for sending one word at a time to each boy
And for the boy's devices to fade each word out.
We're cueing off the first letter of each boy's name to ensure they
end up in different rooms. (So if people join the game with a name
whose first letter is other than 'C', 'H', 'A', or 'S' they will be
put into a random room.)
There isn't any answer checking yet, so currently the game will be
stuck in the first level, (even though the content for the other
levels _is_ available in the server).
Carl Worth [Thu, 22 Dec 2022 01:03:29 +0000 (17:03 -0800)]
Add a welcome stage to the TARDIS
This gives a 30 second countdown before entering the TARDIS along with
a display of how many companions are present. Finally, it ends with a
zoom into the TARDIS itself.
Carl Worth [Wed, 21 Dec 2022 20:47:27 +0000 (12:47 -0800)]
Extend maxAge of cookies to be a full week
The other cookie properties set in this commit are the defaults.
We want a long cookie age so that sessions are as persistent as possible.
The default maxAge is unset, but apparently instead of that meaning
"never expire" it is interpeted by agents as meaning the cookie is
non-peristent (and the agent may delete the cookie on browser close).
Carl Worth [Wed, 21 Dec 2022 19:51:50 +0000 (11:51 -0800)]
Set session to be "rolling"
That is, the expiration of the session should be extended on every
request, (making the session last much longer as long as the user is
interacting with it).
This should help with any workaround I put in place for username
tweaking on the backend, (since Hyrum's iPhone is having trouble
setting his name).
Carl Worth [Wed, 21 Dec 2022 03:26:56 +0000 (19:26 -0800)]
Implement code to detect target image prompts with target seeds
When a user enters any of the 8 target prompts with the correct
corresponding seed, the server will now send the pre-generated image
for this.
Also, the server will immediately send a comment from ZomboCom,
(imitating the style of either HAL or GLaDOS to some extent), giving
the boys some indication that they are on the right track.
Carl Worth [Wed, 14 Dec 2022 22:47:35 +0000 (14:47 -0800)]
Make the server generate a non-random random seed occasionally
As often as every 6th image, (but only if a random seed is requested
and the word "dice" does not appear in the prompt), Zombocom will
generate a very-much not random seed of 319630254. This is precisely
the seed needed to generate the target image for the prompt that
includes dice in it.
Carl Worth [Sun, 11 Dec 2022 19:26:34 +0000 (11:26 -0800)]
Only generate a figcaption if image has both prompt and code
Up until now, every image of course has had both a prompt and a code.
But we're about to start introducting updates from Coda into the image
stream. We still want these to have support for comments, but they
shouldn't have a caption or a reuse button.
Carl Worth [Fri, 9 Dec 2022 17:34:46 +0000 (09:34 -0800)]
Bring newly-commented images up to the top of the feed
This won't disrupt any current clients, (which would be super
annoying), but for any refreshes or new visits to the page, they will
see the most-recently-commented images at the top of the feed.
Carl Worth [Fri, 9 Dec 2022 15:00:35 +0000 (07:00 -0800)]
Fix name tracking to be persistent
By adding both a variable to record in the client what the server has
told us the name is, and also adding localStorage storage of the name
so it persists between browser starts.
This behavior had some negative side effects. Most notably, it meant
that when reloading the website a user would see nothing until
generating a new image, (perhaps doing so for no other reason than to
see the history).
Another problem was that a spectator, (like Carl or Stacy), couldn't
silently watch along, but had to also create an image.
Meanwhile, the intent of this behavior was just to ensure each of the
boys saw a blank history on their first encounter with the web
site. Now that at least 3 boys have seen the site, there's not much
remaining need for this.
Carl Worth [Thu, 8 Dec 2022 16:45:43 +0000 (08:45 -0800)]
Validate numeric code before form is submitted
The image generation script will reject any non-numeric seed as well
as any value larger than 2**32-1. So enforcing this up front at the
form will give the user a better experience.
Carl Worth [Thu, 8 Dec 2022 16:22:20 +0000 (08:22 -0800)]
Don't show any images until the user generates a new one
This way, every new user will have a similar initial experience and
get forced to figure out the image-generation form before seeing
anything else on the page.
Carl Worth [Wed, 7 Dec 2022 19:58:07 +0000 (11:58 -0800)]
Limit generated filename to something not crazy
Since otherwise, with a crazy-long prompt, we could exceed the limit
of the filesystem, (which I think is 255 characters for what I'm using
for the server currently). In this commit, we don't use more than 200
characters from the prompt itself, to which we could add 10 from the
seed and another handful for separators and a file extension, so that
should be good.
Carl Worth [Wed, 7 Dec 2022 09:35:04 +0000 (01:35 -0800)]
Fix a mix-up of "code" vs. "seed"
The UI at the top-level facing the users uses "code", but the API down
deep uses "seed" so there has to be a switch at some point, which
wasn't quite correct before this fix.
Carl Worth [Wed, 7 Dec 2022 07:55:29 +0000 (23:55 -0800)]
Add generate_image.py script
Which uses the dreamstudio interface to Stable Diffusion to generate
images from a text prompt. This does require an API key and has non-zero
cost, but I'm willing to do this for now, (and fortunately, the Stable
Diffusion code itself is entirely open-source so I could switch to my
own hardware when I decide to).