Commit Graph

70 Commits (d4d3b317e2e095a82ac44d72f48bfdc47cd03f0d)

Author SHA1 Message Date
En Yi d4d3b317e2 Complete level data packing and loading 2023-09-28 16:10:20 +08:00
En Yi 359ac0a0ae Implement air meter
Changelog:
- Add air timer component
- Update movement component to keep track of x direction
    - This indicate the facing direction
- Implement air timer update system
- Add air timer component to player
- Render player's air timer
2023-09-27 22:08:16 +08:00
En Yi 26fa9af6b8 Allow null input for overlap for AABB check 2023-09-25 22:08:31 +08:00
En Yi ce8284ab39 Implement level ending
Internal Changelog:
- Activate on collected chest == all chest
- Add spawning level end entity
- Level ending in sandbox will just reset the scene
2023-09-25 22:04:13 +08:00
En Yi e8ebe0f89c Improve player collision to chests vs crates
Internal Changelog:
- Delay zeroing velocity on edge check to after hitbox update
- Update player velocity on hitting a crate explicitly
    - This is due to the zeroing velocity changes above
    - This essentially allow 'phasing' through chest but not wooden
      crates
- Render crates using material instead of fragile flag
2023-09-23 00:28:03 +08:00
En Yi 51618cadc6 Reset ZSTD context before starting 2023-09-02 19:54:17 +08:00
En Yi 789d1b2577 Fix incorrect check for invalid assets 2023-09-02 19:51:36 +08:00
En Yi 5cfa0c0fc0 Add id check for each chunk load 2023-09-02 14:34:24 +08:00
En Yi 20d5bd4ac7 Integrate loading RRES data pack
Changelog:
- Add in rres
    - Split rres header only into two files. Easier to deal with. Sorry
      Raysan...
- Add function to load assets from rres chunk
- Add function to load player sprite info from rres chunk
- Test loading rres in scene test
2023-09-01 20:50:45 +08:00
En Yi 044a5831ff Integrate ZSTD decompression to load level 2023-08-26 22:17:53 +08:00
En Yi 963ba34164 Make water runner travel faster
Changelog:
- introduce travel speed: how many move can the water runner make
    - normal movement cost : 2
    - water movement cost : 1
2023-08-19 13:03:13 +08:00
En Yi d2a19c5405 Refactor out engine init, deinit, and key handling
To avoid repeated code
2023-08-19 12:20:16 +08:00
En Yi 8c889690e8 Add null checks when creating new entity
Also, fix player spawn to reuse the player
2023-08-17 21:51:11 +08:00
En Yi cb68c6c6f4 Add toggle to activate crates on spawn 2023-08-16 22:29:17 +08:00
En Yi d3029316b7 Add spikes sprite support
Add tile rotation. This is kind of a temp solution, since any sprite
could use rotation. So, may need to extend this for general sprite
2023-08-16 21:21:55 +08:00
En Yi cd8ec0c7ed Fix grid entities set update bug for OOB entities
When entities are marked for deletion, the tilecoord components
still exists, which can update the grid entities set, even if the
entity is not alive
2023-08-15 19:58:14 +08:00
En Yi bba12b9b39 Add Sandbox button in main program
Changelog:
- First button now loads the levelpack
2023-08-14 21:54:25 +08:00
En Yi e0ea01a4de Add level switching
Changelog:
- Water is now on a separate layer in LDtk
- Update water loading in assets functions
- Add actions to switch levels
2023-08-14 17:05:43 +08:00
En Yi ca392a0efd Remove loop when loading level pack 2023-08-14 16:01:10 +08:00
En Yi f6f3214dc1 Add levelpack loading in asset loader
Changelog:
- Update main code to use assets loader
- Update level load test as well
2023-08-14 15:40:48 +08:00
En Yi 8e9efc622d Refactor out level tilemap initialisation
- Rename sandbox scene initialisation, which is just a convenience
  function
- Also refactor out tilemap related functions to a new file
2023-08-14 13:51:20 +08:00
En Yi 5de188c503 Implement level pack loading and testing 2023-08-14 12:16:15 +08:00
En Yi 5dbe2cc4d0 Add struct for loading in a level pack 2023-08-13 15:02:20 +08:00
En Yi 494c9e9e46 Fix incorrect line test
By this project convention, the line extend will start from p1 and
end at p2, but not including p2 [p1, p2). Thus, existing tests are
testing a zero-length line, which should assert no collision.

Add test to properly test AABB edge collision with a line

Also update existing collision function to account for this
2023-08-13 12:34:27 +08:00
En Yi f81029b482 Add shape factor to control upthrust and friction 2023-07-25 20:39:42 +08:00
En Yi f6c5fa10fd Add simple water flowing visual 2023-07-24 23:59:19 +08:00
En Yi 7d00d348f6 Put max water level into each tile
This is to create air pockets
2023-07-24 21:58:50 +08:00
En Yi eed785162e Update scanline fill function
Changelog:
- Fill only a range of reachable tiles instead
- Tweak fill complete check
    - Count tiles filled, if zero: complete
- Allow multiple runner to fill without breaking the game
2023-07-22 20:29:20 +08:00
En Yi 6097ec6e0d Complete basic water flow algorithm
Changelog:
- Add in scanline filling process
- Use signed integer for calculation
- Generalise BFS to only depend on the current cell
    - During the search for the lowest reachable tile, allow a single
      tile equal or higher to the starting tile
      This is to allow moving upwards when no valid lower tile exists
2023-07-22 15:52:55 +08:00
En Yi 6e2ccfa875 Improve reachability search for scanline filling
Just do a second BFS from the current position, reset the current
scanline reachability.
2023-07-20 23:25:32 +08:00
En Yi 7607827420 Split out state for resetting and starting BFS 2023-07-20 22:58:09 +08:00
En Yi dc20a6b992 Fix lowest point check and movement delay
- This allows separte movement delay for each runner
- Lowest point has to be not in water
2023-07-20 22:25:57 +08:00
En Yi a080b5ee0a Add water checks in BFS
Also refactor the BFS logic to generalise the next tiles to go
after the tile checks
2023-07-20 21:23:43 +08:00
En Yi 7af75b8366 Implement runner movement to lowest position
Changelog:
- Add new state for when runner reaches target position
- Skip movement if already on target position
- Add extra handling for spawning on solid tile
- Fix tile toggling bug on the same tile
2023-07-19 23:32:53 +08:00
En Yi a0f6cf3471 Visualise path from BFS + Improving BFS
Changelog:
- Avoid continuous BFS by changing state after BFS completion
- Reset to BFS state on tile change
2023-07-19 22:44:49 +08:00
En Yi 5b3cbd1bba Implement BFS into water runner 2023-07-19 19:16:35 +08:00
En Yi 917fdeba9b Fix incorrect entity deletion process
Changelog:
- Components of an entity are now freed on the spot
2023-07-19 19:15:16 +08:00
En Yi cf6dbcf481 Fix incorrect update of entity manager
Changelog:
- Clear to_update queue correctly
- Move entity deletion after adding
    - This is to allow deletion immediately after adding
    - Should be okay
- Fix incorrect null checking when adding entity
- Queue deletion when removing entity even if not found at removal time
    - The update function should handle such case
2023-07-19 10:55:16 +08:00
En Yi ebffd48958 Ready a water filler/runner entity
Changelog:
- Add new component: water runner component
    - specific for such an entity. Not general, but i dont really care
- Implement adding and freeing the water filler entity
    - Component involves dynamic memory allocation, so need custom
      function to add and free
    - May look into custom allocation for this part in the future.
2023-07-18 21:49:43 +08:00
En Yi aae61edda9 Refactor out broad phase grid collision functions 2023-07-17 21:14:02 +08:00
En Yi eaf75ec8ae Create test scene for water flow
Changelog:
- Nothing here yet
2023-07-08 21:05:00 +08:00
En Yi 966432867f Add delay in crate destruction
Changelog:
- Add Lifetimer and remove hurtbox on hit
    - Still insta-remove on player hit
- Fix adding a component to an entity that already has that component
- Reorder lifetimer update system
2023-07-03 22:18:35 +08:00
En Yi 256ea02d0b Add player interaction with bomb crates
Changelog:
- Add damage source for hurtboxes
- Add logic to handle player as damage source for bomb crates
2023-07-02 22:18:38 +08:00
En Yi c4d8256767 Rework component addition/deletion procedure
Changelog:
- Defer component updates as iterator invalidation can occur
    - Add new struct for this + queue on entity manager
- Add new component: CLifeTimer
    - Basically a timer to live for entity
2023-07-02 21:49:15 +08:00
En Yi fe2bcdf8cd Add metal crate toggling
Changelog:
- Remove spawn option for metal crate
- Use M to toggle metal crate, applicable for arrow crates
2023-06-28 22:58:51 +08:00
En Yi b578dd95f7 Add arrow spawning from crates
Changelog:
- Add function spawn arrow
- Update game system to handle null components
    - enough for the arrow to work
- Render arrow, sort of
- Initial implementation, definitely need more work
2023-06-27 22:11:14 +08:00
En Yi b70dcc1e98 Add activeness to ctransform
Changelog:
- Activeness determines whether to start moving or not
- Tile collision will skip inactive objects
- Crates are inactive on spawn
2023-06-26 20:42:32 +08:00
En Yi bb4a9a8f3c Improve crushing response
Changelog:
- Fix incomplete line-AABB collision check
- Add line-AABB check for grid
- Change len_reduction to 0
- Set tiles to check once during edge checking
2023-06-22 22:19:39 +08:00
En Yi 451b241460 Correct AABB tests
Changelog:
- Figure out why the previous AABB behaviour was correct: continuum
    [0, 5) does not collide with [5, 10)
    For tile check however, need to subtract one to avoid extra tile
    check. Exception is the tile collision
2023-06-21 22:11:32 +08:00
En Yi 4b91ab5667 Integrate line check into edge check function
Internal Changelog:
- Weird issue when using the new AABB functions, revert the off-by-one
  fix
2023-06-21 21:13:02 +08:00