Creating a Progress-System

Hey there,

I was wondering what would be a good way, to implement some kind of progress system. In my current game, the scenes the player has already visited should change, depending on what the player already did in this scene, or what he did in some other scenes.

For example: My first scene is a forest with a small river where a unfinished bridge was built. In another scene, the player can rescue a woodchuck, who finishes the bridge upon being saved.

I need to store information about what the player has achieved in which scenes, so i can react accordingly to it.
Currently, I’m using a system that I called “EventLevelSystem”. Every scene I have, has a string name and a int eventLevel stored in it. eventLevel is starting at 0, and everytime the player progresses, the eventLevel is increased by one. Depending on the current eventLevel, the according gameObjects are being activated or deactivated. I store everything inside PlayerPrefs.

This approach kinda works, but it seems very instable. Also, it only works with linear progressions. (Player does A, then B, then C. Progressions like C->A->B do not work.). Does someone know of a better/solid/flexible way to do this? Some articles, tutorials or design-patterns would help out a lot!

Thanks!

I have a similar system implemented for my own game, but in order to not be forced to have a linear progression I save the state of certain in-game events in an xml database (I don’t see any problem with you using player prefs for it though as it probably work just as fine for this simple task.)

To avoid the linear progression thing you speak of I created two classes, the “ProgStateTrigger” and “ProgStateManager”

ProgStateTrigger will save the state of it’s target event to the database
ProgStateManager will call it’s target triggers if the state it is targetting was completed

The classes in my case are defined like so: (In my case, you’ld of course have to shape them after your own case, but just to give you a better understanding of what I’m trying to say)

ProgStateManager

public class ProgStateManager : MonoBehaviour {
public string progName; //Name of the target prog/event
public Trigger[] eventsOnTrue; //Triggers called if state is true

public void Start(){
//Check the database/playerprefs if progName event has been completed, if so call all triggers in eventsOnTrue
}
}

ProgStateTrigger:

public class ProgStateTrigger : MonoBehaviour {
public string progName;

public void OnTriggered(){
  //Check database/player prefs if the event of progName was completed, if not, set this to true
}
}

I hope I made some sense, if not I do apologise, didn’t get any sleep last night. :X

//Edit:
Make sure to save all your prog/event states to false by default, or have an if-block to see if the event does not exist in the database/playerprefs yet (which would imply that it should use it’s default state “false” )

1 Like