Page 1 of 1

Dedicated authoritative server integration

Posted: Tue Jul 05, 2022 11:23 am
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.

Re: Dedicated authoritative server integration

Posted: Tue Jul 05, 2022 2:10 pm
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.

Re: Dedicated authoritative server integration

Posted: Sun Jul 10, 2022 8:25 pm
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

Re: Dedicated authoritative server integration

Posted: Sun Jul 10, 2022 8:52 pm
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.

Re: Dedicated authoritative server integration

Posted: Mon Jul 11, 2022 3:42 pm
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.

Re: Dedicated authoritative server integration

Posted: Mon Jul 11, 2022 7:16 pm
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.

Re: Dedicated authoritative server integration

Posted: Tue Jul 12, 2022 3:06 pm
by unityDev
I see, thanks a lot, your comments are really appreciated.