XaiJu
cheepysnake
cheepysnake

patreon


How it works: the quest system

Hi all! I thought it would be nice to make a New Year's gift to you, people. Therefore, before you is a small article about the quest system that I use in the Acme of Abyss.

Preamble:

I apologize for my bad English. In addition, you should not take my system as the only correct one. Surely you can do it better. And if you succeed - write me :)

In addition, I will not retell what can be read in the Unreal Engine documentation.

Part I, Quest System Overview

The quest plugin that I used started producing many errors and I decided to make my own quest system.

Usually quest systems have the following form:


It seems to me that it is more convenient to keep tasks separate from scripts.


This adds a lot of flexibility.

Further, the system must store a lot of data type: how many places were visited, how many toys were used, etc.

Finally, the main requirement is: since I have a weak computer (very slo-o-o-o-o-o-ow compiling) and I am not very good in C ++, the system should be completely on blueprints.

So, the advantages of my system:

And disadvantages:

Part II, quest system structure

The system consists of the following components:

* Quest Manager (actor component). It stores all the data, we turn to it for the quest status, it also launches them and updates.

You can add it to a character, controller, etc. In my case, it is attached to the game mode.

* Quest (object). Essentially - just a constructor for the nodes. In it, using macros, we create a quest structure. In addition, tasks descriptions are stored here.

* Quest node (object). I called them “receive” and don’t ask me why. This is the main quest node. When it starts, it’s binding to some event. Let's say: you went to a certain zone; the script will work and do something.

* Instant check (object). Check for certain conditions. Can be assigned to a node. You went to a certain zone; the script will work only if you have 6 candles in the inventory.

* Action (object). Can be assigned to the node. When node was started or finished, it do something. You went to a certain zone; the script adds 12 golden coins to you inventory.

* Level action (actor). Very similar to the previous point, but can be located in the world. Can store reference to level actors; I run them with a name tag (get all actors of class -> for each loop -> if name equal -> run)

What it looks like.


* Enumerations:

EQuestTaskStatus (None, InProces, Succes, Fail)

EReceiveStatus (None, InProcess, Complete)

EReceiveEndReason (None, InProcces, Succes, Fail)

Look alike, yes? But I prefer to have them individually to less confused.

*Structures:

FQuest task ( Title(text), Description(multiline text), Argument Name(name), bIsMemList(bool) )

The text of the task. The last two variables specify where the numeric values will be taken from.

FMemList

FReceiveStatus

FCompletedQuest ( QuestStatus(EQuestTaskStatus), TaskStatus (name map of EQuestTaskStatus) )

FActiveQuestStructure

FActiveQuestDump 


FQuestDump 


(ActiveQuest (name map of FActiveQuestDump), CompletedQuest (name map of FCompletedQuest), Memories (name map of integer), MemList (name map of FMemList) )

And…

FQuestClass (class of BP_Quest)

And data table of this struct

Why? Because arrays of object class in a complex structure is not good idea. You will get many errors when writing and loading a dump. In addition, when storing links to the quest as a string or name, you can always easily change or delete the objects of the quests themselves, and players will not even notice that something has changed.

Part III, Quest manager

Variables and Event Dispatchers of my QuestManager

Memories – counts of some things, like visited place or opened doors. MemList – sets of something. For example: in the scene with Zesthara you used next toys: hand, vibro clamps, magic wand.

Beginning Quest is list of quest, when running by default. Now I do not use this feature.

************

Uff ... Something I overtired. If you are interested in the continuation (with all the functions, and descriptions of what and how is used), put likes and / or comment on the material.

 Part 2  

How it works: the quest system

More Creators