2023 May 17
Wednesday evening

Back to the future

In the previous article we flirted with the idea of recreating the old-school text experience.

Is that what the world needs in 2023? What about all the lovely Web technology there is available now? What if we could we make use of that instead?

Balladeer is a web-native framework. It makes it easy to host a Story so that it runs in a browser. The Web version of the knock, knock joke has less code than the text-mode example.

Less is More

Copy the following lines into a new file called

from balladeer import Dialogue
from balladeer import StoryBuilder
from balladeer import quick_start

story = StoryBuilder(
    Dialogue("Here's a joke..."),
    Dialogue("<ADAM> Knock, knock."),
    Dialogue("<BETH> Who's there?"),
    Dialogue("<ADAM> Doctor."),
    Dialogue("<BETH> Doctor who?"),
    Dialogue("<ADAM> You just said it."),

if __name__ == "__main__":

The perfect host

Go back to your terminal window.

On Linux:

py3/bin/python -m main

On Windows:

py3\Scripts\python.exe -m main

First you should see something like this:

[2023-05-17 20:21:33 +0100] [5371] [INFO] Running on (CTRL + C to quit)

Now open a Web browser and type localhost:8080 into the location bar.

No points for style

Without any additional styling the results are admittedly plain.

An unstyled rendering of Balladeer dialogue.

Press the Enter key to proceed through the dialogue.

We're on our way!

The journey is about to start. Along the way, gently and progressively, you will practise Python, HTML5 and CSS3. Perhaps a little Javascript too if you want that.

You will have all the features of the Web at your disposal. The power to connect to databases, hook up with social media feeds, integrate with every kind of API.

You can write parser games or point-and-click puzzles. You can host a gallery of your art, or showcase your latest musical project. You can play locally, or on a network with colleagues, or serve to the entire world.

See you next time!

Comments hosted at Disqus