oestrich / grapevine

The MUD Chat Network
https://grapevine.haus/
MIT License
153 stars 21 forks source link

Achievements #33

Open oestrich opened 5 years ago

oestrich commented 5 years ago

Gossip will soon have achievements, games can unlock them for players and they will be displayed on Grapevine if the character has been associated to a profile.

Why?

To enable discovery of smaller games by letting players collect and share achievements.

Attributes

This is what Gossip will hold on to. Grapevine will handle the character association. This is for a single achievement.

Managing Achievements

Games will manage their achievements on Gossip, from the game show page, similar to connections. Create, edit, update achievements. Possibly delete them, deleting would clear out all associated player unlocks.

On any state change for an achievement, a backbone sync event will occur and update on Grapevine for display. Grapevine will have a public listing on the game profile page.

Games can have a maximum of 500 points in achievements.

Websocket API

Unlock an achievement for a player

To unlock an achievement for one of your players, send this event. The achievement must be from your game's list.

{
  "event": "achievements/unlock",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "achievement": "bbba4676-ac94-4e47-ad6c-f24c0192ac23",
    "unlocked_at": "2018-12-29T13:12:28Z",
    "name": "Player"
  }
}

Response if a ref is provided:

{
  "event": "achievements/unlock",
  "status": "success",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964"
}

This will echo to the system backbone for Grapevine to catch on and unlock the achievement from there. Grapevine must ack this request before a response is sent back to the game. If Grapevine fails to ack within X seconds then the request is failed and the game is notified.

Record partial progress for a player

To record partial progress for one of your players, send this event. The achievement must be from your game's list.

{
  "event": "achievements/record",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "achievement": "bbba4676-ac94-4e47-ad6c-f24c0192ac23",
    "progress": 10,
    "recorded_at": "2018-12-29T13:12:28Z",
    "name": "Player"
  }
}

Sync

To request the achievements Gossip knows about send this event:

{
  "event": "achievements/sync",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964"
}

The response will be a series of sync events back to you:

{
  "event": "achievements/sync",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "total": 45,
    "achievements": []
  }
}

This response is "paginated" by sending chunked up events, correlated by the same ref. Each event will contain up to 10 achievements. The total number of achievements is included in each event so you know how many are being sent.

CRUD Events

To manage achievements inside your game, Gossip can provide a set of CRUD events. refs are required. A response event will be sent back with possible errors.

{
  "event": "achievements/create",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "title": "Achievement"
  }
}
{
  "event": "achievements/update",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "key": "bbba4676-ac94-4e47-ad6c-f24c0192ac23",
    "title": "An Achievement"
  }
}
{
  "event": "achievements/delete",
  "ref": "22d61b78-5ad4-4cfa-933f-02c6172d0964",
  "payload": {
    "key": "bbba4676-ac94-4e47-ad6c-f24c0192ac23"
  }
}

Questions

lorecrafting commented 5 years ago

Any opinions on using GraphQL?

oestrich commented 5 years ago

I am not a big fan of GraphQL, so I'd lean against it. I've heard a lot of opinions about how it doesn't fit a platform like Gossip, but works great if say Gossip's front end was using it and expected no one else to.

I am also biased because I help run an API unconference! 😄

lorecrafting commented 5 years ago

Ahhh icic cool!

bbuck commented 5 years ago

Should we include points?

Tough call, most people are used to it, and it gives an extra layer of "gamification" to using these features. Like, encouraging a games users to use Grapevine? Compare achievements and overall score.

To create a parallel, my gamerscore on Xbox Live still carries achievements earned in games that can't be played on the Xbox One (or couldn't last time I played). I don't think those points should be "unearned" and someone who's done the same amount of time and effort in another set of games should definitely be able to stand next to me and say "we're equal in effort spent gaming." I think it's fair to compare with players of differing MUDs as well.

I can also the value in not having a score though, although less so. Each new achievement would just like that extra oomph! of acquirement when it lacks some arbitrary associated number -- but the the number of achievements could be an easy replacement. But again, someone with a bunch of simple to get achievements could have, let's say "50" and someone with a bunch of hard to earn achievements could have "30" where-as with score, the person with easy achievements could have 500 and the person with hard to achieve ones could have 3000. So their effort measurement is represented accordingly.

It's a tough game to play. Due to familiarity I think achievements should definitely have a "worth" attribute. Whether that's points in the form of 5, 10, 50 -- what-have-you -- point increments or worth in the sense of how Playstation measures Bronze, Silver, Gold, and Platinum achievements ("trophies"). While not specifically points, I think having a "worth"/"value" is a necessity to distinguish "moving between 100 rooms" and "beat the final boss of the first dungeon" from each other.

If so, what is the maximum number for a game?

I think treating every game fairly and instituting a maximum is necessary. In a point system this could be circumvented with 0 point achievements, which would be those very specific to your game as a "fun thing" -- think WoW's "Feats of Strength" which don't add to your total, but are there to represent the effort expended regardless. This could be, as stated, a 0-point achievement or a new tier of trophy that doesn't count to trophy totals in any tier.

I'm not sure without more discussion in worth-measurement per achievement that this question can actually be answered and even then it might have to start out as something of a moving value to find a sweet spot (i.e. have a beta period where the total allowed can change.

If a game is 20 years old, should they be allowed to have "expansion pack" points added to their maximum?

Why not? If the game is 20 years old and it's still releasing new content I see no reason that this new content cannot come with additional earned achievements. You'd definitely want some "explored," "conquered" achievements and potentially some more depending on the breadth and type of content.

The specific allotted amount per new content is a much tougher decision to make as it would highly depend on the breadth of said new content. A new release containing a new dungeon and a few quests should not come with many new achievements compared to one adding a new continent/planet/dimension/etc...

How does a game know about the achievements on Gossip?

This is where my answer may diverge drastically from planned goals. A game shouldn't know about what achievements are in Gossip, Gossip should know about what achievements are in a game. Simply artifacts associated to a game that the game can then identify and notify Gossip about. After all, exploring "Midgard," despite being a standard and classic area, could be achievement worth in each game where it appears So it makes sense for each game to define the kind number and value of each achievement. This is ultimately the most flexible. Although you'd need a means to prevent abuse (i.e. one huge achievements or small achievements worth a ton of points, etc...). Although the question becomes "Who is hurt?" If you can play some guys one-off game and get a single, easy to earn 1000 point achievement, why stop that? Is that abuse? That's the game's choice. Any player can play said game to get the same achievement, so it's not like we're allowing a gaming of the system. But it can devalue the achievements overall so it could be worth having some form or reporting feature where you can react to abuse or review each new submission of achievements which requires front-loaded effort.

Should the game be able to CRUD achievements via websocket events?

If a game using Gossip would already be assumed to be maintaining an active websocket connection with Gossip I think it would be useful to include the feature to leverage working with your websockets over this already-existent socket. Although if the socket is meant specifically to handle chat only then REST endpoints for achievements make perfect sense.