- Home /
Best Practice for creating quests and saving progress
Hello,
im trying to develop a Quest system for a singleplayer adventure like game. At the moment I've got my Quest as a Scriptable Object with an Array of an abstract Scriptable Object "Goal". Goal has one Array of Results, which are indeed Scriptable Objects.
public class Quest : ScriptableObject
{
public COMPLETIONTYPE completionType;
public Goal[] goals;
public string title;
public string descr;
}
public abstract class Goal : ScriptableObject
{
public Quest partOf;
public bool Initialized;
public bool done;
public Result[] results;
public virtual bool evaluateGoal() { return true; }
public virtual void init() { }
public virtual void goalToText()
{
}
}
With that I can create Assets for Quests, Goals and Results and easily connect them. I think this raises some problems:
I think this is abusing ScriptableObjects
The parts are not reusable without instantiating
If I dont instantiate every asset, i wouldnt know how to reset the save game so the player can start over.
I am kinda stuck right now and dont know what a good practice would be. Is it a bad idea to keep with the idea of scriptable Objects and instantiate them?
Answer by mottzy · Dec 28, 2020 at 06:21 AM
Did you every come to a solution on this? I'm working on a quest system as well and it's surprisingly similar to your structure (though I haven't really considered abstractions just yet. I'm curious if you went with this approach, or found one that worked best for your needs?
Conceptually your idea makes sense. The approach I'm using is to have scriptable objects so I can have configurable quests, and then at runtime I instantiate a different type of object that has runtime information. The runtime quest tracker retains a reference to the quest object, but stores it's own data related to the quest.
The reason I did this is that I needed to track the status of goals, and it didn't make sense to store it back in the scriptable object that defines the quest. Anyway, just curious where you got!
I've changed Goal and Results to be normal classes instead of Scriptable Objects. That way i didnt have to worry about reference from SO to other SOs while instantiating. With a custom editor script i was still able to create the quests in Editor (even if poorly executed). Ive then saved the quests which are active through my questmanagers reference.
But I've dropped the project already some time ago.
Your answer
Follow this Question
Related Questions
Scriptable object sub-classes list 1 Answer
How To Save User Created Custom Object 1 Answer
How do I save a list of scriptable objects? 0 Answers
Hero and enemies level up best practice 0 Answers
Google Play Games Services process reward data? C# 0 Answers