You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+78-14Lines changed: 78 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,17 @@ Tiny is a Kotlin Multiplatform game engine with Lua scripting support that compi
28
28
```bash
29
29
./gradlew build # Build all modules
30
30
./gradlew test# Run all tests
31
-
./gradlew publishToMavenLocal # Deploy to local maven
31
+
./gradlew publishToMavenLocal # Deploy to local maven (also: make deploy)
32
+
./gradlew clean # Clean build artifacts
33
+
```
34
+
35
+
### Testing
36
+
```bash
37
+
./gradlew test# Run all tests
38
+
./gradlew :tiny-engine:test # Run tests for specific module
39
+
./gradlew :tiny-engine:commonTest # Run common multiplatform tests
40
+
./gradlew :tiny-engine:jvmTest # Run JVM-specific tests
41
+
./gradlew :tiny-engine:jsTest # Run JS-specific tests
32
42
```
33
43
34
44
### Linting
@@ -37,22 +47,36 @@ make lint # or ./gradlew ktlintCheck
37
47
make lintfix # or ./gradlew ktlintFormat
38
48
```
39
49
40
-
### CLI Installation
50
+
### CLI Development
41
51
```bash
42
52
make install # Build and install CLI to ~/.bin/tiny-cli
53
+
./gradlew :tiny-cli:assembleDist # Build CLI distribution
54
+
```
55
+
56
+
### Documentation Generation
57
+
```bash
58
+
make docs # Generate full documentation (requires CLI install)
59
+
./gradlew asciidoctor # Generate docs only
43
60
```
44
61
45
-
### Documentation
62
+
### CLI Commands (after installation)
46
63
```bash
47
-
make docs # Generate documentation (requires CLI install)
64
+
tiny-cli create <name># Create new game project
65
+
tiny-cli run # Run game in current directory
66
+
tiny-cli debug # Run with debugger
67
+
tiny-cli serve # Dev server with hot reload
68
+
tiny-cli export# Export for web deployment
69
+
tiny-cli sfx # Sound effect editor
70
+
tiny-cli add # Add resources to project
71
+
tiny-cli palette # Generate color palettes
48
72
```
49
73
50
74
## Architecture Details
51
75
52
76
### Platform Abstraction
53
77
The engine uses a Platform interface to abstract platform-specific functionality:
54
-
-`GlfwPlatform` for desktop (LWJGL/GLFW)
55
-
-`WebGlPlatform` for web (WebGL)
78
+
-`GlfwPlatform` for desktop (LWJGL/GLFW). It uses OpenGL 3.
79
+
-`WebGlPlatform` for web (WebGL). It uses WebGL 2.0.
56
80
57
81
### Resource Management
58
82
Games are structured around:
@@ -69,22 +93,61 @@ The engine exposes functionality through organized Lua libraries:
69
93
-`ctrl`: Input handling
70
94
-`map`: Level/tilemap operations
71
95
72
-
### Build Artifacts
96
+
### Open GL Organization
97
+
The engine use 2 stages of rendering:
98
+
- tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/render/gl/SpriteBatchStage.kt : it renders everything in a framebuffer at a lower resolution.
99
+
- tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/render/gl/FrameBufferStage.kt : it renders the framebuffer from the previous stage at the screen resolution.
- tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/render/shader/ShaderParameter.kt (manager shader program parameters)
103
+
- the shader program is created, alongside the shader program parameters. These parameters are created in Kotlin and added in the shader source code program.
104
+
- The shader program parameters can be configured using the method `setup` to access the vertex and fragment shader.
105
+
- before draw, the `blind` is called. `unbind` is called after.
106
+
- fragColor is added automatically as out vec4 in FragmentShader (See tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/render/shader/BaseShader.kt)
107
+
- #version is added automatically in the shader program source code (See tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/render/shader/BaseShader.kt)
108
+
109
+
### Build Artifacts & Tasks
73
110
The build produces several specialized artifacts:
74
111
-`tinyWebEngine`: JS engine for web deployment
75
-
-`tinyApiAsciidoctor`: Generated API documentation
112
+
-`tinyApiAsciidoctor`: Generated API documentation
76
113
-`tinyApiLuaStub`: Lua API stubs
77
114
-`tinyResources`: Packaged engine resources
78
115
116
+
Key Gradle tasks:
117
+
-`tiny-web-editor:tinyWebEditor`: Builds web editor interface
118
+
-`assembleDist`: Creates CLI distribution zip
119
+
-`asciidoctor`: Generates documentation using generated content
120
+
121
+
## Performance Considerations
122
+
123
+
### Critical Performance Areas
124
+
-**Input handling**: LWJGL input system can be slower than WebGL due to cursor position polling
125
+
-**Lua wrapper creation**: Frequent `WrapperLuaTable` creation in SfxLib can impact performance
126
+
-**Resource loading**: Hot-reload monitors file changes for rapid development iteration
127
+
128
+
### Platform-Specific Optimizations
129
+
-**Desktop (LWJGL)**: Uses cursor position caching to avoid expensive `glfwGetCursorPos()` calls
130
+
-**Web (WebGL)**: Generally more responsive for UI interactions due to different input handling
131
+
79
132
## Development Workflow
80
133
81
-
1. Engine changes go in `tiny-engine/src/commonMain/kotlin`
82
-
2. CLI commands are in `tiny-cli/src/main/kotlin/com/github/minigdx/tiny/cli/command/`
83
-
3. Lua API libraries are in `tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/`
84
-
4. Tests follow the pattern `src/commonTest/kotlin` for shared tests
85
-
5. Platform-specific code uses `src/jvmMain` and `src/jsMain` directories
0 commit comments