Drupal 7's version of Achievements was insular: it was its own custom thingy with no real integration with anything else (no Views, no Rules, no Fields, etc.). It was designed, intentionally, so there was no user interface to even create an achievement. In Drupal 8, we'd like to "start over" with the design, to be as open-minded and integrated as possible. This issue serves as discussion for that.
Reimplementation
Here are three possible ways forward:
Configuration entities
Decision: Not strong enough.
Achievements could be configuration entities, which would solve some of the biggest complaints from 7.x: the inability to create/modify end-user achievement data with a UI, and to easily share achievements with other sites. jhedstrom spent some time implementing this and Morbus spent some time investigating it. The inability to handle custom images (both from a YAML/UI and CMI export/import perspective), and the lack of Fields, made us reconsider this approach.
Custom content entity (not nodes):
Create a custom content Entity for Achievement and Achievement Unlocked.
Custom content types (nodes):
Create custom content types using the existing node system.
Use-cases and questions
Use case: End-user created and unlocked achievements
Morbus is currently working on a site where normal (authenticated) users can both CREATE achievements and MANUALLY UNLOCK them. The site is honor-based and non-competitive: there is no code or automated means of "verifying" a user has legitimately unlocked an achievement (both because any user can create said achievements, and because achievements happen in meatspace vs. a game or coded website). In addition, because achievements happened in the "real world", and usually with other people around, Morbus wanted the optional ability for achievers to WRITE A MEMORY/STORY (i.e. fill in the Achievement Unlock body). Other users could then respond to those memories (i.e. leave a comment).
For this site, Morbus chose custom content types - i.e., using the existing node system. Why?
- PRO: Same interface for other content (i.e., JUST node/add vs. node/add AND admin/.../add).
- PRO: Everything for free (Fields, Views, etc.) without hundreds of lines of boilerplate.
- PRO: Achievements have authors and created timestamps for kudos-giving.
- PRO: Comment support for free. Eventual/likely Rules support for free.
- ???: He couldn't find any appreciable reason why custom Entities were "better".
- CON: Not every display in 7.x is doable within Views (totals, relative positions).
- CON: Workarounds for required-Title on nodes.
Morbus' current (minimalist) design is as follows:
- Content type:
achievement- Use achievements to define milestones that can be unlocked by a user.
- Title: Name of the achievement.
- Body: Description of achievement.
- Points (
field_achievement_points) - Image (unlocked) (
field_achievement_image_unlocked).
- Content type:
achievement_unlocked- Use achievement unlocks to record when a user has earned an achievement.
- Author: The node author is the achiever user ID.
- Created: The node created timestamp is the unlock timestamp.
- Title: Would need to be hidden/pre-set by custom code.
- Body: The (optional) story/memory by the user who unlocked it.
- Achievement (
field_achievement_unlocked): Reference to achievement.
Question: Should we keep multiple images?
In 7.x there is support for six different types of images:
- The site-wide achievement locked image.
- The site-wide achievement unlocked image.
- The site-wide achievement secret image.
- The per-achievement achievement locked image.
- The per-achievement achievement unlocked image.
- The per-achievement achievement secret image.
Do we need these in the default Drupal 8 version? Traditionally, the difference between "unlocked" and "locked" achievement images has been "locked images are greyscale, unlocked images are colorful". But, that can (now) be easily handled by running a CSS greyscale filter on the colorful/unlocked image instead. And "secret" and "hidden" achievements are neat and all but, given the Propensity Of The Internet, they never stay secret or hidden for long, effectively rendering their functionality, and their image, moot.
Morbus' current use case (above) users only one image per achievement.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screen Shot 2015-11-25 at 9.05.18 AM.png | 36.83 KB | morbus iff |
| #11 | Screen Shot 2015-11-25 at 9.05.32 AM.png | 66.89 KB | morbus iff |
Comments
Comment #2
morbus iffComment #3
morbus iffComment #4
morbus iffComment #5
morbus iffComment #6
morbus iffComment #7
morbus iffComment #8
morbus iffComment #9
morbus iffComment #10
rachel_norfolkI might have just come across a new elearning project that means I will again be looking to use Achievements. Looks like I’d better help with the 8.x version - where best to learn how to start?
Comment #11
morbus iff@rachel_norfolk:
Currently, I'm focussed on building an Achievements-like system, using just content types, for a potentially new project myself. As such, everything is still very very early - I've got the underlying content types "done" (ish), but all the (now-intended-for-Views) displays aren't built yet. I have, however, prepped things to be exported (via Features) and have added some CSS to make things look "nice". Screenshots attached. If you want this early module, I'll throw it up in a sandbox or Github somewhere and keep it updated.
At the moment, this is mostly experimental, but likely the approach/design I'll be taking for 8.x.
For the site I'm working on, authenticated users need to be able to make achievements AND unlock them - that is, none of the achievements can be unlocked in any sort of automated way (since they all happen in the real world). So, the current design is basically:
* One node-based content type for the achievement itself.
* One node-based content type for an achievement unlock.
* Unlocking an achievement is, essentially, creating a node.
There aren't helper functions for any of this stuff yet. It's all very very early.
How can I best help you help me? ;)
Comment #12
kscheirer@Morbus Iff can you post to a sandbox? It sounds like currently you're using both the module and content types defined on your site?