Download

How an Achievement System is supposed to work? (advice on design)

OK, I’ve seen on docs that Achievement System is not ready yet.

I’m working on my Quest System, and I “thought” that an “Achievement System” is “roughly” a bool flag checker:

My quest structure until now predicts just things that could be “externally” triggered, as example, if a quest is about kill a boss, the event that fires the quest completion is on the Boss TakeDamage() and HP reaches 0 instigator::CompleteQuest(ID) or something like this.

But on expand the quest system, I thought that would also be a nice way to stabilish some “funny” quests as achievements, as example kill 10 minions with the same skill, or even use the quest system to helps on tutorial (use a skill, walk…) and on this, I’ve seen the lots of “checks” the main game thread would do each time the player do a single click on the screen, would be overlagging check for all and just after to process the action.

So on read the docs the word Achievement is tied to the term “Subsystem” (Facepalm, multithread the check idiot! LOL) and @gmpreussner already gave a nice explanation to begin here on HUB .

My idea until now is something as this, advice/tips welcome

PREMISE:
A FSomePlayerAction struct.
A FQuestAnswer struct.
The PC already has a Questlist, quests are on an array unique-id-identified.

MAINGAME FLOW:

  • Game Starts.
  • Create the GameMaster parallel process.
  • Player loads savegame (within Questlist and all flags each contains).
  • Send a copy from this to GameMaster know what he’ll be looking for.
  • Send a player “pointer?” to the GameMaster knows where to call UpdateQuestStats(QuestAnswer)
  • Player builds a new SomePlayerAction and sends to the Gamemaster each time it does something (whatever if is needed to quests, it’s not MainGame work to check).
  • OnPlayerGetNewQuest add it to GameMaster Copy.
  • OnEndgame->kill GameMaster.

GAMEMASTER FLOW:

  • Starts.
  • Create a list of SomePlayerAction
  • Check if we have a Questlist copy, if not, request another to the maingame.

OnTick:

  • Evaluates the Index 0 from SomePlayerAction list against Questlist flags, if true, builds a QuestAnswer and call it to Player::UpdateQuestStats(QuestAnswer) on Maingame.
  • If last flag, remove Quest from local Questlist copy.
  • Removes Index0 from SomePlayerAction list.

Any thoughts about how to improve? I guess I’m forgetting something LOL.

I also got a big doubt about “who” should communicate with the GameMaster, I would preferably use GameMode to do everything system related, but it’s a pain get a non-null reference from it while the game is running (Match started) while the Controller is visible anywhere. On doing this “Epic way”, which class you think would be the best fit?

Best wishes.