Story telling extension [early preview]

EDIT: @richard took this idea and went further building an awesome new extension:
Expect a post about this sometime eventually (nudge nudge @richard :P)
I recommend using that one over this one.

I’m experimenting with an extension based on @richard’s awesome Holodate game:

the goal is to make story-telling easier, and to use that awesome text typer.

Here’s the extension currently:

Here’s a sample:

There will likely be a lot of changes coming still, as I’m not too happy with the APIs yet. “start story” is weird. “say” not pausing is weird. Setting colors and speed globally is weird. But even so, you can make some pretty cool stuff.


It looks amazing!

The only thing I don’t understand about the example you provided is that you need to put those blocks inside a start story block. What is the point of that??

Yes, this is admittedly awkward and there’s not a simple explanation, and it has to do with the internals of how MakeCode works. I’m still looking to see if there’s a better design.

Technical reason:

It has to do with how On Start works. Because users might depend on code running in On Start before any other code in their program (like variable initialization, etc), On Start is “blocking” meaning if you “pause” in On Start the whole program pauses and waits, so the game engine can’t render or run update logic.

What “start story” does is spins up a background thread effectively that makes the subsequent calls non-blocking to the main game loop. This allows us to use pause to time the story telling.

@jwunderl please correct me if I’m wrong

On start isn’t blocking, we just move game update events (and a few others) so that they are registered after on start (e.g. see that pressing a is reflected on screen even before that pause is up, and that the sprite shows up). It’ll still run the update and render logic, just any of those events registered in blocks won’t be added until after on start finishes.

I would imagine this is actually what you generally want with a story though ( / that you don’t generally want to spin another fiber for this) - if you have an on game update loop that spawns enemies, you dont want it running while you’re talking to the professor to start the story. It should be fine to just drop the wrapping block?

Oh interesting, I had that backwards. Thanks Joey.

Then I need to debug what goes wrong when I move the logic to the On Start. I was seeing very odd behavior.