jonathaneeckhout / jdungeon

An opensource 2d morpg game based on the Godot engine in a medieval inspired fantasy world
https://jdungeon.org
BSD 2-Clause "Simplified" License
130 stars 23 forks source link

Projectile implementation + Ranger character class #215

Closed NancokPS2 closed 8 months ago

NancokPS2 commented 9 months ago

Testing:
Currently projectiles can be tested by choosing the Ranger class and trying both of its skills.

Planned implementation:

  1. Projectiles work as normal physics objects in the server.
  2. When a projectile is fired by a player (server confirmed). The server sends information to the client about the initial position and direction of the projectile as well as other relevant information for it's expected movement.
  3. The client's component creates and starts moving the projectile with physics enabled client-side, this is purely visual and it is meant to provide better feedback for the player. This projectile also has no effect when it collides with something and simply dissapears.
  4. If the projectile has a collision animation, once it collides with something. The server sends a PackedVector2Array with the locations where the projectile collided (it is an Array for cases where a projectile can pierce) to the client. The client is then responsible for playing the corresponding animations in each of those locations. This helps with feedback as to what was actually hit in cases where the movement of the projectile does not match the server.
  5. All other feedback like damage dealt or application of status effects are carried out by their respective components as usual.

Projectile features:

Screenshot (because)
image

Ranger:
The only class that uses projectiles so far, uses a skill to fire arrows until ranged weapons get added. Can also set a trap for enemies to stumble into that lasts 2 minutes, only 4 can exist at a time.

TODO:

Closes: #200

NancokPS2 commented 9 months ago

Due to move_and_collide() not working currently, we may need a different approach in the meantime.

NancokPS2 commented 8 months ago

idk if rebasing is meant to make 15 instant commits, but it did

jonathaneeckhout commented 8 months ago

Tested and works fine.

I had some comments to polish it, placing it another issue: https://github.com/jonathaneeckhout/jdungeon/issues/226