Dedicated authoritative server integration

Announcements, support questions, and discussion for Quest Machine.
Post Reply
unityDev
Posts: 9
Joined: Mon Jul 04, 2022 8:30 pm

Dedicated authoritative server integration

Post by unityDev »

Hello all!

I am still starting to get familiar with the quest machine system, so far so good.

I would like to know if there's any tips/advices when working with a dedicated server setup, I'm using fish-networking (similar to mirror). In the context of quest conditions being met etc, would the server simulation have that and then sync state to a player? Or would both the client and server just simulate the quests?

Thanks a lot.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dedicated authoritative server integration

Post by Tony Li »

Hi,

To be fully authoritative, you'll want run the simulation on the server, but you don't have to necessarily run Quest Machine on the server. You can still run Quest Machine on each client. Write custom quest actions and quest conditions that run on the client's instance of Quest Machine but reach back to the server for authorization. You'll probably want these actions and conditions to run asychronously like TimerQuestCondition instead of blocking the main thread until they receive a result.
unityDev
Posts: 9
Joined: Mon Jul 04, 2022 8:30 pm

Re: Dedicated authoritative server integration

Post by unityDev »

Thanks for your reply.

We are building an mmo, where the player's quests states must be saved in database, so I had to run quest machine on the server as well. Serializing and deserializing quests nodes were intimidating but I think I got it now.
Didn't get to saving counter list for example, but might not need it for now. Having a built-in method would've been really awesome though. I've taken a look at the Save system but I don't think it's built for network and database.

I might get into trouble again but hopefully not soon :D
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dedicated authoritative server integration

Post by Tony Li »

Hi,

Sounds good. The save system supports authoritative saves from the server or non-authoritative saves from the client, by dropping in a custom SavedGameDataStorer subclass that writes to a network and/or database, but neither is appropriate for an MMO. For an MMO, you'll need to implement your own saving.
unityDev
Posts: 9
Joined: Mon Jul 04, 2022 8:30 pm

Re: Dedicated authoritative server integration

Post by unityDev »

Yeah, my saving method is basic for now, just a list of all QuestStates, where a QuestState is just a string quest ID, and the active node id int. And on initializing quest journal from state, I just iterate over quest nodes and set to True, until I reach the active node and set to Active.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dedicated authoritative server integration

Post by Tony Li »

That sounds like a good approach. It doesn't hurt to keep things as simple as you can, for as long as you can, especially when making an MMO.
unityDev
Posts: 9
Joined: Mon Jul 04, 2022 8:30 pm

Re: Dedicated authoritative server integration

Post by unityDev »

I see, thanks a lot, your comments are really appreciated.
Post Reply