construct3-pdf-scaffold-v2
Create a Construct 3 source project scaffold from a PDF story/activity document using the bundled updated Letter G V2 template. Use when Antigravity needs to inspect a PDF, identify scene/activity cou
SKILL.mdconstruct3-pdf-scaffold-v2/SKILL.md
GitHubConstruct 3 PDF Scaffold V2
Purpose
Use this skill to turn a PDF story/activity document into a Construct 3 source project scaffold using the updated Letter G base project. The scaffold creates the project shell and preserves the universal runtime systems; it does not invent full custom activity logic unless the user asks for that after scaffolding.
Default template: assets/letterg-v2-template.
Workflow
- Use the local
pdfskill first when a PDF is provided. ReadC:\Users\Abhinav\.gemini\config\skills\pdf\SKILL.md, extract text, and render pages when visuals affect scene/activity count. - Identify scenes, story beats, and activities from the PDF. Do not infer scene count from filename alone.
- Create a
scene-plan.jsonwithprojectNameandscenes. - Run
scripts/scaffold_from_template.js. - Parse all generated Construct JSON and verify the V2 universal systems survived.
- Tell the user to open the generated source project in Construct and preview
Loader/MainLayoutfirst.
Scene Plan
Use this shape:
{
"projectName": "New Construct 3 Project",
"scenes": [
{
"title": "Intro",
"layers": ["S1_Game"],
"notes": "Opening story scene"
},
{
"title": "Tracing Activity",
"layers": ["S2_Game", "S2_TracingActivity"],
"notes": "Interactive tracing activity"
}
]
}
Layer rules:
- Always include
S{n}_Game. - Always include
S1_StartUIfor Scene 1; the script preserves V2startbg,startbtn, andContinue. - Add activity layers as
S{n}_ActivityName, for exampleS3_MatchingActivity,S4_TracingActivity, orS5_Read. - Use Construct-safe names: letters, digits, and underscores only.
Scaffold Script
Run:
node C:\Users\Abhinav\.gemini\config\skills\construct3-pdf-scaffold-v2\scripts\scaffold_from_template.js --out "C:\path\to\empty-output-folder" --scene-plan "C:\path\to\scene-plan.json"
Optional:
node ...\scaffold_from_template.js --out "C:\path\to\out" --scenes 6 --project-name "My Project"
node ...\scaffold_from_template.js --template "C:\custom\ConstructProject" --out "C:\path\to\out" --scene-plan "C:\path\scene-plan.json"
The script refuses to merge into a non-empty output folder. It copies the V2 template, deletes generated scene layouts/sheets, rebuilds scene lists, updates GlobalSheet includes and hardcoded total scene count, writes generated scene layouts/sheets, prunes unused non-universal object types/media/scripts, and writes scene-plan.generated.json.
V2 Universal Systems To Preserve
Read references/letterg-v2-conventions.md when changing the script or debugging generated output.
Always preserve:
MainLayout,GlobalSheet,Loader,Loader_BG,Video,UI, andOverlay.L_Scene1global/common layers:frame,Video,UI,Overlay, andS1_StartUI.- Scene 1 start UI objects:
startbg,startbtn, andContinue. - Continue/save variables and flow:
currentProgress,currentStars,ContinueVideoTime,checkOnPlayed, andgameOVer. - New progress/star system:
scripts/stars.js,DoStarIncrement(runtime),star2,starTrail,starsHolder,progress,3starProgress,starpanel, and related effects. - Runtime/plugin object types used by universal systems:
LocalStorage,Array,Audio,Browser,Touch,Video,Continue,ClickVFX,Retry,startbg,startbtn,starTrail,star2,starsHolder,progress,3starProgress, andstarpanel. - Universal audio/video:
bright garden music,starsound,whoosh 1,whoosh 2,snap,snap place,star,You got a star!,You got one more star!,FX01 1,FX02 1,FX03 1,FX04 1, and the template video.
Generated Scene Event Sheets
Each generated ES_SceneN should include:
include GlobalSheet- Scene state variable:
sceneStatefor Scene 1,sceneNStatefor later scenes SetupGameplayVideo And Scene FlowFunctions
For Scene 1, the generated gameplay start block must use the V2 flow: request fullscreen, reset/play Video, show UI, hide and disable S1_StartUI, play bright garden music, and set progress frame from currentProgress instead of the old currentStars-only behavior. It must also include the Continue button touch handler block to load checkpoint information from localStorage, map progress/stars/time configurations, set current scene routing, restore star milestones, and resume video playback.
For activity completion in later implementation passes, prefer calling DoStarIncrement(runtime) from stars.js for progress completion instead of manually incrementing only currentStars.
Validation
Always parse all generated JSON:
@'
const fs=require("fs"), path=require("path");
const files=["project.c3proj"];
function addJsonFiles(dir) {
if (!fs.existsSync(dir)) return;
for (const f of fs.readdirSync(dir)) {
const full = path.join(dir, f);
if (fs.statSync(full).isDirectory()) addJsonFiles(full);
else if (f.endsWith(".json")) files.push(full);
}
}
for (const dir of ["layouts","eventSheets","objectTypes","families","timelines","flowcharts"]) addJsonFiles(dir);
for (const f of files) JSON.parse(fs.readFileSync(f,"utf8"));
console.log(`Parsed ${files.length} JSON files successfully.`);
'@ | node -
Then verify:
project.c3projlists exactly generatedL_SceneNandES_SceneN, plusMainLayout,GlobalSheet, andLoader.GlobalSheet.jsonincludes every generated scene sheet plusLoader.MainLayout.jsonhasVideo,Scene1..SceneN,UI,Overlay, andLoader_BG.L_Scene1.jsonretainsframe,Video,UI,Overlay, andS1_StartUIinstances.Continue,LocalStorage,Array,starTrail,3starProgress,ClickVFX, andstars.jsremain after pruning.- Required universal sounds/music/video remain listed in
project.c3projand physically present. - No stale scene layout or event sheet files above the generated scene count remain.
Safety
Do not overwrite assets/letterg-v2-template. Do not delete template assets unless the user explicitly requests template maintenance. Keep PDF extraction/rendering temp files outside the generated Construct project unless the user asks to include them.