What Are the Different Scene Types Generated by OpenMAIC?
OpenMAIC generates four distinct scene types—slide, quiz, interactive, and pbl—that define the content structure and UI behavior for each step in a learning stage.
The THU-MAIC/OpenMAIC repository models educational content as a Stage containing multiple Scenes, where each scene is strictly typed to control rendering and interaction modes. These scene types are enumerated in the DSL package and drive both the server-side generation logic and the client-side classroom experience.
The Four Core Scene Types in OpenMAIC
Slide Scenes
The slide type represents traditional whiteboard content rendered via a PPT-style canvas. According to the source code in packages/@openmaic/dsl/src/stage.ts, this is the most basic scene type, carrying static visual content through the SlideContent interface.
Quiz Scenes
Scenes with type quiz contain one or more assessment questions. The QuizContent interface defines the schema for question arrays, supporting various question formats including single and multiple choice.
Interactive Scenes
The interactive type powers dynamic activities such as coding sandboxes or simulations. Implemented via the InteractiveContent interface, these scenes extend the base SceneContent union to accept implementation-specific payloads like language configurations and starter code.
Project-Based Learning (PBL) Scenes
The pbl type aggregates multiple activities into a project-based learning workflow. Using the PblContent interface, these scenes can bundle research steps, resources, and sub-activities into a single structured page.
Type Definitions and Runtime Constants
The scene type enumeration is explicitly defined in packages/@openmaic/dsl/src/stage.ts at lines 21–23 as a TypeScript string union:
export type SceneType = 'slide' | 'quiz' | 'interactive' | 'pbl';
For runtime validation and membership checks, the repository exposes a frozen constant array at lines 24–30:
export const SCENE_TYPES = [
'slide',
'quiz',
'interactive',
'pbl',
] as const satisfies readonly SceneType[];
The Scene interface in lib/types/stage.ts couples each scene's id, type, concrete content (typed as SlideContent, QuizContent, InteractiveContent, or PblContent), and an optional actions array that drives playback or authoring behavior.
Implementing Each Scene Type
Below are complete TypeScript examples demonstrating how to construct valid scene objects for each type, importing from the repository's shared type definitions.
Slide Scene:
import { Scene, SlideContent } from '@/lib/types/stage';
const slideScene: Scene = {
id: 'scene-001',
type: 'slide',
content: {
type: 'slide',
canvas: { /* PPTist slide data */ },
} as SlideContent,
actions: [],
};
Quiz Scene:
import { Scene, QuizContent } from '@/lib/types/stage';
const quizScene: Scene = {
id: 'scene-002',
type: 'quiz',
content: {
type: 'quiz',
questions: [
{
id: 'q1',
type: 'single',
question: 'What is the capital of France?',
options: [
{ label: 'Paris', value: 'A' },
{ label: 'Berlin', value: 'B' },
],
},
],
} as QuizContent,
actions: [],
};
Interactive Scene:
import { Scene, InteractiveContent } from '@/lib/types/stage';
const interactiveScene: Scene = {
id: 'scene-003',
type: 'interactive',
content: {
type: 'interactive',
payload: { language: 'javascript', starterCode: 'console.log("Hello");' },
} as InteractiveContent,
actions: [],
};
PBL Scene:
import { Scene, PblContent } from '@/lib/types/stage';
const pblScene: Scene = {
id: 'scene-004',
type: 'pbl',
content: {
type: 'pbl',
steps: [{ title: 'Research', description: 'Find background info' }],
} as PblContent,
actions: [],
};
These objects conform to the Scene interface and can be passed to the stage API (/api/stage) or managed via the client-side workspace store defined in lib/store/stage.ts.
Summary
- OpenMAIC defines exactly four scene types:
slide,quiz,interactive, andpbl. - Type definitions live in
packages/@openmaic/dsl/src/stage.ts, while content interfaces reside inlib/types/stage.ts. - Each type maps to a specific content interface (
SlideContent,QuizContent,InteractiveContent,PblContent) that shapes the data structure. - Server-side generation logic in
lib/server/scene-generation.tsconsumes these types to produce valid scene objects.
Frequently Asked Questions
What file contains the SceneType definition in OpenMAIC?
The SceneType union type and the SCENE_TYPES runtime constant are defined in packages/@openmaic/dsl/src/stage.ts at lines 21–30. This file serves as the source of truth for all valid scene type literals across the codebase.
Can I create custom scene types beyond the four provided?
No. The TypeScript union type explicitly restricts SceneType to 'slide' | 'quiz' | 'interactive' | 'pbl'. The SCENE_TYPES array is also frozen with as const, preventing runtime extension without modifying the core DSL package source.
How does OpenMAIC handle different content structures for each scene type?
Each scene type correlates with a dedicated content interface in lib/types/stage.ts. When constructing a scene, the content field must match the interface corresponding to the scene's type property, ensuring type-safe payload structures for slides, quizzes, interactive widgets, and PBL workflows.
Where is the server-side logic for generating these scenes implemented?
The generation logic resides in lib/server/scene-generation.ts. This module implements the algorithms that create scene objects based on the SceneType parameter, while lib/store/stage.ts provides client-side state management for scene persistence and editing.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →