Skip to content

Commit 2a170c2

Browse files
committed
fixes for empty gltf scene to process correctly
1 parent e9acef7 commit 2a170c2

File tree

4 files changed

+151
-202
lines changed

4 files changed

+151
-202
lines changed

CLAUDE.md

Lines changed: 40 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -8,142 +8,69 @@ This is a consumer-processor service for Decentraland that processes deployments
88

99
## Essential Commands
1010

11-
### Development
1211
```bash
13-
# Install dependencies
14-
npm install
15-
16-
# Build TypeScript
17-
npm run build
18-
19-
# Run linter
20-
npm run lint:check
21-
npm run lint:fix
22-
23-
# Run tests
24-
npm test
25-
26-
# Run a specific test
27-
npm test -- test/unit/ping-controller.spec.ts
12+
npm install # Install dependencies
13+
npm run build # Build TypeScript
14+
npm run lint:check # Run linter
15+
npm run lint:fix # Fix lint issues
16+
npm test # Run all tests
17+
npm test -- test/unit/ping-controller.spec.ts # Run specific test
18+
npm start # Start service (requires built dist/)
19+
PROCESS_METHOD=godot_optimizer npm start # Start with specific runner
2820
```
2921

30-
### Running Services
22+
### Docker Operations (run.sh)
3123

32-
Using the run.sh script:
3324
```bash
34-
# Build and run a specific runner
35-
./run.sh --build godot-optimizer
36-
./run.sh --build godot-runner
37-
./run.sh --build crdt-runner
38-
39-
# Build for multiple architectures (ARM64 + AMD64)
40-
./run.sh --build --multiarch godot-optimizer
41-
42-
# Run without building
43-
./run.sh godot-optimizer
44-
45-
# Pass additional options
46-
./run.sh godot-optimizer --option key value
47-
```
48-
49-
Direct execution:
50-
```bash
51-
# Start the service (requires built dist/)
52-
npm start
53-
54-
# With specific process method
55-
PROCESS_METHOD=godot_optimizer npm start
25+
./run.sh --build godot-optimizer # Build and run
26+
./run.sh --build --multiarch godot-optimizer # Build for ARM64 + AMD64
27+
./run.sh godot-optimizer # Run without building
5628
```
5729

5830
### Environment Configuration
5931

60-
Create a `.env` file based on `.env.default`. Key environment variables:
61-
- `PROCESS_METHOD`: One of `log`, `godot_minimap`, `godot_optimizer`, `generate_crdt`, `generate_imposters`
62-
- `AWS_REGION`: AWS region for SQS/S3
63-
- `TASK_QUEUE`: SQS queue URL
64-
- `BUCKET`: S3 bucket name for storage
65-
- `GODOT4_EDITOR`: Path to Godot editor (defaults to /usr/local/bin/godot in containers)
32+
Create `.env` from `.env.default`. Key variables:
33+
- `PROCESS_METHOD`: `log`, `godot_minimap`, `godot_optimizer`, `generate_crdt`, `generate_imposters`
34+
- `TASK_QUEUE`: SQS URL (if unset, uses in-memory queue)
35+
- `BUCKET`: S3 bucket (if unset, uses local `./storage`)
36+
- `GODOT4_EDITOR`: Path to Godot (default: `/usr/local/bin/godot` in containers)
6637

6738
## Architecture
6839

69-
### Core Components
40+
### Dependency Injection Pattern
7041

71-
1. **Service Layer** (`src/service.ts`): Main entry point that wires components and starts the processing loop based on `PROCESS_METHOD`
42+
Uses `@well-known-components` framework. Components defined in `src/components.ts` with interfaces in `src/types.ts`. All adapters implement standard interfaces allowing swap between AWS services and local mocks via environment variables.
7243

73-
2. **Runners** (`src/runners/`): Different processing pipelines
74-
- `godot-optimizer/`: Asset optimization using Godot engine
75-
- `minimap-generator/`: Scene minimap generation
76-
- `crdt-runner/`: CRDT file generation from deployments
77-
- `imposter-runner/`: Imposter mesh generation
44+
### Core Structure
7845

79-
3. **Adapters** (`src/adapters/`): External service integrations
80-
- `sqs.ts`: AWS SQS queue consumer/publisher
81-
- `storage.ts`: S3 or local file storage
82-
- `sns.ts`: AWS SNS notifications
83-
- `runner.ts`: Task runner management
84-
85-
4. **Components** (`src/components.ts`): Dependency injection setup using well-known-components pattern
46+
- **`src/service.ts`**: Main processing loop, routes messages to runners based on `PROCESS_METHOD`
47+
- **`src/adapters/`**: External integrations (SQS, S3, SNS) with dual implementations (AWS + local/memory)
48+
- **`src/runners/`**: Processing pipelines (godot-optimizer, minimap-generator, crdt-runner, imposter-runner)
8649

8750
### Processing Flow
8851

89-
1. Service polls SQS queue for deployment messages
90-
2. Based on `PROCESS_METHOD`, routes to appropriate runner
91-
3. Runner downloads assets from content server
92-
4. Processes assets (optimize, generate minimap, etc.)
93-
5. Uploads results to S3/storage
94-
6. Publishes completion notification to SNS
52+
1. Service polls SQS (or memory queue) for `DeploymentToSqs` messages
53+
2. Routes to runner based on `PROCESS_METHOD`
54+
3. Runner downloads assets from content server, processes them
55+
4. Uploads results to S3/storage
56+
5. Publishes completion to SNS, reports to monitoring service
9557

9658
### Docker Architecture
9759

98-
The project supports multi-architecture builds (AMD64 and ARM64):
99-
- AMD64: Uses Decentraland's fork of Godot 4.4.1
100-
- ARM64: Uses official Godot 4.4.1 release
101-
102-
Three main Docker configurations:
103-
- `dependencies/godot-asset-optimizer-project/`: Asset optimization service
104-
- `dependencies/godot-runner/`: Godot explorer runner
105-
- `dependencies/crdt-runner/`: CRDT generation service
106-
107-
## Key Implementation Details
108-
109-
### Godot Integration
110-
- Godot runs in headless mode using Xvfb virtual display
111-
- Communicates via file system and exit codes
112-
- Timeout handling for long-running operations
113-
114-
### Queue Processing
115-
- Messages contain deployment entity IDs and content server URLs
116-
- Supports both memory queue (for testing) and AWS SQS
117-
- Automatic retry and error handling
60+
Multi-architecture builds (AMD64/ARM64) in `dependencies/`:
61+
- `godot-asset-optimizer-project/`: Godot 4.5.1 (dclexplorer fork for AMD64, official for ARM64)
62+
- `godot-runner/`: Godot 4.4.1 (Decentraland fork for AMD64, official for ARM64)
63+
- `crdt-runner/`: Node.js only (no Godot)
11864

119-
### Storage Abstraction
120-
- Supports both S3 and local file system storage
121-
- Consistent interface via `IStorageComponent`
65+
Godot runs headless using Xvfb virtual display.
12266

123-
### Testing
124-
- Unit tests in `test/unit/`
125-
- Integration tests in `test/integration/`
126-
- Component mocking via `test/components.ts`
67+
## Adding a New Runner
12768

128-
## Common Development Tasks
69+
1. Create directory in `src/runners/`
70+
2. Implement async function matching signature: `(components, job, message) => Promise<void>`
71+
3. Add to `validProcessMethods` array in `src/service.ts`
72+
4. Add case in main processing switch statement
12973

130-
### Adding a New Runner
131-
1. Create new directory in `src/runners/`
132-
2. Implement runner function matching signature in `src/service.ts`
133-
3. Add to `validProcessMethods` array
134-
4. Wire in main processing loop
135-
136-
### Debugging Docker Builds
137-
```bash
138-
# Check architecture-specific build
139-
docker buildx build --platform linux/arm64 -f dependencies/godot-optimizer/Dockerfile .
140-
141-
# Run with entrypoint override for debugging
142-
docker run --rm --entrypoint /bin/bash -it godot-optimizer:latest
143-
144-
# Check Godot installation
145-
docker run --rm --entrypoint /usr/local/bin/godot godot-optimizer:latest --version
146-
```
74+
## Entity ID Resolution
14775

148-
### Working with Entity IDs
149-
The service supports both direct entity IDs and pointer resolution. If an entity ID contains a comma, it's treated as a pointer and resolved via the content server API.
76+
The service supports direct entity IDs and pointer resolution. If entity ID contains a comma, it's treated as a pointer and resolved via content server API.

dependencies/godot-asset-optimizer-project/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ set -m
55

66
/usr/bin/Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
77
export DISPLAY=:99
8-
/usr/bin/node --enable-source-maps --trace-warnings --abort-on-uncaught-exception --unhandled-rejections=strict dist/index.js
8+
/usr/bin/node --enable-source-maps --trace-warnings --abort-on-uncaught-exception --unhandled-rejections=strict dist/index.js "$@"
99

1010
fg %1

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)