Session 3: Tree Variety System Complete

TREE VARIETIES IMPLEMENTED:
- Added 5 tree types: Cherry, Oak, Pine, Dead, Apple
- AI-generated PNG sprites with transparent backgrounds
- Random tree selection for natural diversity
- Growth scaling (0.4-0.6x for variety)

 VISUAL IMPROVEMENTS:
- 2.5D depth sorting (Y-position based)
- Proper shadows matching tree size
- Layered rendering for perspective

 TRANSPARENCY FIXES:
- Disabled automatic sprite processing
- User manually removed green screen backgrounds
- Fixed pink/red color preservation
- Trees now render with proper transparency

 TREE DISTRIBUTION:
- Reduced from ~78 to 10 trees (87% reduction)
- Removed corner forest clusters (too crowded)
- Sparse scattered placement across 100x100 map
- Wider spacing (8-15 tiles apart)
- Small tree sizes (0.35-0.7x scale, ~50% reduction)

 TECHNICAL CHANGES:
- PreloadScene: Added tree sprite loading
- PreloadScene: Disabled processAllTransparency()
- Flat2DTerrainSystem: PNG sprite rendering with fallback
- map2d_data.js: Sparse tree generation
- Green removal threshold: g > 180 (preserves pink/red)

 FILES MODIFIED:
- src/scenes/PreloadScene.js
- src/systems/Flat2DTerrainSystem.js
- data/map2d_data.js
- assets/sprites/tree_*.png (5 new sprites)
- docs/DNEVNIK.md (updated with user availability)

Session: 1.5h (23:28-00:48)
Date: 14-15.12.2024
This commit is contained in:
2025-12-15 00:49:06 +01:00
parent c5d6c01305
commit 344fbc307d
20 changed files with 272 additions and 85 deletions

View File

@@ -48,36 +48,19 @@ const Map2DData = {
// this.addWindingPath(map, 10, 10, 90, 90); // Disabled
// this.addWindingPath(map, 90, 10, 10, 90); // Disabled
// 3. MORE TREES IN NATURAL CLUSTERS 🌳
// Top-left forest
this.addTreeCluster(map, 15, 15, 5);
this.addTreeCluster(map, 18, 12, 4);
this.addTreeCluster(map, 12, 18, 3);
// 3. SPARSE SCATTERED TREES 🌳 (NO CLUSTERS!)
// Removed all corner forests - too crowded!
// Top-right forest
this.addTreeCluster(map, 85, 15, 5);
this.addTreeCluster(map, 82, 18, 4);
this.addTreeCluster(map, 88, 12, 3);
// Bottom-left forest
this.addTreeCluster(map, 15, 85, 5);
this.addTreeCluster(map, 18, 82, 4);
this.addTreeCluster(map, 12, 88, 3);
// Bottom-right forest
this.addTreeCluster(map, 85, 85, 5);
this.addTreeCluster(map, 82, 88, 4);
this.addTreeCluster(map, 88, 82, 3);
// Scattered single trees - MANY MORE!
for (let i = 0; i < 50; i++) {
// Just a few scattered trees across entire map
for (let i = 0; i < 10; i++) { // VERY FEW! (was 15)
this.addTreeCluster(map,
10 + Math.random() * 80, // Wider spread
10 + Math.random() * 80, // Entire map
10 + Math.random() * 80,
1
1 // Single trees only
);
}
// 4. COLORFUL FLOWERS SCATTERED 🌸
this.addFlowers(map, 30);
@@ -187,7 +170,7 @@ const Map2DData = {
addTreeCluster: function (map, centerX, centerY, count) {
for (let i = 0; i < count; i++) {
const angle = (Math.PI * 2 * i) / count + Math.random() * 0.5;
const radius = 2 + Math.random() * 3;
const radius = 8 + Math.random() * 7; // EVEN WIDER! (was 5+7)
const tx = Math.floor(centerX + Math.cos(angle) * radius);
const ty = Math.floor(centerY + Math.sin(angle) * radius);