Tiled Map Editor Exploration + Bug Fixes

Tiled Setup:
- Installed Tiled v1.11.2 (winget)
- Created workflow documentation (.agent/workflows/tiled-map-setup.md)
- Generated demo Tiled map files (farm_map.tmx, .json, .tsx)
- Created TILED_INTEGRATION_STATUS.md documentation

 Bug Fixes:
- SaveSystem.js: Fixed compatibility with Flat2DTerrainSystem
- InteractionSystem.js: Added null checks for terrainSystem
- PreloadScene.js: Tiled asset loading (currently not used)

 Documentation:
- Created DNEVNIK.md (development diary)
- Updated QUICK_TASK_REFERENCE.md with recent work

 Note: Tiled integration incomplete (tileset size issues)
- Reverted to procedural Flat2DTerrainSystem (working)
- Future work: Create proper 192x192 tileset PNGs

Session: 2h (20:00-22:00)
Date: 14.12.2024
This commit is contained in:
2025-12-14 22:55:29 +01:00
parent 80bddf5d61
commit a4d2d137ec
20 changed files with 1248 additions and 186 deletions

View File

@@ -21,15 +21,17 @@ class SaveSystem {
y: npc.gridY
}));
// Zberi podatke o terenu
const terrainSeed = this.scene.terrainSystem.noise.seed;
// Zberi podatke o terenu - FLAT 2D (no seed, no crops yet!)
const terrainSeed = this.scene.terrainSystem.noise?.seed || 0; // Optional for old system
// Zberi dinamične podatke terena (Crops & Modified Decor/Buildings)
const cropsData = Array.from(this.scene.terrainSystem.cropsMap.entries());
// We only save Decorations that are NOT default?
// For simplicity, let's save ALL current decorations, and on Load clear everything and rebuild.
// Actually, decorationsMap contains objects with gridX, gridY, type.
const decorData = Array.from(this.scene.terrainSystem.decorationsMap.values());
// Flat2DTerrainSystem doesn't have cropsMap yet - skip for now
const cropsData = this.scene.terrainSystem.cropsMap
? Array.from(this.scene.terrainSystem.cropsMap.entries())
: [];
const decorData = this.scene.terrainSystem.decorationsMap
? Array.from(this.scene.terrainSystem.decorationsMap.values())
: [];
// Inventory
const inventoryData = {
@@ -38,13 +40,13 @@ class SaveSystem {
};
const saveData = {
version: 2.4, // Nazaj na pixel art
version: 2.5, // 2D Flat Version
timestamp: Date.now(),
player: { x: playerPos.x, y: playerPos.y },
terrain: {
seed: terrainSeed,
crops: cropsData, // array of [key, value]
decorations: decorData // array of objects
crops: cropsData,
decorations: decorData
},
npcs: npcsData,
inventory: inventoryData,