scad-gltf 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/bin/{scad-convert.js → convert.js} +1 -1
- package/bin/gen.js +33 -0
- package/bin/{scad-mcp.js → mcp.js} +11 -11
- package/bin/{scad-play.js → play.js} +2 -4
- package/bin/scad-gltf.js +33 -0
- package/bin/{scad-serve.js → serve.js} +1 -1
- package/godot/README.md +3 -6
- package/godot/addons/scad_importer/scad_importer.gd +8 -7
- package/package.json +4 -16
- package/src/cli-utils.js +20 -31
- package/src/project-prompts.js +256 -0
- package/bevy/README.md +0 -46
- package/bevy/examples/LICENSE +0 -21
- package/bevy/examples/README.md +0 -58
- package/bevy/examples/package.json +0 -5
- package/bevy/examples/packman_3d.js +0 -2415
- package/bin/scad-bevy.js +0 -74
- package/bin/scad-gen.js +0 -25
- package/bin/scad-godot.js +0 -140
- package/bin/scad-web.js +0 -51
- package/godot/examples/LICENSE +0 -21
- package/godot/examples/README.md +0 -91
- package/godot/examples/fruit_fusion_3d.js +0 -1774
- package/godot/examples/horde_survivor_3d.js +0 -2753
- package/godot/examples/kids_digit_writing.js +0 -2532
- package/godot/examples/naval_battle_3d.js +0 -1691
- package/godot/examples/package.json +0 -5
- package/godot/export_presets.cfg +0 -25
package/bin/scad-bevy.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { runCliApp } from "../src/cli-utils.js";
|
|
4
|
-
|
|
5
|
-
async function main() {
|
|
6
|
-
await runCliApp({
|
|
7
|
-
projectType: "bevy",
|
|
8
|
-
buildSystemPrompt: (
|
|
9
|
-
promptRules,
|
|
10
|
-
) => `You are an expert Rust Bevy engine game developer and procedural 3D technical artist.
|
|
11
|
-
|
|
12
|
-
NAMING CONVENTION REQUIREMENT:
|
|
13
|
-
- All generated files, directories, models, scripts, and root folders MUST strictly use snake_case (lowercase with underscores, e.g. \`player_character.rs\`, \`enemy_walker.scad\`).
|
|
14
|
-
- NEVER use hyphens/minus signs (\`-\`) or spaces in any file or folder names.
|
|
15
|
-
|
|
16
|
-
What to generate:
|
|
17
|
-
1. 3D Game Assets (.scad):
|
|
18
|
-
- Generate procedural 3D models for the game using OpenSCAD.
|
|
19
|
-
- CRITICAL: The SCAD to glTF converter automatically converts OpenSCAD's Z-up coordinate system to the standard glTF Y-up coordinate system. Design your models naturally in OpenSCAD.
|
|
20
|
-
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
21
|
-
|
|
22
|
-
=== OPENSCAD SYNTAX RULES ===
|
|
23
|
-
${promptRules}
|
|
24
|
-
=============================
|
|
25
|
-
|
|
26
|
-
2. Rust Bevy Project Files:
|
|
27
|
-
- Create the necessary files for a modern Rust Bevy engine application (e.g., \`Cargo.toml\`, \`build.rs\`, \`src/main.rs\`).
|
|
28
|
-
- In \`Cargo.toml\`, include \`bevy\` as a dependency.
|
|
29
|
-
- You MUST include this EXACT \`build.rs\` script at the root of the project to automatically compile the \`.scad\` files into \`.glb\` format inside the \`assets/models\` folder before running the game via Cargo:
|
|
30
|
-
\`\`\`rust
|
|
31
|
-
use std::process::Command;
|
|
32
|
-
|
|
33
|
-
fn main() {
|
|
34
|
-
// Tell Cargo to re-run this script only if the 'scad' directory changes
|
|
35
|
-
println!("cargo::rerun-if-changed=scad");
|
|
36
|
-
|
|
37
|
-
// Ensure cross-platform compatibility for npm global binaries
|
|
38
|
-
let cmd = if cfg!(target_os = "windows") {
|
|
39
|
-
"scad-convert.cmd"
|
|
40
|
-
} else {
|
|
41
|
-
"scad-convert"
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
let status = Command::new(cmd)
|
|
45
|
-
.args(["./scad", "./assets/models", "--cache"])
|
|
46
|
-
.status()
|
|
47
|
-
.expect("Failed to execute scad-convert. Is scad-gltf installed globally?");
|
|
48
|
-
|
|
49
|
-
if !status.success() {
|
|
50
|
-
panic!("scad-convert failed with status: {}", status);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
\`\`\`
|
|
54
|
-
- Write the core application logic in \`src/main.rs\` to load and display the converted \`.glb\` files interactively. Provide standard Bevy game systems (camera, lights, movement, etc.).
|
|
55
|
-
|
|
56
|
-
3. Delivery Format (Single Node.js Script):
|
|
57
|
-
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
58
|
-
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using a slugified version of the project name) and output all files and folders inside this newly created project folder.
|
|
59
|
-
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
60
|
-
- The script must embed and write:
|
|
61
|
-
- Your generated \`.scad\` 3D assets.
|
|
62
|
-
- Your generated Rust Bevy project files (\`Cargo.toml\`, \`build.rs\`, \`src/main.rs\`).
|
|
63
|
-
- Ensure all string file contents inside the Node.js script are properly escaped.`,
|
|
64
|
-
buildInputRequest: (task) =>
|
|
65
|
-
`Design and implement a Rust Bevy engine game for the following concept: "${task}"`,
|
|
66
|
-
allowedTools: ["render_scad_model", "compile_bevy_project"],
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Execute and handle unhandled runtime errors
|
|
71
|
-
main().catch((err) => {
|
|
72
|
-
console.error("An unexpected error occurred:", err);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
});
|
package/bin/scad-gen.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { runCliApp } from "../src/cli-utils.js";
|
|
4
|
-
|
|
5
|
-
async function main() {
|
|
6
|
-
await runCliApp({
|
|
7
|
-
projectType: "gen",
|
|
8
|
-
buildSystemPrompt: () =>
|
|
9
|
-
`You are an expert procedural 3D technical artist and OpenSCAD developer.
|
|
10
|
-
Your goal is to generate a single OpenSCAD (.scad) file based on the user's request.
|
|
11
|
-
|
|
12
|
-
CRITICAL WORKFLOW:
|
|
13
|
-
1. Write the OpenSCAD code using the custom syntax rules provided in the request.
|
|
14
|
-
2. Call the \`render_scad_model\` tool with your code to visually verify your design.
|
|
15
|
-
3. If the model looks incorrect, adjust your code and re-render. Iterate until perfect.
|
|
16
|
-
4. Provide your final OpenSCAD code in a standard markdown block (\`\`\`openscad).`,
|
|
17
|
-
allowedTools: ["render_scad_model"],
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Execute and handle unhandled runtime errors
|
|
22
|
-
main().catch((err) => {
|
|
23
|
-
console.error("An unexpected error occurred:", err);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
});
|
package/bin/scad-godot.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import url from "node:url";
|
|
6
|
-
import { runCliApp } from "../src/cli-utils.js";
|
|
7
|
-
|
|
8
|
-
const __filename = url.fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
const DIR = path.resolve(__dirname, "..");
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await runCliApp({
|
|
14
|
-
projectType: "godot",
|
|
15
|
-
buildSystemPrompt: (promptRules, options) => {
|
|
16
|
-
const hasUserScadFiles =
|
|
17
|
-
Array.isArray(options.scadFiles) && options.scadFiles.length > 0;
|
|
18
|
-
|
|
19
|
-
const systemPrompt = `You are an expert Godot 4 game developer and procedural 3D technical artist.
|
|
20
|
-
|
|
21
|
-
NAMING CONVENTION REQUIREMENT:
|
|
22
|
-
- All generated files, directories, models, scripts, scenes, and root folders MUST strictly use snake_case (lowercase with underscores, e.g. \`player_character.gd\`, \`main_scene.tscn\`, \`enemy_walker.scad\`).
|
|
23
|
-
- NEVER use hyphens/minus signs (\`-\`) or spaces in any file or folder names.
|
|
24
|
-
|
|
25
|
-
What to generate:
|
|
26
|
-
1. 3D Game Assets (.scad):
|
|
27
|
-
- Generate procedural 3D models for the game using OpenSCAD.
|
|
28
|
-
- Scale & Units: 1 OpenSCAD unit = 1 Godot meter. Design your models using realistic meter-based scales (e.g., a character should be ~1.8 units tall). DO NOT use millimeter-based scaling.
|
|
29
|
-
- Coordinate System & Forward Convention: Write standard OpenSCAD Z-up code (+Z is UP, XY plane is ground). Build objects standing upright and facing Front (Positive Y-axis).
|
|
30
|
-
- Left/Right Convention: Always name and position "left" and "right" components (e.g., LeftArm, RightEye) based on the object's anatomical point of view (facing Forward towards +Y), NOT the camera/viewer's screen perspective. Because the object faces +Y, the object's Left side is along the -X axis, and the object's Right side is along the +X axis.
|
|
31
|
-
- CRITICAL Coordinate Mapping: The SCAD to glTF converter used by the Godot importer automatically converts OpenSCAD's Z-up coordinate system to Godot's Y-up coordinate system. Design your models naturally in OpenSCAD using this exact mapping:
|
|
32
|
-
* OpenSCAD +X (Right) -> Godot +X (Right)
|
|
33
|
-
* OpenSCAD -X (Left) -> Godot -X (Left)
|
|
34
|
-
* OpenSCAD +Y (Forward) -> Godot -Z (Forward)
|
|
35
|
-
* OpenSCAD -Y (Back) -> Godot +Z (Back)
|
|
36
|
-
* OpenSCAD +Z (Up) -> Godot +Y (Up)
|
|
37
|
-
DO NOT manually apply root rotations (e.g., \`rotate([90, 0, 0])\`) to compensate for Godot.
|
|
38
|
-
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
39
|
-
|
|
40
|
-
=== OPENSCAD SYNTAX RULES ===
|
|
41
|
-
${promptRules}
|
|
42
|
-
=============================
|
|
43
|
-
|
|
44
|
-
2. Godot 4 Project Files:
|
|
45
|
-
- Create the necessary GDScript (\`.gd\`) and scene (\`.tscn\`) files to implement the game logic, responsive player input controls, and a core gameplay loop.
|
|
46
|
-
- The scenes should directly instance the generated \`.scad\` files (the provided addon will handle importing them as 3D scenes).
|
|
47
|
-
- GDScript Coordinate, Forward, and Left/Right Conventions:
|
|
48
|
-
* Forward is -Z: In Godot, \`Vector3.FORWARD\` is \`Vector3(0, 0, -1)\`. A 3D node's local forward direction is \`-transform.basis.z\` (or \`-global_transform.basis.z\`). In character movement, forward input (e.g., W or ui_up) must translate along \`-transform.basis.z\`. Never treat +Z as forward.
|
|
49
|
-
* Backward is +Z: \`Vector3.BACK\` is \`Vector3(0, 0, 1)\` (\`transform.basis.z\`).
|
|
50
|
-
* Right is +X: \`Vector3.RIGHT\` is \`Vector3(1, 0, 0)\` (\`transform.basis.x\`).
|
|
51
|
-
* Left is -X: \`Vector3.LEFT\` is \`Vector3(-1, 0, 0)\` (\`-transform.basis.x\`).
|
|
52
|
-
* Left/Right Convention in Godot Script: Maintain anatomical consistency in scripts—character Right is along +X (\`transform.basis.x\`) and character Left is along -X (\`-transform.basis.x\`).
|
|
53
|
-
* Natural Model Alignment: Because OpenSCAD models face +Y (Forward), they automatically import facing Godot's Forward direction (-Z). Built-in Godot methods like \`look_at()\` orient the node's -Z axis toward the target, which perfectly aligns with the model's front. Do NOT apply compensation rotations (e.g., \`rotate_y(PI)\`) in GDScript to compensate for model orientation.
|
|
54
|
-
- Generate a \`project.godot\` file. It must configure the project and automatically enable the \`scad_importer\` plugin.
|
|
55
|
-
- Generate a \`.gitignore\` file that ignores the \`.godot/\` folder.
|
|
56
|
-
- Generate a \`README.md\` file that documents the project, gameplay mechanics, and controls.
|
|
57
|
-
|
|
58
|
-
3. Delivery Format (Single Node.js Script):
|
|
59
|
-
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
60
|
-
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using snake_case with underscores, e.g., \`my_game_project\`) and output all files and folders inside this newly created project folder.
|
|
61
|
-
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
62
|
-
- The script must embed and write:
|
|
63
|
-
- Your generated \`.scad\` game assets.
|
|
64
|
-
- Your generated Godot project files.
|
|
65
|
-
- The exact source code of the provided \`addons/scad_importer/*\` files, placed in their correct respective paths.${
|
|
66
|
-
hasUserScadFiles
|
|
67
|
-
? "\n - The exact source code of the provided user `.scad` files, placed in the appropriate project folders."
|
|
68
|
-
: ""
|
|
69
|
-
}
|
|
70
|
-
- Ensure all string file contents inside the Node.js script are properly escaped.
|
|
71
|
-
- TESTING CAPABILITY: You have access to the \`test_godot_project\` tool. If you want to verify your code before outputting your final response, you can pass your complete generated Node.js script as the \`nodejs_script\` parameter. The server will execute it in a temporary folder and run the Godot tests automatically.`;
|
|
72
|
-
|
|
73
|
-
// Gather Addon Files content
|
|
74
|
-
const addonDir = path.join(DIR, "godot", "addons", "scad_importer");
|
|
75
|
-
let addonFiles = [];
|
|
76
|
-
try {
|
|
77
|
-
if (fs.existsSync(addonDir)) {
|
|
78
|
-
const files = fs.readdirSync(addonDir);
|
|
79
|
-
for (const file of files) {
|
|
80
|
-
const fullPath = path.join(addonDir, file);
|
|
81
|
-
if (
|
|
82
|
-
fs.statSync(fullPath).isFile() &&
|
|
83
|
-
(file.endsWith(".gd") || file.endsWith(".cfg"))
|
|
84
|
-
) {
|
|
85
|
-
addonFiles.push(fullPath);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} catch (e) {
|
|
90
|
-
console.error("Warning: Could not read addon directory.", e);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let systemClipboardOutput = `${systemPrompt}\n\n`;
|
|
94
|
-
|
|
95
|
-
for (const file of addonFiles) {
|
|
96
|
-
try {
|
|
97
|
-
const content = fs.readFileSync(file, "utf-8").replace(/\r\n/g, "\n");
|
|
98
|
-
const relativePath = path.relative(DIR, file).replace(/\\/g, "/");
|
|
99
|
-
const lang = file.endsWith(".gd") ? "gdscript" : "text";
|
|
100
|
-
systemClipboardOutput += `### ${relativePath}\n---\n\`\`\`${lang}\n${content}\n\`\`\`\n\n`;
|
|
101
|
-
} catch (e) {
|
|
102
|
-
console.error(
|
|
103
|
-
`Warning: Skipping '${file}'. It is not a readable file.`,
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (hasUserScadFiles) {
|
|
109
|
-
systemClipboardOutput += `=== USER PROVIDED OPENSCAD FILES ===\n`;
|
|
110
|
-
systemClipboardOutput += `The following .scad files are provided as reference or base assets. You MUST embed and write them into the generated project, modifying them if necessary to fit the game logic.\n\n`;
|
|
111
|
-
for (const file of options.scadFiles) {
|
|
112
|
-
try {
|
|
113
|
-
const content = fs
|
|
114
|
-
.readFileSync(file, "utf-8")
|
|
115
|
-
.replace(/\r\n/g, "\n");
|
|
116
|
-
const relativePath = path.isAbsolute(file)
|
|
117
|
-
? path.relative(process.cwd(), file).replace(/\\/g, "/")
|
|
118
|
-
: file.replace(/\\/g, "/");
|
|
119
|
-
systemClipboardOutput += `### ${relativePath}\n---\n\`\`\`openscad\n${content}\n\`\`\`\n\n`;
|
|
120
|
-
} catch (e) {
|
|
121
|
-
console.error(
|
|
122
|
-
`Warning: Skipping user SCAD file '${file}'. It is not a readable file.`,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return systemClipboardOutput.trimEnd() + "\n";
|
|
129
|
-
},
|
|
130
|
-
buildInputRequest: (task) =>
|
|
131
|
-
`Design and implement a Godot 4 project for the following game concept: "${task}"`,
|
|
132
|
-
allowedTools: ["render_scad_model", "test_godot_project"],
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Execute and handle unhandled runtime errors
|
|
137
|
-
main().catch((err) => {
|
|
138
|
-
console.error("An unexpected error occurred:", err);
|
|
139
|
-
process.exit(1);
|
|
140
|
-
});
|
package/bin/scad-web.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { runCliApp } from "../src/cli-utils.js";
|
|
4
|
-
|
|
5
|
-
async function main() {
|
|
6
|
-
await runCliApp({
|
|
7
|
-
projectType: "web",
|
|
8
|
-
buildSystemPrompt: (
|
|
9
|
-
promptRules,
|
|
10
|
-
) => `You are an expert Web 3D developer and procedural 3D technical artist.
|
|
11
|
-
|
|
12
|
-
What to generate:
|
|
13
|
-
1. 3D Web Assets (.scad):
|
|
14
|
-
- Generate procedural 3D models for the game using OpenSCAD.
|
|
15
|
-
- CRITICAL: The SCAD to glTF converter automatically converts OpenSCAD's Z-up coordinate system to the standard glTF Y-up coordinate system. Design your models naturally in OpenSCAD.
|
|
16
|
-
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
17
|
-
|
|
18
|
-
=== OPENSCAD SYNTAX RULES ===
|
|
19
|
-
${promptRules}
|
|
20
|
-
=============================
|
|
21
|
-
|
|
22
|
-
2. Vite Web Project Files (npm based):
|
|
23
|
-
- Create the necessary files for a modern web application (e.g., \`package.json\`, \`index.html\`, \`main.js\`).
|
|
24
|
-
- You can use ANY web 3D library with glTF support (e.g., Three.js, Babylon.js, @google/model-viewer, PlayCanvas, A-Frame, etc.) that fits the game's requirements.
|
|
25
|
-
- In \`package.json\`, you MUST include the scad to gltf converter tool as a dev dependency:
|
|
26
|
-
\`"scad-gltf": "^0.1.0"\`
|
|
27
|
-
- In \`package.json\`, add npm scripts to automatically compile the \`.scad\` files into \`.glb\` format inside the \`public/\` folder before Vite runs its dev or build steps.
|
|
28
|
-
For example:
|
|
29
|
-
\`"predev": "scad-convert ./scad ./public/models --cache"\`
|
|
30
|
-
\`"prebuild": "scad-convert ./scad ./public/models --cache"\`
|
|
31
|
-
- Write the core game logic to load and display the converted \`.glb\` files interactively.
|
|
32
|
-
|
|
33
|
-
3. Delivery Format (Single Node.js Script):
|
|
34
|
-
- Output exactly ONE self-contained Node.js script. Do not output manual setup instructions.
|
|
35
|
-
- CRITICAL: The generated Node.js script MUST first create a root project folder (named using a slugified version of the project name) and output all files and folders inside this newly created project folder.
|
|
36
|
-
- When executed, this script must programmatically create the entire project directory structure and write all the files to disk using the \`fs\` module.
|
|
37
|
-
- The script must embed and write:
|
|
38
|
-
- Your generated \`.scad\` 3D assets.
|
|
39
|
-
- Your generated Vite web project files.
|
|
40
|
-
- Ensure all string file contents inside the Node.js script are properly escaped.`,
|
|
41
|
-
buildInputRequest: (task) =>
|
|
42
|
-
`Design and implement a web-based 3D glTF game using Vite for the following concept: "${task}"`,
|
|
43
|
-
allowedTools: ["render_scad_model"],
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Execute and handle unhandled runtime errors
|
|
48
|
-
main().catch((err) => {
|
|
49
|
-
console.error("An unexpected error occurred:", err);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
package/godot/examples/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Ilia Grigorev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/godot/examples/README.md
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# AI-Generated Godot Examples
|
|
2
|
-
|
|
3
|
-
This folder contains a collection of **all-in-one Node.js scripts**, each representing a complete, playable 3D Godot 4 game generated entirely by AI using the `scad-godot` CLI tool.
|
|
4
|
-
|
|
5
|
-
Instead of committing messy project folders, each example is bundled into a single, self-extracting JavaScript file. These scripts contain the generated OpenSCAD (`.scad`) 3D assets, Godot scripts (`.gd`), Godot scenes (`.tscn`), and the required `scad_importer` addon needed to parse the SCAD files directly in the engine.
|
|
6
|
-
|
|
7
|
-
**🕹️ Play Online in Your Browser (No Installation Required):**
|
|
8
|
-
👉 **[https://iliagrigorevdev.github.io/scad-godot/](https://iliagrigorevdev.github.io/scad-godot/)**
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 🚀 How to Play the Examples
|
|
13
|
-
|
|
14
|
-
To test out an example, you need to extract it and open it in Godot 4. The Godot importer relies on the `scad-gltf` tools to compile the 3D OpenSCAD scripts into binary meshes.
|
|
15
|
-
|
|
16
|
-
Depending on your operating system and environment, there are two ways to handle this.
|
|
17
|
-
|
|
18
|
-
### Prerequisites
|
|
19
|
-
|
|
20
|
-
- **Node.js** installed on your system.
|
|
21
|
-
- **Godot 4.x** installed on your system.
|
|
22
|
-
|
|
23
|
-
### Step 1: Extract the Project
|
|
24
|
-
|
|
25
|
-
Open your terminal in this folder and execute the desired example script using Node.js:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
node my_example_game.js
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
_The script will automatically create a new folder (e.g., `./my-example-game`) containing the full Godot project directory structure, saving all the assets and addon files to disk._
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
### Step 2: Compile Models & Open Godot
|
|
36
|
-
|
|
37
|
-
Choose the method that best fits your environment:
|
|
38
|
-
|
|
39
|
-
#### Option A: Standard Desktop (Global Install)
|
|
40
|
-
|
|
41
|
-
If you are on a standard Windows, macOS, or Linux desktop, the easiest way is to have the CLI globally installed. The Godot plugin will automatically find and use the `scad-convert` command.
|
|
42
|
-
|
|
43
|
-
1. Install the tool globally:
|
|
44
|
-
```bash
|
|
45
|
-
npm install -g scad-gltf
|
|
46
|
-
```
|
|
47
|
-
2. Launch **Godot 4**.
|
|
48
|
-
3. Click **Import** in the Project Manager, browse to the generated folder, and select the `project.godot` file.
|
|
49
|
-
4. Click **Import & Edit**. The addon will automatically compile the `.scad` files in the background.
|
|
50
|
-
|
|
51
|
-
#### Option B: Termux / Android / Restricted Environments (Backend Server)
|
|
52
|
-
|
|
53
|
-
In some environments (like running Godot directly on an Android device via Termux), the Godot engine cannot easily execute globally installed NPM CLI binaries. To solve this, you can run `scad-serve` as a local backend server. The Godot importer will automatically detect it and use its REST API to convert the 3D models.
|
|
54
|
-
|
|
55
|
-
1. Open your terminal and navigate into the newly extracted project folder:
|
|
56
|
-
```bash
|
|
57
|
-
cd my-example-game
|
|
58
|
-
```
|
|
59
|
-
2. Start the local server:
|
|
60
|
-
```bash
|
|
61
|
-
npx -p scad-gltf scad-serve
|
|
62
|
-
```
|
|
63
|
-
_(This starts a local backend server on port 3000)._
|
|
64
|
-
3. Leave the server running in the background.
|
|
65
|
-
4. Launch **Godot 4**, import the project, and open it. The `scad_importer` addon will ping your local `scad-serve` backend to compile the `.scad` files over HTTP.
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
### Step 3: Play the Game
|
|
70
|
-
|
|
71
|
-
Once the Godot Editor opens and finishes importing the 3D scenes:
|
|
72
|
-
|
|
73
|
-
- Press **F5** (or click the Play button in the top right) to run the game!
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 🛠️ How were these generated?
|
|
78
|
-
|
|
79
|
-
These files were created using this repository's built-in AI prompt pipeline. By running the `scad-godot` CLI command, the system instructs an LLM (like Claude, Gemini, or ChatGPT) to generate procedural OpenSCAD geometry, gameplay logic, and scene configurations, outputting them as a single JS extractor script.
|
|
80
|
-
|
|
81
|
-
If you want to generate your own games, run:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
scad-godot "A simple 3D platformer where you control a rolling ball collecting coins"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
_(See the main repository documentation for full details on generating your own AI projects)._
|
|
88
|
-
|
|
89
|
-
## 📜 License
|
|
90
|
-
|
|
91
|
-
These examples and their generated Godot project assets are licensed under the [MIT License](LICENSE).
|