Hey there! I’m working on an RPG Souls-like game, where I need to create abilities and weapons that both players and NPCs can use. I’m struggling with the replication and structuring of the code for these abilities.
For example, here’s a dash I’m working on:
Here is what I’ve tried till date:
Method 1:
- Client takes input, requests to server
- Server validates cooldown, tells all clients to simulate vfx
- The attacking client listens to the same signal and applies physics on itself
Pros:
- Physics is smooth, since all bodymovers are on client.
- Tweening functions nicely
- VFX is in sync with animations
Cons:
- Server has no idea what’s happening; can only make guesses.
- Chaining of abilities with multiple moves difficult for the above reason.
- VFX on NPCs is not in-sync with the actual ability, since in this case physics is on server and vfx is on client.
Method 2:
- same as method 1, except that all vfx and physics is on server.
Pros:
- Server is aware of what’s going on
- Chaining of abilities possible. If one hit lands, server can play the next move
- Server is aware of player’s movement and can reliably spawn hitboxes on end of a movement ability.
Cons:
- Takes away smoothness of physics, dashes with turning
are a big no-no - Tweening will now stutter
- Isn’t necessarily great at vfx replication, but atleast the vfx is somewhat in-sync with the ability since both physics and vfx is handled on the server.
TL;DR
Both the above methods I’ve used have failed. The attached videos will explain them properly. I’ve tried keeping all vfx on client, but I’m not able to reach the smoothness of a battlegrounds game. Somehow, in those kinds of games, the vfx is on-point. The physics is also client friendly and reacts immediately to camera movement. I want to know how they achieve that.
If anyone knows how the replication in TSB works, please let me know!