Commit Graph

  • d0d93780fb initial implementation of bat's update function (todo: make bat oscillate up and down while it also moves in x axis, and also code bat's collisions with player, adding to falling list if necessary, or being filtered by player's attack) Humza Shahid 2025-02-11 19:38:02 +00:00
  • 3202c67f47 begin adding variant for STRAIGHT_BAT enemy Humza Shahid 2025-02-11 18:05:44 +00:00
  • 534852c8bf don't make 'falling' enemies come back down (fall), but lift them up instead, filtered when reaching beyond the top of the world. It's a little more fluid with current physics for enemies to be 'spirited away' rather than fall. Humza Shahid 2025-02-09 13:14:38 +00:00
  • 4301e9ae38 add line-of-sight, so FOLLOW_SLIME will only follow player if player is in specific range of enemy (within 199 pixels currently). Humza Shahid 2025-02-09 10:05:12 +00:00
  • 07d31119a7 code functionality to filter out falling enemy from list if falling enemy is colliding with player Humza Shahid 2025-02-08 11:05:58 +00:00
  • 26870816db add code so that enemy gains a new projectile when attacking falling enemies, and also draw the falling enemies Humza Shahid 2025-02-08 10:48:34 +00:00
  • 51401231e1 update state of falling enemies per loop Humza Shahid 2025-02-08 09:49:32 +00:00
  • 38640b14a2 add falling_enemies type to game (these enemies can be picked up and thrown), and thread fallingEnemies through enemy.sml to set up scaffolding for them Humza Shahid 2025-02-08 09:20:10 +00:00
  • 1c105193e2 extract a couple of collision functions to a separate module for reuse Humza Shahid 2025-02-08 08:39:04 +00:00
  • f9fe009d59 have patrol slime and follow slime also react to player's ChainEdge attack, and not only player's projectiles Humza Shahid 2025-02-08 04:02:17 +00:00
  • 23cf480dad reimplement enemy-filter loop (now enemy's reaction, and decision to possibly filter, is fully under enemy's control - physics, damage reaction, whether to filter or update enemy's state, etc.) Humza Shahid 2025-02-08 01:05:39 +00:00
  • 1be44335cb add asset for ChainEdge (attack) Humza Shahid 2025-02-07 13:42:38 +00:00
  • 7734496a8c remove some references to charging when/ife we don't need it, and also only trigger throw/attack on new button press (if held, throw/attack is not repeated) Humza Shahid 2025-02-07 12:32:38 +00:00
  • 283962c176 make length of main attack increase and decrease Humza Shahid 2025-02-07 11:22:23 +00:00
  • f6cd818c42 display fieldVec which is more accurate to the attack's hitbox for now Humza Shahid 2025-02-07 10:40:47 +00:00
  • 35eab0f789 reimplement attack patches (todo: add an int to the MAIN_ATTACKING variant to make the attack grow past some limit, and a bool to indicate whether the attack should grow in length or shrink) Humza Shahid 2025-02-07 09:10:10 +00:00
  • f5071a953b make sure playedr only checks collisions with enemy in the case that player was previously attacked Humza Shahid 2025-02-06 17:42:45 +00:00
  • e1e20230d6 rip out player-enemy.sml and let player react to enemy collisions independently of enemy reaction to player Humza Shahid 2025-02-06 17:37:48 +00:00
  • 886e3a674d progress checking collisions of enemy inside functor instead Humza Shahid 2025-02-06 09:53:31 +00:00
  • 7142f5dc66 a little more deliberate about timing of when player's patches should be applied Humza Shahid 2025-02-05 19:33:56 +00:00
  • 713d17fdd3 implement removeMany function for gap_set.sml (but it is untested and more complicated than all the other functions) Humza Shahid 2025-02-03 06:39:46 +00:00
  • 47c1492136 implement remove function for gap-set.sml (todo: a 'removeMany' function that takes a startToRemove and endToRemove value, and deletes values in that range) Humza Shahid 2025-02-02 04:13:18 +00:00
  • 707a62021a implement 'exists' functions on gap-set.sml Humza Shahid 2025-02-01 23:56:33 +00:00
  • 43bff91227 add functions to move around in gap set Humza Shahid 2025-02-01 23:21:15 +00:00
  • 7780b767a3 code insert function for gap-set.sml Humza Shahid 2025-02-01 22:36:37 +00:00
  • e1e1228983 delete pointer quad tree because it is twice as slow to construct as the vector-based implementation Humza Shahid 2025-02-01 10:11:32 +00:00
  • bf3f0b3927 done implementing pointer quad tree (next: benchmark the two) Humza Shahid 2025-02-01 09:54:35 +00:00
  • 28380957b3 start implementing new quad tree that only uses pointers (just to test performance between vector-using implementation and only-pointer-using implementation) Humza Shahid 2025-02-01 09:44:22 +00:00
  • 0a9ab389c2 fix bug in tracing left jump path: we should consider rightmost x coordinate from enemy (which we now do) Humza Shahid 2025-02-01 01:33:26 +00:00
  • 9e9675aaab decrease memory consumption of quad tree by refraining from storing bounding box metadata (except for the global root which stores the width and height) Humza Shahid 2025-02-01 01:03:57 +00:00
  • 73aeeb5301 remove timing print statements from game-type.sml Humza Shahid 2025-01-31 06:26:09 +00:00
  • 547b5bac97 use an immutable vector (always of length 4) for representing quad tree's internal nodes Humza Shahid 2025-01-31 06:24:51 +00:00
  • 76c5f9d662 change maxSize of quad tree's leaf nodes (from a max length of 3 to a max length of 9) Humza Shahid 2025-01-31 06:01:02 +00:00
  • e23e2f0997 precompute graph to be used for dijkstra's algorithm, resulting in CPU usage that never exceed 7/home/humza/Downloads/sml/oh-my-stars/fcore/path-finding.sml with 5 enemies and eliminating lag Humza Shahid 2025-01-31 04:32:53 +00:00
  • f3a0b2bc81 write code for new loop implementation of dijkstra's algorithm, which uses a precomputed graphy; however, this is not used yet as we need to add the graph to the game type first, and pass it along with other parameters, down to the path-finding.sml function Humza Shahid 2025-01-31 04:10:58 +00:00
  • a24ada0f37 implement code for precomputing reachable platforms so it can be reused (but haven't modified implementation of Dijkstra's algorithm to use it, and haven't added it to game type yet) Humza Shahid 2025-01-31 03:46:28 +00:00
  • 0cdd81189c implement function to trace left jump, thereby completing 'build-graph.sml' (and fix a bug in trace-jump.sml where a left-tracing function mistakenly made a tail call to a right-tracing function) Humza Shahid 2025-01-31 00:35:36 +00:00
  • 70f04c2e92 implement function in build-graph.sml to trace path of right jump to detect reachable platforms (different from deciding how enemy should move to next platform in trace-jump.sml) Humza Shahid 2025-01-31 00:18:17 +00:00
  • 2103a8e8ac implement quad tree folder for building graph horizontally (but still need to trace the left/right paths) Humza Shahid 2025-01-30 13:25:39 +00:00
  • bbb957f016 get path-finding.sml to use function in build-graph.sml to find reachable platforms, and remove now-dead code from path-finding.sml Humza Shahid 2025-01-30 13:06:32 +00:00
  • 755e5da7f7 fix bug in bin-vec.sml 'deleteMin' function: we previously deleted two elements, but we are supposed to delete one, and now this is fixed Humza Shahid 2025-01-30 12:55:36 +00:00
  • 29389d3561 try coding a level Humza Shahid 2025-01-30 08:34:38 +00:00
  • 859414035d when tracing left jump, consider the enemy's 'x' coordinate to be the leftmost point of the enemy Humza Shahid 2025-01-30 08:21:15 +00:00
  • 73b4e607ae delete function to getPlatformBelowPlayer because it is no longer need now that player stores platID (but still keep function to get platform below enemy as that is still useful) Humza Shahid 2025-01-30 00:11:01 +00:00
  • 2446f3ea14 in trace-jump.sml, begin descent depending on enemy's size Humza Shahid 2025-01-29 23:51:02 +00:00
  • d55126b52a implement left jump/left drop tracing in trace-jump.sml, and verified that it works Humza Shahid 2025-01-29 23:04:28 +00:00
  • 89abab31ab implement function to trace drop (while moving right) Humza Shahid 2025-01-29 19:35:40 +00:00
  • 97a638b54d from TraceJump.traceRightJumpAscent function, check (after we have reached ascent and if we have still not found nextPlatID in path) if we can find nextPlatID if we trace the descent path after having reached the ascent Humza Shahid 2025-01-29 19:24:03 +00:00
  • fac7a81767 trace path we can (move right + jump) using quad tree, as it is easier to implement than a pure math based approach Humza Shahid 2025-01-29 19:12:24 +00:00
  • a6b04ff98e implement functor to fold over quad tree Humza Shahid 2025-01-29 07:34:48 +00:00
  • 7138a05cd3 move quad tree helper functions which are useful in quad-tree.sml and will be useful in quad-tree-fold.sml, to quad-tree-type.sml, so quad-tree.sml only exports public API suitable for users Humza Shahid 2025-01-29 07:07:54 +00:00
  • abeff178c6 fix bug of enemy occasionally dropping off platform occasionally (incorrect int comparison in getMoveLeftPatches function) Humza Shahid 2025-01-29 02:56:21 +00:00
  • e2f5f18089 when enemy jumps or drops without needing to move horizontally to reach platform, tell enemy to stay still so we don't risk falling off platform Humza Shahid 2025-01-29 02:23:44 +00:00
  • 296e120d12 delete redundant case statement in enemy-behaviour.sml, where bestPath is empty (same case expression is repeated in startPatrolPatches function so doesn't need to be repeated) Humza Shahid 2025-01-29 00:45:49 +00:00
  • 5d590c84a9 add code for FOLLOW_SLIME to patrol in the same direction the player is in, when slime reaches a new platform. Humza Shahid 2025-01-29 00:22:48 +00:00
  • 3ced9c8d1d restore ability to drop below platform in physics.sml Humza Shahid 2025-01-27 23:55:15 +00:00
  • 9b7d7a1396 fix compile errors after previous commit (which involved reimplementing the quad tree to eliminate the possibility of a class of bugs I was experiencing; the problem was that the quad bounds were being passed recursively in different functions, but the long argument list in these functions made it difficult to see where the mismatch was) Humza Shahid 2025-01-27 23:41:59 +00:00
  • 6369be21fa tentatively refactor quad tree to make it more succinct + eliminate a class of potential bugs (passing wrong quad values through recursion) Humza Shahid 2025-01-27 23:27:52 +00:00
  • 42b42220d0 fully restructure quad tree from one that holds overlapping items in parent nodes, into one that holds overlapping items in each quadrant instead Humza Shahid 2025-01-27 06:04:52 +00:00
  • b7a609b447 fix quad tree queries (queries should not choose only one quadrant because they may validly visit two or more quadrants if query covers two leaf nodes), resulting in regressions. Fix one regression: reimplement wall patches (this time also optimised because there is no intgermediary list) Humza Shahid 2025-01-27 04:52:49 +00:00
  • 1c4ff62744 small amendment to getPatrolPatches: make sure enemy is always fully on platform while patrolling (does not go off edge) as this is more predictable + looks better Humza Shahid 2025-01-26 23:32:20 +00:00
  • 8f7bb3bb16 when FOLLOW_SLIME has no following to do, call patrol patches so that it at least patrols area Humza Shahid 2025-01-26 14:22:27 +00:00
  • bb0cf6bd33 better path landing implemented, making sure enemy fully overlaps platform they are trying to reach, and enemy's jump is clearer (before, when enemy landed on platform, they went straight to the top of the platform, but now they jump a little over the platform which looks clearer) Humza Shahid 2025-01-26 13:23:20 +00:00
  • c25afb6f03 small amendment do getMoveLeftPatches (change how yDiff is calculated, (platY - ey) instead of (ey - platY) Humza Shahid 2025-01-25 19:43:56 +00:00
  • 3885cc5cbc make path incentivisation less aggressive (prefer reaching goal by going through fewer platforms if possible). Humza Shahid 2025-01-25 18:36:30 +00:00
  • 6c3621cb3f decrease cost of straight vertical and straight horizontal paths compared to diagonal ones, to make it look like enemy is travelling a more coherent path Humza Shahid 2025-01-25 13:55:58 +00:00
  • 616d97e6fd verify that getMoveRightPatches works as intended through manual testing and platform placement adjustments Humza Shahid 2025-01-25 09:53:54 +00:00
  • 4cf1afb8cd add some additional platforms to game-type.sml for better testing Humza Shahid 2025-01-25 09:26:30 +00:00
  • 01d9c2bd47 refactor physics.sml so that we always set plat ID of player/enemy, when player or enemy stands on new platform, and make changes to enemy-behaviour.sml in calculation to jump to the top-right after testing Humza Shahid 2025-01-25 09:17:58 +00:00
  • c7ed5d3cce refactor player and enemy records to have a platID field (representing the last platform that player or enemy stood on), and fix resulting compile errors Humza Shahid 2025-01-25 08:41:42 +00:00
  • c8f56f3077 attempt at coding functionality to jump/drop when platform is to the right and not overlapping with current platform Humza Shahid 2025-01-25 08:34:05 +00:00
  • d8af1da6de prevent subscript error from occurring by validating eID and pID are both different from ~1, as the PathFinding.start function expects this to be the case Humza Shahid 2025-01-25 00:48:56 +00:00
  • 0be8e0dc5f progress coding function to make FOLLOW_SLIME go rightwards if next platform is towards the right Humza Shahid 2025-01-25 00:23:30 +00:00
  • 7a5517571d add functionality for enemy to walk to appropriate position if next platform is below current one, but only partially overlapping with current platform so enemy will not reach it if they drop down from current position Humza Shahid 2025-01-24 22:51:20 +00:00
  • 5e6a831add write 'getJumpPatches' function in a slightly less redundant way Humza Shahid 2025-01-24 09:48:57 +00:00
  • d07b0a35ca amend minor regression bug: in 'canJump' function, check to make sure prevPlatform is lower than nextPlatform Humza Shahid 2025-01-24 02:12:04 +00:00
  • 02d94fc3c7 handle not-so-uncommon edge case: when platform enemy is on can be jumped from to reach next platform, but enemy is not in a position to jump (top platform slightly overlaps bottom platform in x-axis), make enemy walk left/right first so enemy reaches point where it is possible to jump from Humza Shahid 2025-01-24 02:09:20 +00:00
  • e644160e38 enemy dropping below platform (without any bugs) is fully implemented now Humza Shahid 2025-01-23 01:06:16 +00:00
  • efbf0c7da9 progress towards letting enemy drop below platform if path to player is there Humza Shahid 2025-01-23 00:01:15 +00:00
  • 174a99a5a0 switch implementation of heap from being based on heap.sml (heap as described by one of Chris Okasaki's papers) to being based on bin-vec.sml (simple vector storing elements in sorted order); more performant this way for cache reasons Humza Shahid 2025-01-22 18:22:34 +00:00
  • c8c1818d24 fix platform data in game-type.sml (platform 2 and platform 5 had their IDs swapped for testing purposes, but they kept their previous position in the platforms vector, and because we rely on platforms being ordered and being able to perform binary search in the platforms vector, that caused inconsistencies Humza Shahid 2025-01-22 00:01:34 +00:00
  • 6c1c6b9a04 progress making enemy follow player Humza Shahid 2025-01-21 23:54:53 +00:00
  • 282d72b840 rip out print statements which were solely for debugging Humza Shahid 2025-01-21 22:46:04 +00:00
  • 72924ae084 instead of folding through quad tree to find reachable platforms, fold through platforms instead Humza Shahid 2025-01-21 21:20:57 +00:00
  • f948d060ea progress with fixing path finding Humza Shahid 2025-01-21 00:19:38 +00:00
  • 8498fab1dc fix bin-vec.sml to store sorted element properly, in order Humza Shahid 2025-01-20 12:23:30 +00:00
  • 4e5219fccc fix bug with value inserted into ValSet: before, the value inserted into the 'from' field was the ID of the current platform, but this is incorrect as it is circular. To fix, the 'from' field now contains the ID of the previous platform which this platform was found from Humza Shahid 2025-01-20 11:17:00 +00:00
  • 9c46e09ce4 amend 'foldRegion' function in MakeQuadFolder functor, by ensuring we don't visit only one child if item has coordinates in more than one child Humza Shahid 2025-01-20 10:46:09 +00:00
  • 6783dac9e0 a bit of bug fixing regarding implementation of dijstra's algorithm (next to fix: query towards quad/platform tree) Humza Shahid 2025-01-20 02:38:22 +00:00
  • 322a394138 progress towards implementing dijkstra's algorithm (next: test by printing to see if it works) Humza Shahid 2025-01-20 01:25:09 +00:00
  • 3939b0b3e2 done implementing functor to search through quad tree, adding to priority queue (for Dijkstra's algorithm) Humza Shahid 2025-01-19 23:56:52 +00:00
  • 1ba42462ba progress implementing dijkstra's algorithm for path finding using quad trees Humza Shahid 2025-01-19 22:45:51 +00:00
  • e64c3bc00d add contains function to bin-vec.sml which returns true if the vector contains the value Humza Shahid 2025-01-19 21:32:17 +00:00
  • e619fd1c05 change API of BinVec Humza Shahid 2025-01-19 13:03:16 +00:00
  • 4459a676ac implement bin-vec (vector that always stores its elements in order, for binary search) Humza Shahid 2025-01-19 12:06:56 +00:00
  • 8c651b2221 implement heap which stores distance for later use with Dijkstra's algorithm Humza Shahid 2025-01-19 11:07:45 +00:00
  • 84ea0ce24b code functor to fold through a specified region of the quad tree, without having to allocate an intermediary list or using a closure (which both have runtime costs) Humza Shahid 2025-01-18 22:54:34 +00:00
  • 2c6b1556d1 implemented four functions: is it possible to reach platform from above, is it possible to reach from below, or from left or right Humza Shahid 2025-01-18 22:18:05 +00:00
  • edf7d4c8dc fix bug in physics.sml where player/enemy would drop below continuously past multiple platforms even if they intended to drop below platforms only once (fixed by setting yAxis to 'FALLING' if there are no collisions at all and player is in DROP_BELOW_PLATFORMS state) Humza Shahid 2025-01-18 22:13:16 +00:00
  • 6812f61dcc add function to search leftwards Humza Shahid 2025-01-18 19:55:52 +00:00