Back to SQUIDI.NET   |   Three Hundred: Mechanics / Prototypes

 

<-- Return to Comic Engine -->

 Actors, Backdrops, and Scenes

Before building comics, you need to be able to build a scene. A scene consists of a single Backdrop and a number of Actors. The actors are built according to the Spouts mentioned in the previous note article.

 Actors

An Actor is little more than a wrapper around a Sprout Template. The initial state is set to CLASSNAME_DEFAULT, where CLASSNAME is passed to the actor at creation time. An actor also has a name, which it is referenced by in the scene changes and a position within the scene. It also has a layer, which is used for sorting sprites in reference to the background.

Since scenes are cloned each panel, the Actors are also cloned (which in turn clones the template and its render contexts).

 Backdrops

A Backdrop is basically just the background to the scene, such as in the Warrior's Guild or Jenny's Bar. Backdrops consist of three parts.

1. Layers. Backdrops might have things that change about it, such as a door being open or closed, or props which appear in front of characters. These are just sprites broken up into layers and drawn in that order. So every prop in layer 0 will be drawn, then every actor in layer 0, then props in layer 1, actors in layer 1, etc. Props have a "trigger" which is a reference to a hashtable of named boolean values. The props will only draw if the trigger is true. So the door will be drawn if "DOOR" is true. If there is no trigger on the prop at all, the prop will be drawn regardless.

2. Defaults. This is the basic default state of the trigger hashtable. In the example code, "DOOR" is false and "DESK" is true (I don't use DESK for anything - that prop had the trigger removed and always draws at layer 1). Backdrops are meant to be immutable, which means the defaults are not used directly, but become the basis of the hashtable for the particular scene.

3. Sweet Spots. Measuring pixels sucks and you don't want to be doing it to place every single character in every scene. Instead, you can save the spots and reference them by name. So setting the actor "Maxim" to the sweet spot "BEHIND_DESK" will place him at the specified x and y position, with the layer set to 0 such that the desk draws in front of him.

Backdrops are stored in a global database, referenced by name. A Backdrop is immutable and can be shared between multiple Scenes, and as such cannot be cloned.

 Scenes

A Scene is simply a Backdrop and a bunch of Actors. The Scene is initially set up by creating the trigger hashtable for the Backdrop based on the Backdrop Defaults. Then the Actors are created and placed. To create comics, each panel contains a personal copy of a scene, with each successive panel cloning the previous scene and making changes to it. As such, when an actor is changed in panel 3, that change is preserved in panel 4, 5, 6, etc.

Scenes are kept in a global database, referenced by name. However, whenever a panel makes changes to a scene, the global database is updated to point to the most recent version of the Scene. Then if you make a second comic in the same Scene, it will reflect all the changes made during the first comic. In this way, making comics must be done in order, as each new panel and comic makes destructive changes to the Scene. However, there's really no reason to keep the initial state of a scene. You can't rewind time.

 

 





Copyright 2013-2017 Sean Howard. All rights reserved.