🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Authoritative Server with RPG skills

Started by
2 comments, last by yitay 4 years, 6 months ago

Hello folks,

I am working on a Co-op RPG game where one client acts as the host of the game.

I managed to sync player positioning as well as predictions etc.

However I am wondering now how to sync the skill system that I have created between server and clients.

Here is a possible flow which I want to support:

1. Client1 inits the vame and acts as the server

2. Client2 connects to the server

3. Client2 request the server to cast a skill

4. The server determines whether or not Client2 can cast said skill

5. (Approved) the server adds said skill to the character's active skills and notifies all players a out the change

6. Now here is the problem, Iwant my skills to be dynamic with different cields and values, as well as the skill effects usually are triggered by an animation event (onHit for instance), how can I have the server update the clients with the skill effect applied when the server should not know about the animation event which triggers the effect application


Thanks all for reading thjs and for any answers given.


Advertisement

If the animation has gameplay effects, then the animation needs to be server-authoritative.

Note that not all parts of animations need to be server authoritative -- for example, you may have "start time" and "event marker times" be evaluated on the server, but specific leg poses and particle effects and foot sounds are not done on the server.

If the "animation effect" that matters is "thing A hits thing B," and you want server-authoritative games (this could be for a fighter game, say,) then you need to run the full animation on the server.

If you're OK with client-initiated but server-checked animation outcomes, you need to have the client tell the server about each event it detects -- "at time T, my player P was running animation Q at animation time tQ, and it hit object O playing animation R at animation time tR." Your server then needs to figure out whether those objects are close enough, whether those animations could be playing at those times, and whether those specific positions/animations/times in fact generate a collision.

So, it all depends on what you want the specific gameplay rules to be, and how hard you want to validate those rules.

enum Bool { True, False, FileNotFound };

If the animation has gameplay effects, then the animation needs to be server-authoritative.

Note that not all parts of animations need to be server authoritative -- for example, you may have "start time" and "event marker times" be evaluated on the server, but specific leg poses and particle effects and foot sounds are not done on the server.

If the "animation effect" that matters is "thing A hits thing B," and you want server-authoritative games (this could be for a fighter game, say,) then you need to run the full animation on the server.

If you're OK with client-initiated but server-checked animation outcomes, you need to have the client tell the server about each event it detects -- "at time T, my player P was running animation Q at animation time tQ, and it hit object O playing animation R at animation time tR." Your server then needs to figure out whether those objects are close enough, whether those animations could be playing at those times, and whether those specific positions/animations/times in fact generate a collision.

So, it all depends on what you want the specific gameplay rules to be, and how hard you want to validate those rules.

enum Bool { True, False, FileNotFound };

Thanks for your response,

If I will run the animation on the server it makes the "skill effects" coupled to the animation, as well as the server coupled to game features which I prefer not to.

As for triggering the skill effects I thought about the server registering an action for later tick (say we triggered skill at tick 1, then tick 50 is when the effect should play out (this is where I will also check positions and collisions) - and afterwards update the clients).

Does this make sense? I read that handling physics on the server is a bad practice and it is better left for the clients.

I should also state that it is important for the game to allow newly connected players to join midgame thus the server state has to be universal.

This topic is closed to new replies.

Advertisement