How to make your very first indie game without selling your mom's house - by Tom Safarov Blogs - 16 December 2018 - 7:42am
This post was inspired by the game dev who was trying to find $1.25kk to finance his very first indie game. I explain why focusing on what your team can achieve with the resources in hand is a more rational approach, than aiming for a BF-like monster.
Categories: Game Theory & Design

A review of Red Dead Redemption 2's player-motivation - by Charles Domicolo Blogs - 16 December 2018 - 7:42am
This blog sheds light on the various player-types that comprise RDR2 and reasons why individuals enjoy playing RDR2.
Categories: Game Theory & Design

Paideia and Ludus - A Comparison of Play and Rules in Dungeons and Dragons - by Jim Spagnola III Blogs - 16 December 2018 - 7:42am
An examination of the advantage-disadvantage system in 5th Edition versus the Situational Bonus system in 3.5 edition from the lens of rules and play.
Categories: Game Theory & Design

Diegetic Games - by Andrew Salvaterra Blogs - 16 December 2018 - 7:42am
An article about diegetic games
Categories: Game Theory & Design

Good RNG: The Binding of Isaac and Why It’s so Good - by Mike Doran Blogs - 16 December 2018 - 7:42am
RNG is an important element in game balance, and The Binding of Isaac games are a strong example of that
Categories: Game Theory & Design

The immersive nature of Skyrim - by chris sum Blogs - 16 December 2018 - 7:42am
This is a small blog that i am making that discusses why Skyrim is immersive to many people and the key elements as to how Bethesda made it incredibly immersive.
Categories: Game Theory & Design

OpenSense Labs: Creating a Custom REST Resource for GET Method in Drupal 8

Planet Drupal - 16 December 2018 - 12:04am
Creating a Custom REST Resource for GET Method in Drupal 8 Anmol Sun, 12/16/2018 - 16:44

As the world gets more connected, web technologies too, need to get connected. RESTful web services can be used as an application program interface to connect various service.

This can be made possible by using HTTP requests to GET, PUT, POST and DELETE data. It is based on representational state transfer (REST) technology, an architectural style, and approach to communications often used in web services development. 

With decoupled development getting the ground, it has become important for the developers to understand teh REST technology better. Drupal provides its developers an in-house build method to use this REST technology. RESTful Web Services module, which is now a part of Drupal core, provides REST services to its developers. 

It allows users to read or update data on the site. 

Different verbs or request methods that are used for the approach are:


The GET method allows the user to access various entities like Node, User, Taxonomy, Comments and even watchdog database log entries. GET method is a SAFE method as there is no database manipulation operation, it is a read-only request.

Unlike GET, in the POST method, database manipulation takes place. The user can update the database and create a node if need be. 

Creating REST Resource Plugins

REST resource plugins are important to expose additional resources over REST. In the steps below we will create a basic example for understanding the fundamental functionality of developing REST resource endpoint which takes a content type as argument and returns title and node ids of all nodes of that particular content-type.

  • Create the staging code for REST resource with the following Drupal console command:
drupal generate:plugin:rest:resource

You can also generate the staging code manually by creating a plugin file under src in the custom module > Plugin > Rest > Resource > {ResourceClassName}.php

Next, define the namespace, dependencies, and the plugin class as given in the example below.

  • Next, you need to create the @RestResource annotation. It helps you indicate the dependencies, and status of the class. Another important point to consider is that the URL mapping is case-sensitive.

    We must also be careful with the  @RestResource  annotation's urli_paths  which take link relation types as keys, and partial URIs as values. If you don't specify any, Drupal will automatically generate URI paths (and hence URLs) based on the plugin ID. 

    If your plugin ID is rest_example, you'll end up with/rest_example/{id}  for GET|PATCH|DELETE and /rest_example for POST . But, often, you'll want to specify your own paths: a canonical URI path (for example /todo/{todo_id}). For example:

* uri_paths = { * "canonical" = "/rest_example/{id}", * }

Here’s how to get the complete REST resource GET request

<?php namespace Drupal\rest_example\Plugin\rest\resource; use Drupal\rest\ModifiedResourceResponse; use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ResourceResponse; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /**  * Provides a resource to get view modes by entity and bundle.  *  * @RestResource(  *   id = "rest_example",  *   label = @Translation("Rest example"),  *   uri_paths = {  *     "canonical" = "/rest/api/get/node/{type}"  *   }  * )  */ class RestExample extends ResourceBase {   /**    * Responds to GET requests.    *    * @return \Drupal\rest\ResourceResponse    *   The HTTP response object.    *    * @throws \Symfony\Component\HttpKernel\Exception\HttpException    *   Throws exception expected.    */   public function get($type = NULL) {     // You must to implement the logic of your REST Resource here.     // Use current user after pass authentication to validate access.     if (!(\Drupal::currentUser)->hasPermission('access content')) {        throw new AccessDeniedHttpException();      }     if($type) {       $nids = \Drupal::entityQuery('node')->condition('type',$type)->execute();       if($nids){         $nodes =  \Drupal\node\Entity\Node::loadMultiple($nids);         foreach ($nodes as $key => $value) {           $data[] = ['id' => $value->id(),'title' => $value->getTitle()];         }       }     }     $response = new ResourceResponse($data);     // In order to generate fresh result every time (without clearing      // the cache), you need to invalidate the cache.     $response->addCacheableDependency($data);     return $response;   } }


[   {     "id": "67",     "title": "Consectetuer Sits"   },   {     "id": "69",     "title": "Eum Paulatim"   },   {     "id": "70",     "title": "Tation"   } ]
Configuring the REST Resources

In the config file, we define which HTTP method, serialization format, and an authentication mechanism is supported by the plugin. 

This config file is necessary to use the REST resource plugin. There are two ways to configure the REST resource @RestResource plugin:

  1. REST UI Module
    • The REST UI module is not part of the core. So you have to download it and install it like any other module in your Drupal site.


    • Once installed, go to  /admin/config/services/rest and enable your REST Resource.


    • Select your desired settings. To have hal_json format, you can enable Drupal Core’s HAL module.
  2. Manually
    • Go to the config directory and create a config file with name as rest.resource.{resource id}.yml.
    • Add the following content.
langcode: en status: true dependencies: module: - rest_example - serialization - user id: rest_example plugin_id: rest_example granularity: resource configuration: methods: - GET formats: - json authentication: - cookie
  • Save this file as rest.resource.plugin_id.yml (rest.resource.rest_example.yml in this case) in your config directory and run config sync.

Defining your resource config:

Status: true/false ( enable or disable) Id: unique id Plugin_id: unique id configuration=>methods: Name all request method you want to use in this plugin configuration=>formats: Define all supported serialized format configuration=>authentication: Name all supported authentication method. By default, the REST module supports json and xml

Key Point: Each REST resource must be annotated with  @RestResource  annotation so they can be discovered by RESTful Web Services module.

Custom REST API is useful in sending data to third-party applications and for headless architecture. As of today, there is hardly any project or application that doesn't have a REST API. Connect with us at to help you create

blog banner blog image Blog Type Tech Is it a good read ? On
Categories: Drupal

Web to image

New Drupal Modules - 15 December 2018 - 3:19pm

Provide a path to convert any url to image, using wkhtmltoimage library.

Categories: Drupal

view access per node

New Drupal Modules - 15 December 2018 - 8:18am

This module allows to define access permissions on a per node basis.

Categories: Drupal


New Drupal Modules - 15 December 2018 - 4:48am
Categories: Drupal

Red Route: A framework for progressively decoupled Drupal: Introducing the SPALP module

Planet Drupal - 14 December 2018 - 10:42pm

This article was originally posted on the Capgemini Engineering blog

A lot of people have been jumping on the headless CMS bandwagon over the past few years, but I’ve never been entirely convinced. Maybe it’s partly because I don’t want to give up on the sunk costs of what I’ve learned about Drupal theming, and partly because I'm proud to be a boring developer, but I haven’t been fully sold on the benefits of decoupling.

On our current project, we’ve continued to take an approach that Dries Buytaert has described as "progressively decoupled Drupal". Drupal handles routing, navigation, access control, and page rendering, while rich interactive functionality is provided by a JavaScript application sitting on top of the Drupal page. In the past, we’d taken a similar approach, with AngularJS applications on top of Drupal 6 or 7, getting their configuration from Drupal.settings, and for this project we decided to use React on top of Drupal 8.

There are a lot of advantages to this approach, in my view. There are several discrete interactive applications on the site, but the bulk of the site is static content, so it definitely makes sense for that content to be rendered by the server rather than constructed in the browser. This brings a lot of value in terms of accessibility, search engine optimisation, and performance.

A decoupled system is almost inevitably more complex, with more potential points of failure.

The application can be developed independently of the CMS, so specialist JavaScript developers can work without needing to worry about having a local Drupal build process.

If at some later date, the client decides to move away from Drupal, or at the point where we upgrade to Drupal 9, the applications aren’t so tightly coupled, so the effort of moving them should be smaller.

Having made the decision to use this architecture, we wanted a consistent framework for managing application configuration, to make sure we wouldn't need to keep reinventing the wheel for every application, and to keep things easy for the content team to manage.

The client’s content team want to be able to control all of the text within the application (across multiple languages), and be able to preview changes before putting them live.

There didn’t seem to be an established approach for this, so we’ve built a module for it.

As we've previously mentioned, the team at Capgemini are strongly committed to supporting the open source communities whose work we depend on, and we try to contribute back whenever we can, whether that’s patches to fix bugs and add new features, or creating new modules to fill gaps where nothing appropriate already exists. For instance, a recent client requirement to promote their native applications led us to build the App Banners module.

Aiming to make our modules open source wherever possible helps us to think in systems, considering the specific requirements of this client as an example of a range of other potential use cases. This helps to future-proof our code, because it’s more likely that evolving requirements can be met by a configuration change, rather than needing a code change.

So, guided by these principles, I'm very pleased to announce the Single Page Application Landing Page module for Drupal 8, or to use the terrible acronym that it has unfortunately but inevitably acquired, SPALP.

On its own, the module doesn’t do much other than provide an App Landing Page content type. Each application needs its own module to declare a dependency on SPALP, define a library, and include its configuration as JSON (with associated schema). When a module which does that is installed, SPALP takes care of creating a landing page node for it, and importing the initial configuration onto the node. When that node is viewed, SPALP adds the library, and a link to an endpoint serving the JSON configuration.

Deciding how to store the app configuration and make all the text editable was one of the main questions, and we ended up answering it in a slightly "un-Drupally" way.

On our old Drupal 6 projects, the text was stored in a separate 'Messages' node type. This was a bit unwieldy, and it was always quite tricky to figure out what was the right node to edit.

For our Drupal 7 projects, we used the translation interface, even on a monolingual site, where we translated from English to British English. It seemed like a great idea to the development team, but the content editors always found it unintuitive, struggling to find the right string to edit, especially for common strings like button labels. It also didn't allow the content team to preview changes to the app text.

We wanted to maintain everything related to the application in one place, in order to keep things simpler for developers and content editors. This, along with the need to manage revisions of the app configuration, led us down the route of using a single node to manage each application.

This approach makes it easy to integrate the applications with any of the good stuff that Drupal provides, whether that’s managing meta tags, translation, revisions, or something else that we haven't thought of.

The SPALP module also provides event dispatchers to allow configuration to be altered. For instance, we set different API endpoints in test environments.

Another nice feature is that in the node edit form, the JSON object is converted into a usable set of form fields using the JSON forms library. This generic approach means that we don’t need to spend time copying boilerplate Form API code to build configuration forms when we build a new application - instead the developers working on the JavaScript code write their configuration as JSON in a way that makes sense for their application, and generate a schema from that. When new configuration items need to be added, we only need to update the JSON and the schema.

Each application only needs a very simple Drupal module to define its library, so we’re able to build the React code independently, and bring it into Drupal as a Composer dependency.

The repository includes a small example module to show how to implement these patterns, and hopefully other teams will be able to use it on other projects.

As with any project, it’s not complete. So far we’ve only built one application following this approach, and it seems to be working pretty well. Among the items in the issue queue is better integration with configuration management system, so that we can make it clear if a setting has been overridden for the current environment.

I hope that this module will be useful for other teams - if you're building JavaScript applications that work with Drupal, please try it out, and if you use it on your project, I'd love to hear about it. Also, if you spot any problems, or have any ideas for improvements, please get in touch via the issue queue.

Tags:  Capgemini development Drupal Javascript open source All tags
Categories: Drupal

Override Title

New Drupal Modules - 14 December 2018 - 11:29am

Override Title provides an interface to override/change the title of the Node and View pages, providing a fast and full access to Administrator. Set permission to access for the rest of the Roles throughout the site.


Install as you would normally install a contributed Drupal module.
* See: for further information.


Categories: Drupal

Share Progress

New Drupal Modules - 14 December 2018 - 10:12am

This module provides integration to the Share Progress service for Email, Facebook and Twitter sharing.

Categories: Drupal

It's the most 'Wonderfund' time of year

Dries Buytaert - 14 December 2018 - 8:34am

Every December, Acquia organizes a gift drive on behalf of the Wonderfund. The gift drive supports children that otherwise wouldn't be receiving gifts this holiday season. This year, more than 120 Acquians collected presents for 205 children in Massachusetts.

Acquia's annual gift drive always stands out as a heart warming and meaningful effort. It's a wonderful example of how Acquia is committed to "Give back more". Thank you to every Acquian who participated and for Wonderfund's continued partnership. Happy Holidays!

Categories: Drupal

3 Game Juice Techniques From Slime Road - by Olin Olmstead Blogs - 14 December 2018 - 7:16am
Ever wonder how to make a game 'feel good' without adding anything that changes gameplay? Slime Road does just that with some very simple strategies.
Categories: Game Theory & Design

Lessons from La Rana - by Cole Thatcher Blogs - 14 December 2018 - 7:16am
Here are four lessons I learned while working on my latest game project, La Rana. La Rana is a game developed by fourteen graduate students at SMU Guildhall.
Categories: Game Theory & Design

Walking away from a Free-to-Play time sink - by Daryl Hornsby Blogs - 14 December 2018 - 7:13am
I've quit playing my favourite free-to-play game after 3 years of daily play. Why? Do I regret it? How does it feel to leave a game that I've played so much?
Categories: Game Theory & Design

Horses, Heists, and Guns... Oh My! - by Michael Carroll Blogs - 14 December 2018 - 7:08am
An examination of the player motivations that are present within Rockstar's Red Dead Redemption 2.
Categories: Game Theory & Design

The Use of Feedback Loops in Dungeons in Phantom Brave - by Samantha Wheeler Blogs - 14 December 2018 - 7:08am
Constantly challenging dungeons to make characters stronger in Phantom Brave could easily become tedious and boring, but the use of positive and negative feedback loops help keep gameplay interesting.
Categories: Game Theory & Design Blog: The Story of Agiledrop: Introduction

Planet Drupal - 14 December 2018 - 5:50am

We've started a series of blog posts that tell the story of what makes our developers successful when working with other Drupal teams. The first chapter introduces our workflow and the advantages it brings.

Categories: Drupal


Subscribe to As If Productions aggregator