|
1 | | -# UEFN TOOLBELT — Project Setup Demo |
| 1 | +# UEFN TOOLBELT — Full Pipeline Demo |
2 | 2 | # ==================================== |
3 | 3 | # Run this in the UEFN Python REPL (Output Log > Python (REPL) tab) |
4 | | -# to see the full AI project setup workflow live. |
| 4 | +# to see the complete 8-phase AI game-building pipeline live. |
5 | 5 | # |
6 | 6 | # Prerequisites: |
7 | | -# 1. UEFN is open with any level loaded |
| 7 | +# 1. UEFN is open with a BLANK TEMPLATE LEVEL (not a production project) |
8 | 8 | # 2. UEFN Toolbelt is installed (Content/Python/ contains UEFN_Toolbelt/) |
9 | | -# 3. Run the nuclear reload if you just installed: |
| 9 | +# 3. Nuclear reload first — paste this into the REPL: |
10 | 10 | # import sys; [sys.modules.pop(k) for k in list(sys.modules) if "UEFN_Toolbelt" in k]; import UEFN_Toolbelt as tb; tb.register_all_tools(); tb.launch_qt() |
11 | 11 | # |
12 | | -# Then paste each block below into the REPL one at a time. |
13 | | -# Each block must complete before running the next (Quirk #22). |
| 12 | +# Each block below is a separate paste into the REPL. |
| 13 | +# Wait for each block to complete before running the next (Quirk #22). |
| 14 | +# ⚠️ Phases 1–3 are read-only. Phase 4 onward modifies the level. |
14 | 15 |
|
15 | 16 | import UEFN_Toolbelt as tb |
16 | 17 |
|
17 | 18 | # ------------------------------------------------------------------ |
18 | | -# STEP 1 — Scaffold the project + deploy Verse game manager |
| 19 | +# PHASE 0 — RECON: Know the level before touching it |
19 | 20 | # |
20 | | -# What happens: |
21 | | -# - Creates 56 professional folders in Content Browser |
22 | | -# (/Game/MyGame/Maps, /Meshes, /Materials, /Verse, etc.) |
23 | | -# - Generates a wired MyGameManager Verse device skeleton |
24 | | -# - Deploys it directly to your project's Verse directory |
| 21 | +# Exports every actor in the level (transforms, class, folder, |
| 22 | +# bounds, asset path, tags) to Saved/UEFN_Toolbelt/world_state.json. |
| 23 | +# The summary block at the top shows class counts + folder map — |
| 24 | +# read that first for a quick level overview. |
| 25 | +# ------------------------------------------------------------------ |
| 26 | +result = tb.run("world_state_export") |
| 27 | +print(f"Actors exported: {result.get('actor_count')}") |
| 28 | +print(f"Output: {result.get('output_path')}") |
| 29 | + |
| 30 | + |
| 31 | +# ------------------------------------------------------------------ |
| 32 | +# PHASE 1 — RECON: Build the device palette |
| 33 | +# |
| 34 | +# Scans the Asset Registry for every Creative device Blueprint |
| 35 | +# available in Fortnite (not just what's placed — the full catalog). |
| 36 | +# Writes device_catalog.json — Claude reads this to pick devices. |
| 37 | +# ------------------------------------------------------------------ |
| 38 | +result = tb.run("device_catalog_scan") |
| 39 | +print(f"Devices found: {result.get('device_count')}") |
| 40 | +print(f"Output: {result.get('output_path')}") |
| 41 | + |
| 42 | + |
| 43 | +# ------------------------------------------------------------------ |
| 44 | +# PHASE 2 — HEALTH CHECK: Level audit before building |
25 | 45 | # |
26 | | -# Run this first. Wait for it to return before step 2. |
| 46 | +# Runs 6 audit categories: actors, memory, assets, naming, |
| 47 | +# LODs, performance. Returns a score 0–100 with grade (A+…F) |
| 48 | +# and ordered list of issues to fix before publishing. |
| 49 | +# ------------------------------------------------------------------ |
| 50 | +result = tb.run("level_health_report") |
| 51 | +print(f"Health score: {result.get('score')}/100 ({result.get('grade')})") |
| 52 | +print(f"Status: {result.get('overall_status')}") |
| 53 | +for issue in result.get("top_issues", [])[:5]: |
| 54 | + print(f" • {issue}") |
| 55 | + |
| 56 | + |
| 57 | +# ------------------------------------------------------------------ |
| 58 | +# PHASE 3 — SCAFFOLD: Professional folder structure + Verse skeleton |
| 59 | +# |
| 60 | +# Creates 56 content folders in the Content Browser and generates |
| 61 | +# a wired Verse game manager skeleton (creative_device subclass, |
| 62 | +# @editable refs, OnBegin stub) deployed to the Verse source dir. |
27 | 63 | # ------------------------------------------------------------------ |
28 | 64 | result = tb.run("project_setup", project_name="MyGame") |
29 | 65 | print("Verse file:", result.get("verse_path")) |
30 | 66 | print("Next steps:", result.get("next_steps")) |
31 | 67 |
|
32 | 68 |
|
33 | 69 | # ------------------------------------------------------------------ |
34 | | -# STEP 2 — Spawn a symmetrical Red vs Blue arena |
| 70 | +# PHASE 4 — LAYOUT: Spawn a symmetrical competitive arena |
35 | 71 | # |
36 | | -# What happens: |
37 | | -# - Places 493 actors in the viewport (floor tiles, walls, platform) |
38 | | -# - Red spawn cluster at X+ / Blue spawn cluster at X- |
39 | | -# - Fully undoable with Ctrl+Z |
40 | | -# |
41 | | -# Run AFTER step 1 returns. Separate call required (Quirk #22). |
| 72 | +# Places floor tiles, walls, and ramp platforms in a symmetric |
| 73 | +# Red vs Blue layout. Fully undoable (Ctrl+Z). |
| 74 | +# Change size to "small", "large", or "extra_large". |
42 | 75 | # ------------------------------------------------------------------ |
43 | | -result = tb.run("arena_generate", size="medium") |
| 76 | +result = tb.run("arena_generate", size="medium", apply_team_colors=True) |
44 | 77 | print(f"Arena: {result.get('placed')} actors placed") |
45 | 78 | print(f" Red spawns: {result.get('red_spawns')}") |
46 | 79 | print(f" Blue spawns: {result.get('blue_spawns')}") |
47 | 80 |
|
48 | 81 |
|
49 | 82 | # ------------------------------------------------------------------ |
50 | | -# STEP 3 — Build Verse (one manual click) |
| 83 | +# PHASE 5 — VERSE: Deploy a battle-tested game template |
51 | 84 | # |
52 | | -# In UEFN: Verse menu -> Build Verse Code |
53 | | -# Wait for the build to complete, then run step 4. |
| 85 | +# Lists available templates first, then deploys one. |
| 86 | +# Templates are production-tested skeletons: elimination scoring, |
| 87 | +# zone capture, round flow, item spawner cycle, countdown race. |
| 88 | +# Claude reads verse_template_list, picks the right one, fills in |
| 89 | +# device labels from world_state.json, then deploys. |
54 | 90 | # ------------------------------------------------------------------ |
| 91 | +result = tb.run("verse_template_list") |
| 92 | +print("Available templates:") |
| 93 | +for t in result.get("templates", []): |
| 94 | + print(f" {t['name']:30s} {t['description']}") |
| 95 | + |
| 96 | +# Deploy the elimination scoring template |
| 97 | +result = tb.run("verse_template_deploy", |
| 98 | + name="elimination_scoring", |
| 99 | + filename="game_manager.verse", |
| 100 | + overwrite=True) |
| 101 | +print("Deployed:", result.get("verse_path")) |
55 | 102 |
|
56 | 103 |
|
57 | 104 | # ------------------------------------------------------------------ |
58 | | -# STEP 4 — Close the error loop |
| 105 | +# PHASE 6 — BUILD: Trigger Verse compilation |
59 | 106 | # |
60 | | -# Reads the build log, extracts any errors, returns file content |
61 | | -# so Claude (or you) can fix and redeploy in one shot. |
62 | | -# If the build succeeded, returns build_status: SUCCESS. |
| 107 | +# One manual step: In UEFN, click Verse → Build Verse Code. |
| 108 | +# Wait for the build to finish, then run Phase 7. |
| 109 | +# ------------------------------------------------------------------ |
| 110 | +# [User clicks Build Verse in UEFN menu] |
| 111 | + |
| 112 | + |
| 113 | +# ------------------------------------------------------------------ |
| 114 | +# PHASE 7 — ERROR LOOP: Read errors, fix, redeploy |
| 115 | +# |
| 116 | +# Reads the build log, extracts structured errors (file, line, col, |
| 117 | +# message, error_type, fix_hint) + full content of every erroring |
| 118 | +# .verse file so Claude can fix and redeploy in one shot. |
| 119 | +# Repeat until build_status == "SUCCESS". |
63 | 120 | # ------------------------------------------------------------------ |
64 | 121 | result = tb.run("verse_patch_errors") |
65 | 122 | print("Build status:", result.get("build_status")) |
66 | 123 | print("Errors:", result.get("error_count")) |
67 | | -if result.get("errors"): |
68 | | - for e in result["errors"]: |
69 | | - print(f" Line {e['line']}: {e['message']}") |
| 124 | +if result.get("errors_by_file"): |
| 125 | + for filepath, errors in result["errors_by_file"].items(): |
| 126 | + print(f"\n {filepath}:") |
| 127 | + for e in errors[:3]: |
| 128 | + print(f" Line {e['line']}: [{e.get('error_type','?')}] {e['message']}") |
| 129 | + if e.get("fix_hint"): |
| 130 | + print(f" Fix: {e['fix_hint']}") |
| 131 | + |
| 132 | + |
| 133 | +# ------------------------------------------------------------------ |
| 134 | +# PHASE 8 — VERIFY + CHECKPOINT |
| 135 | +# |
| 136 | +# Re-export world state to confirm level matches design intent, |
| 137 | +# run a publish readiness audit (actor budget, required devices, |
| 138 | +# Verse build status, memory, redirectors), then save a snapshot. |
| 139 | +# ------------------------------------------------------------------ |
| 140 | +result = tb.run("publish_audit") |
| 141 | +print(f"Publish ready: {result.get('overall_status')}") |
| 142 | +print(f"Score: {result.get('score')}") |
| 143 | +for step in result.get("next_steps", [])[:5]: |
| 144 | + print(f" → {step}") |
| 145 | + |
| 146 | +result = tb.run("snapshot_save", name="demo_v1") |
| 147 | +print(f"Checkpoint saved: {result.get('snapshot_name')}") |
| 148 | +print(f" Actors: {result.get('actor_count')}") |
| 149 | +print(f" Path: {result.get('output_path')}") |
| 150 | + |
| 151 | + |
| 152 | +# ------------------------------------------------------------------ |
| 153 | +# BONUS — TEXTURE AUDIT: Catch oversized textures before publishing |
| 154 | +# ------------------------------------------------------------------ |
| 155 | +result = tb.run("texture_audit") |
| 156 | +print(f"Textures audited: {result.get('total_audited')}") |
| 157 | +for t in result.get("oversized", [])[:5]: |
| 158 | + print(f" ⚠ {t['name']} {t.get('width')}×{t.get('height')} {t.get('compression')}") |
| 159 | + |
| 160 | + |
| 161 | +# ------------------------------------------------------------------ |
| 162 | +# BONUS — ACTIVITY LOG: Review everything the toolbelt did this session |
| 163 | +# ------------------------------------------------------------------ |
| 164 | +result = tb.run("toolbelt_activity_stats") |
| 165 | +print(f"Tools called: {result.get('total_calls')}") |
| 166 | +print(f"Error rate: {result.get('error_rate_pct')}%") |
| 167 | +print(f"Slowest: {result.get('slowest_tool')}") |
| 168 | +print(f"Most called: {result.get('most_called_tool')}") |
0 commit comments