quest machine networking - Authoritative?

Announcements, support questions, and discussion for Quest Machine.
Post Reply
davidemo89
Posts: 5
Joined: Tue Feb 05, 2019 12:23 pm

quest machine networking - Authoritative?

Post by davidemo89 »

Hi,
for my prototype I'm adding quest machine with ummorpg but I have noticed something...
Is quest machine everything client side? Just the save data is sent to the server and back to the client when it wants to load?

I have just noticed the state part "Successfull" that if I want to give some items to the player the client is telling the server "yes, I want these items with this name now" without any check if the quest was finished. Is that right?

If yes is it possible to do everything authoritative? Or it's to complicated?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: quest machine networking - Authoritative?

Post by Tony Li »

Hi,

That's correct; by default Quest Machine's uMMORPG integration runs on the client.

Quest Machine is designed to be extended without having to touch any source code. What to make authoritative will vary by project. You can replace the "uMMORPG Add Item" action with a custom action that checks the server first to make sure the player is allowed to receive the item. Similarly, you can add a custom condition that checks the server before allowing a quest to progress.

In general, you can make a copy of any of the provided templates in Plugins / Pixel Crushers / Quest Machine / Templates. There's one for quest actions, another for quest conditions, etc.

However, for uMMORPG you may prefer to make a copy of uMMORPGAddItemQuestAction and add your desired customizations to the copy, since this action already contains some of the code that you'll want to use. Just replace Execute() with whatever checks you want to do first.
davidemo89
Posts: 5
Joined: Tue Feb 05, 2019 12:23 pm

Re: quest machine networking - Authoritative?

Post by davidemo89 »

Hi Tony, thanks for the reply. I'm trying to figure out how to get quest status on the server (like if the quest is activated or how many mobs he has killed) to check if the server is allowed to give the items.

I'm studying your code a bit. The best solution would be the quest running on the server and on every status changes the server sends back the data to the client with an update.

But mhm... I need to study a bit more the code, I think it's not possible to do this.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: quest machine networking - Authoritative?

Post by Tony Li »

You really don't want the entire quest running on the server for every player. When you're designing an authoritative server, you should identify the minimum amount that needs to be maintained authoritatively on the server.

For example, let's say a quest has a level minimum, and you don't want to trust the client to tell you the player's level. In this case:

1. Write a script with two methods:
  • A [Command] that the client sends to the server to request a player's level.
  • A [TargetRPC] that the server sends to the client containing the player's level, and for example sends a message using Quest Machine's message system.
2. Make a copy of QuestConditionTemplate to authoritatively check the player's level. Send the [Command], and listen for a message from the message system that contains the player's level.

I can write one or two example authoritative conditions this weekend and add them to the uMMORPG package. If you have any specific requests, please let me know.
Post Reply