Story¶
The StoryBuilder
class provides the top level object for your narrative.
To create a new Story, override the build method of a subclass.
It is a generator of Drama
objects.
class Story(StoryBuilder):
def build(self):
yield Drama(world=self.world, config=self.config).set_state(Detail.none)
The public API is under development and not documented at this time.
While this is the case, you should use the quick_start
function to run your Story.
- quick_start(module: [str | ModuleType] = "", resource="", builder=None, host="localhost", port=8080):
Launch a Story to play over the Web.
- Parameters:
module – A Python module, or else a string which identifies one.
resource – An optional path into a submodule. Web assets will be loaded from this location.
builder – A subclass of
StoryBuilder
or an instance object.host – The host interface from which to serve the Story.
port – The network port from which to serve the Story.
If you don’t supply all that information, quick_start
is clever enough to guess anyway.
Have a look at the examples to see how simple it is to use.