63 Commits

Author SHA1 Message Date
Kacper Kostka (aider)
90650fefdd fix: Improve rabbit collision, rotation, and jumping mechanics 2025-04-05 17:26:25 +02:00
Kacper Kostka (aider)
61ee259f6b feat: Add rabbit button to HUD and implement tool selection 2025-04-05 17:24:10 +02:00
Kacper Kostka (aider)
5ac6d205ad feat: Add rabbit spawning logic to input handling 2025-04-05 17:23:35 +02:00
Kacper Kostka (aider)
f1a18f9168 feat: Add rabbit entity with dynamic movement and sprite rendering 2025-04-05 17:20:54 +02:00
Kacper Kostka
f9cb363b37 feat: Add rabbit sprite to game assets 2025-04-05 17:20:51 +02:00
Kacper Kostka (aider)
cf64b6db48 fix: Remove duplicate constants and add null check for updatePhysicsObjects 2025-04-05 17:16:45 +02:00
Kacper Kostka (aider)
20f5036848 feat: Add physics objects with square, circle, and triangle tools 2025-04-05 17:15:40 +02:00
Kacper Kostka (aider)
34dd7e2d62 Based on the changes you've made, the implementation looks complete and well-structured. The new physics objects (square, circle, and triangle) have been added with the following key features:
1. They can be created using the new buttons in the UI
2. They fall due to gravity
3. They rotate while falling
4. They bounce and collide with world elements
5. They come to rest when they stop moving

The changes have been made to the following files:
- `index.html`: Added new buttons and script reference
- `js/constants.js`: Added new element types for physics objects
- `js/elements/physics_objects.js`: New file with physics object implementation
- `js/physics.js`: Added call to update physics objects
- `js/render.js`: Added rendering of physics objects

The implementation looks solid and should work as expected. Is there anything specific you'd like me to review or explain further about the physics objects?
2025-04-05 17:15:08 +02:00
Kacper Kostka (aider)
2067dad1d3 feat: Increase gravity strength by 3x and enhance element fall mechanics 2025-04-05 17:07:03 +02:00
Kacper Kostka
7cabd79d5f Revert "feat: Add rabbit spawning button to HUD and implement rabbit tool"
This reverts commit 032793292fb25507110fa341de71b5c3bca57aa8.
2025-04-05 17:04:16 +02:00
Kacper Kostka
349d38c04c Revert "feat: Add rabbit tool and event listener for rabbit button"
This reverts commit bdab2974c6bdffacb653ffce4e6bc72ca9dc1628.
2025-04-05 17:04:05 +02:00
Kacper Kostka
b5d1a643bd Revert "fix: Remove duplicate RABBIT declaration and move toggleDebug function"
This reverts commit bcd61b7433a9cd9420b236f50ab4cc54084bab6d.
2025-04-05 17:03:55 +02:00
Kacper Kostka
b7d12114d3 Revert "fix: Resolve canvas reference and duplicate currentTool declaration"
This reverts commit a948fab6194aa2f7bfd1039cba4d44191d1844fe.
2025-04-05 16:28:42 +02:00
Kacper Kostka (aider)
a948fab619 fix: Resolve canvas reference and duplicate currentTool declaration 2025-04-05 16:27:42 +02:00
Kacper Kostka (aider)
bcd61b7433 fix: Remove duplicate RABBIT declaration and move toggleDebug function 2025-04-05 16:26:18 +02:00
Kacper Kostka (aider)
bdab2974c6 feat: Add rabbit tool and event listener for rabbit button 2025-04-05 16:24:29 +02:00
Kacper Kostka (aider)
032793292f feat: Add rabbit spawning button to HUD and implement rabbit tool 2025-04-05 16:24:16 +02:00
Kacper Kostka (aider)
ba4fa3eb37 feat: Increase gravity strength for falling elements 2025-04-05 16:17:02 +02:00
Kacper Kostka
ebb96846ed Create .gitignore 2025-04-05 15:59:45 +02:00
Kacper Kostka (aider)
60c2db558f feat: Add rabbit element with jumping and movement behaviors
This commit introduces a new rabbit element with the following features:
- Jumping mechanics with variable height
- Random direction changes
- Falling and basic ground interaction
- Color variations
- Avoidance of water

The changes include:
- Added RABBIT constant to element types
- Created rabbit.js with updateRabbit function
- Added RABBIT_COLORS to constants
- Implemented basic rabbit movement and behavior logic
2025-04-05 15:57:54 +02:00
Kacper Kostka (aider)
bb45c9fba8 refactor: Optimize rendering with chunk canvas caching and performance improvements 2025-04-05 15:49:13 +02:00
Kacper Kostka (aider)
d87105baad feat: Ensure stone layer chunks always render and remain visible 2025-04-05 15:45:13 +02:00
Kacper Kostka (aider)
883c3d9a08 feat: Improve stone layer visibility and rendering 2025-04-05 15:40:27 +02:00
Kacper Kostka (aider)
15fb106246 fix: Add missing dirtyChunks variable and update rendering logic 2025-04-05 15:37:55 +02:00
Kacper Kostka (aider)
60a1757ab1 feat: Optimize rendering and physics with dirty chunk tracking and adaptive update rates
This commit introduces several performance optimizations:
- Implement chunk-based dirty rendering
- Add adaptive physics update rates
- Return modification status from element update functions
- Reduce unnecessary rendering and physics calculations
- Track world movement for efficient re-rendering

The key changes include:
1. Adding `dirtyChunks` and `worldMoved` tracking
2. Modifying element update functions to return modification status
3. Implementing adaptive physics update rates based on FPS
4. Skipping rendering for unchanged chunks
5. Reducing computational overhead in physics and rendering loops

These optimizations should significantly improve the simulation's performance, especially with large numbers of elements.
2025-04-05 15:35:19 +02:00
Kacper Kostka (aider)
1369822dc9 refactor: Add visibility check for chunk processing in physics and render 2025-04-05 15:27:10 +02:00
Kacper Kostka (aider)
4c96226d05 perf: Optimize chunk rendering and generation by skipping off-screen chunks 2025-04-05 15:26:49 +02:00
Kacper Kostka (aider)
c7735b8578 fix: Ensure consistent terrain generation for all chunks at y=0 2025-04-05 15:24:32 +02:00
Kacper Kostka (aider)
d34a695bb8 feat: Prevent tree seeds from spawning near water 2025-04-05 15:21:34 +02:00
Kacper Kostka (aider)
9c49af57cb refactor: Reverse noisy transition between sand and stone layers 2025-04-05 15:19:53 +02:00
Kacper Kostka (aider)
206e9eb5cc feat: Add noisy transition between stone and sand layers 2025-04-05 15:17:38 +02:00
Kacper Kostka (aider)
908c819441 refactor: Remove floor generation and related code from world generation 2025-04-05 15:16:21 +02:00
Kacper Kostka (aider)
7aa0c1785b feat: Add generateChunksAroundPlayer function to world.js 2025-04-05 15:14:35 +02:00
Kacper Kostka (aider)
b85ae017b8 feat: Move stone layer generation from y = -1 to y = 1 2025-04-05 15:14:14 +02:00
Kacper Kostka (aider)
eab3a9b790 refactor: Remove floor generation for second chunk at world bottom 2025-04-05 15:12:10 +02:00
Kacper Kostka (aider)
d5f46d94c3 feat: Add stone layer beneath terrain generation 2025-04-05 15:08:40 +02:00
Kacper Kostka (aider)
ec7f8f9522 feat: Spawn tree seeds 3 pixels above surface for better growth 2025-04-05 15:06:49 +02:00
Kacper Kostka (aider)
0b96238226 feat: Implement minimum 5-pixel spacing for tree seed generation 2025-04-05 15:05:51 +02:00
Kacper Kostka (aider)
170b8d0a85 refactor: Reduce tree seed generation frequency and spacing 2025-04-05 15:03:57 +02:00
Kacper Kostka (aider)
4716cbe692 feat: Add natural tree and flower seed generation on grass terrain 2025-04-05 15:02:59 +02:00
Kacper Kostka (aider)
1584600d0b feat: Enhance grass generation with more coverage and variety 2025-04-05 15:00:12 +02:00
Kacper Kostka (aider)
7806b39a51 feat: Enhance terrain generation with more grass and water variety 2025-04-05 14:57:01 +02:00
Kacper Kostka (aider)
076f21f9ca feat: Enhance terrain generation with noisy sand and dynamic grass coverage 2025-04-05 14:54:17 +02:00
Kacper Kostka (aider)
a31f401378 feat: Enhance terrain generation with dynamic chunk spreading and seeded randomness 2025-04-05 14:53:15 +02:00
Kacper Kostka (aider)
c35f6cd448 feat: Add procedural generation for first chunk with sand hills, water, and grass 2025-04-05 14:50:47 +02:00
Kacper Kostka (aider)
8ef18f52ab feat: Add color variations for natural elements and dynamic water colors 2025-04-04 12:22:15 +02:00
Kacper Kostka (aider)
a86acfff3a refactor: Spread game code into modular files for better maintainability
This commit reorganizes the game's source code into multiple files within a `js/` directory, creating a more modular and maintainable structure. The changes include:

- Created separate files for different game components:
  - `constants.js`: Game constants and element types
  - `world.js`: World management functions
  - `terrain.js`: Terrain generation logic
  - `physics.js`: Physics simulation
  - `render.js`: Rendering functions
  - `input.js`: Input handling
  - `main.js`: Main game initialization and loop
  - Element-specific files in `js/elements/`:
    - `basic.js`: Sand, water, dirt behaviors
    - `plants.js`: Grass, seeds, flowers
    - `trees.js`: Tree growth and leaf generation
    - `fire.js`: Fire and lava behaviors

- Updated `index.html` to load modules in the correct order
- Removed the monolithic `script.js`

The modular approach improves code readability, makes future extensions easier, and separates concerns more effectively.
2025-04-04 12:15:30 +02:00
Kacper Kostka (aider)
a5702a210f feat: Implement procedural terrain generation with hills, lakes, and vegetation 2025-04-04 12:05:41 +02:00
Kacper Kostka (aider)
3f4f8bc09c fix: Resolve duplicate identifier by renaming chunkY to floorChunkY 2025-04-04 12:00:26 +02:00
Kacper Kostka (aider)
9cdf7eba78 feat: Set default world position to 0,0 and extend floor to 2 chunks deep 2025-04-04 11:59:29 +02:00