Newsfeeds

The RPGnet Newsletter: RPGnet Newsletter #58

RPGNet - 23 June 2016 - 12:00am
Lots and lots of mutants.
Categories: Game Theory & Design

Business of Gaming Retail: Emergency Cash Management

RPGNet - 23 June 2016 - 12:00am
What to do in case of emergency?
Categories: Game Theory & Design

CKEditor Context Link

New Drupal Modules - 22 June 2016 - 3:23pm

This is a simple plugin that adds the ability to enter a link from the context menu (right click menu).

Categories: Drupal

Yokohama Deluxe Edition Up On Kickstarter

Tabletop Gaming News - 22 June 2016 - 2:00pm
While not as internationally known as, say, Tokyo, Yokohama is easily just as important in Japan’s history. It was the city that was first opened up to foreign trade (forcibly, but still…) after a long period of isolation for the island nation. As various traders made their way to the city, they brought various goods […]
Categories: Game Theory & Design

Check out the results of GameCareerGuide's latest Game Design Challenge!

Social/Online Games - Gamasutra - 22 June 2016 - 12:24pm

Gamasutra's education-focused sister site GameCareerGuide offers info for game industry students and beginners -- and every 3 weeks, it also hosts a Game Design Challenge that anyone can take part in. ...

Categories: Game Theory & Design

Features Role Permission

New Drupal Modules - 22 June 2016 - 12:14pm

This module adds Features support for exporting individual permissions per role. If you want to track the state of a role and only certain permissions for that role, use this module!

Note: it can quickly get confusing having "Permissions" and "Role Permissions" on the create a feature form. You might consider disabling "Permissions" (user_permission) on the Features settings form:

admin/structure/features/settings

Categories: Drupal

Granny Grating Armies Price Drops 2016

Tabletop Gaming News - 22 June 2016 - 12:00pm
Usually prices go up over time. Inflation and all that. But this story is about prices going the other direction. Paint.Play.Enjoy, the folks that make GGA (Granny Grating Armies), have decided that they’re going to be lowering the prices on their products starting on the 25th. The price decrease is being done in hopes of […]
Categories: Game Theory & Design

myDropWizard.com: Drupal 6 security update for Secure Password Hashes!

Planet Drupal - 22 June 2016 - 11:42am

As you may know, Drupal 6 has reached End-of-Life (EOL) which means the Drupal Security Team is no longer doing Security Advisories or working on security patches for Drupal 6 core or contrib modules - but the Drupal 6 LTS vendors are and we're one of them!

Today, there is a security release for Secure Password Hashes to fix a security bug.

By default in Drupal 6, all of a user's existing login sessions will be closed and the current session regenerated when a user changes their password. There was a bug in the Secure Password Hashes module that prevented this from happening.

With the help of the D6LTS vendors, a new version was released.

You can also download the patch the patch.

If you have a Drupal 6 site using the Views module, we recommend you update immediately! We have already deployed the patch for all of our Drupal 6 Long-Term Support clients. :-)

If you'd like all your Drupal 6 modules to receive security updates and have the fixes deployed the same day they're released, please check out our D6LTS plans.

Note: if you use the myDropWizard module (totally free!), you'll be alerted to these and any future security updates, and will be able to use drush to install them (even though they won't necessarily have a release on Drupal.org).

Categories: Drupal

Midweek Snippets

Tabletop Gaming News - 22 June 2016 - 11:00am
The week continues along. As it goes, so do we along with it. The weekend is coming up soon. It’ll hopefully be here before we know it. I’m going to an inaugural board game day at a library that a friend works at. Probably to play Guild Ball. I know that’s not technically a board […]
Categories: Game Theory & Design

June Releases Available for Eden

Tabletop Gaming News - 22 June 2016 - 10:00am
Happy Games Factory has posted up the latest releases for Eden. As usual for the game, it’s a rather eclectic group. Whether you want some renegade bikers, a guy with 3 arms and a gas mask, or some religious ladies, they’ve got you covered. There’s also a set of cards with the most up-to-date E&C […]
Categories: Game Theory & Design

A Question of Ethics (3.0)

New RPG Product Reviews - 22 June 2016 - 9:27am
Publisher: Wizards of the Coast
Rating: 5
Here's a bit of a delight: an adventure where there isn't a Bad Guy to defeat, rather there are two contending forces, neither of which is particularly good or particularly bad... and the party will have to decide which, if any, they are willing to help!

The background notes for the DM explain everything - it's a territorial dispute over an area that includes a wizard's tomb, with one lot wanting to turn the tomb into a base and t'other lot not being interested in the tomb at all, they're after a mineral nearby. But they won't talk, let alone share. A nearby town is holding a festival, which is assumed to be what gets the party into the area (although ther are other hooks if your lot aren't great festival-goers), and the module sets out to provide you with all the resources you need to let the party loose in the area and moderate whatever they decide to do... a neat way of handling a very 'open' plot.

These resources include notes on the town and the festival, which as well as the usual elements of a mediaeval fair includes an Arcane Challenge with a series of events for spell-slingers to test their prowess against each other. Naturally, a party wizard or sorcerer might like to try his hand... and others may be more interested in archery or fencing contests or even a cooking competition! Several NPC spellcasters are provided as opposition, along with notes on how they intend to address the challenges of the contest. If nobody from the party joins in, it can still make for an entertaining spectacle.

Just to add to the fun, there's another group of adventurers there, who are concerned by some encroaching stone giants and are trying to stir the town up to do something about them, and there is also a nasty disease spreading through the region. And, of course, there is the dispute that is at the heart of the plot. Everyone involved is detailed, along with what they are likely to do, how they will react to any interference, and what they are likely to be willing to negotiate about.

Finally, there's the wizard's tomb itself. This is mapped out (using a map from the Map-a-Week series on the Wizards of the Coast website, reproduced here although the original link still works at the time of writing) and is full of interesting things... and traps to guard them. Plenty of fun for those looking for a more traditional delve.

Ending with some notes on the consequences of some of the more likely party actions, this is a real gem of an adventure, with a lot packed into 11 pages!
Categories: Game Theory & Design

Lullabot: Using the Template Method pattern in Drupal 8

Planet Drupal - 22 June 2016 - 9:01am

Software design patterns are a very good way to standardize on known implementation strategies. By following design patterns you create expectations and get comfortable with the best practices. Even if you read about a design pattern and realize you have been using it for a long time, learning the formal definition will help you avoid eventual edge cases. Additionally, labeling the pattern will enhance communication, making it clearer and more effective. If you told someone about a foldable computer that you can carry around that contains an integrated trackpad, etc, you could have been more efficient by calling that a laptop.

I have already talked about design patterns in general and the decorator pattern in particular, and today I will tell you about the Template Method pattern. These templates have nothing to do with Drupal’s templates in the theme system.

Imagine that we are implementing a social media platform, and we want to support posting messages to different networks. The algorithm has several common parts for posting, but the authentication and sending of actual data are specific to each social network. This is a very good candidate for the template pattern, so we decide to create an abstract base class, Network, and several specialized subclasses, Facebook, Twitter, …

In the Template Method pattern, the abstract class contains the logic for the algorithm. In this case we have several steps that are easily identifiable:

  1. Authentication. Before we can do any operation in the social network we need to identify the user making the post.
  2. Sending the data. After we have a successful authentication with the social network, we need to be able to send the array of values that the social network will turn into a post.
  3. Storing the proof of reception. When the social network responds to the publication request, we store the results in an entity.

The first two steps of the algorithm are very specific to each network. Facebook and Instagram may have a different authentication scheme. At the same time, Twitter and Google+ will probably have different requirements when sending data. Luckily, storing the proof of reception is going to be generic to all networks. In summary, we will have two abstract methods that will authenticate the request and send the data plus a method that will store the result of the request in an entity. More importantly, we will have the posting method that will do all the orchestration and call all these other methods.

One possible implementation of this (simplified for the sake of the example) could be:

<?php namespace Drupal\template; use Drupal\Component\Serialization\Json; /** * Class Network. * * @package Drupal\template */ abstract class Network implements NetworkInterface { /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface. */ protected $entityTypeManager; /** * Publish the data to whatever network. * * @param PostInterface $post * A made up post object. * * @return bool * TRUE if the post was posted correctly. */ public function post(PostInterface $post) { // Authenticate before posting. Every network uses a different // authentication method. $this->authenticate(); // Send the post data and keep the receipt. $receipt = $this->sendData($post->getData()); // Save the receipt in the database. $saved = $this->storeReceipt($receipt); return $saved == SAVED_NEW || $saved == SAVED_UPDATED; } /** * Authenticates on the request before sending the post. * * @throws NetworkException * If the request cannot be authenticated. */ abstract protected function authenticate(); /** * Send the data to the social network. * * @param array $values * The values for the publication in the network. * * @return array * A receipt indicating the status of the publication in the social network. */ abstract protected function sendData(array $values); /** * Store the receipt data from the publication call. * * @return int * Either SAVED_NEW or SAVED_UPDATED (core constants), depending on the operation performed. * * @throws NetworkException * If the data was not accepted. */ protected function storeReceipt($receipt) { if ($receipt['status'] > 399) { // There was an error sending the data. throw new NetworkException(sprintf( '%s could not process the data. Receipt: %s', get_called_class(), Json::encode($receipt) )); } return $this->entityTypeManager->getStorage('network_receipts') ->create($receipt) ->save(); } }

The post public method shows how you can structure your posting algorithm in a very readable way, while keeping the extensibility needed to accommodate the differences between different classes. The specialized class will implement the steps (abstract methods) that make it different.

<?php namespace Drupal\template; /** * Class Facebook. * * @package Drupal\template */ class Facebook extends Network { /** * {@inheritdoc} */ protected function authenticate() { // Do the actual work to do the authentication. } /** * {@inheritdoc} */ protected function sendData(array $values) { // Do the actual work to send the data. } }

After implementing the abstract methods, you are done. You have successfully implemented the template method pattern! Now you are ready to start posting to all the social networks.

// Build the message. $message = 'I like the new article about design patterns in the Lullabot blog!'; $post = new Post($message); // Instantiate the network objects and publish. $network = new \Drupal\template\Facebook(); $network->post($post); $network = new \Drupal\template\Twitter(); $network->post($post);

As you can see, this is a behavioral pattern very useful to deal with specialization in a subclass for a generic algorithm.

To summarize, this pattern involves a parent class, the abstract class, and a subclass, called the specialized class. The abstract class implements an algorithm by calling both abstract and non-abstract methods.

  • The non-abstract methods are implemented in the abstract class, and the abstract methods are the specialized steps that are subsequently handled by the subclasses. The main reason why they are declared abstract in the parent class is because the subclass handles the specialization, and the generic parent class knows nothing about how. Another reason is because PHP won’t let you instantiate an abstract class (the parent) or a class with abstract methods (the specialized classes before implementing the methods), thus forcing you to provide an implementation for the missing steps in the algorithm.
  • The design pattern doesn’t define the visibility of these methods, you can declare them public or protected. If you declare these methods public, then you can surface them in an interface to make the base class abstract.

In one typical variation of the template pattern, one or more of the abstract methods are not declared abstract. Instead they are implemented in the base class to provide a sensible default. This is done when there is a shared implementation among several of the specialized classes. This is called a hook method (note that this has nothing to do with Drupal's hooks).

Coming back to our example, we know that most of the Networks use OAuth 2 as their authentication method. Therefore we can turn our abstract authenticate method into an OAuth 2 implementation. All of the classes that use OAuth 2 will not need to worry about authentication since that will be the default. The authenticate method will only be implemented in the specialized subclasses that differ from the common case. When we provide a default implementation for one of the (previously) abstract methods, we call that a hook method.

At this point you may be thinking that this is just OOP or basic subclassing. This is because the template pattern is very common. Quoting Wikipedia's words:

The Template Method pattern occurs frequently, at least in its simplest case, where a method calls only one abstract method, with object oriented languages. If a software writer uses a polymorphic method at all, this design pattern may be a rather natural consequence. This is because a method calling an abstract or polymorphic function is simply the reason for being of the abstract or polymorphic method.

You will find yourself in many situations when writing Drupal 8 applications and modules where the Template Method pattern will be useful. The classic example would be annotated plugins, where you have a base class, and every plugin contains the bit of logic that is specific for it.

I like the Template Method pattern because it forces you to structure your algorithm in a very clean way. At the same time it allows you to compare the subclasses very easily, since the common algorithm is contained in the parent (and abstract) class. All in all it's a good way to have variability and keep common features clean and organized.

Categories: Drupal

Munchkin Zombies Guest Artist Edition Coming This October

Tabletop Gaming News - 22 June 2016 - 9:00am
October’s just the right time to have all sorts of spooky and scary stuff come out for the hobby games we love. Steve Jackson Games certainly feels that way. As such, they’re going to have the Guest Artist Edition of Munchkin Zombies available that month. The guest doing this version is Greg Hyland (whom you […]
Categories: Game Theory & Design

Osprey Publishing June Sale Happening Now

Tabletop Gaming News - 22 June 2016 - 8:00am
As we move into the heat/cold of the next couple months (depending on your hemisphere), it’s good to have a book to either snuggle up with and read next to the fire, or to look over while escaping from the oppressive temperatures outside. Osprey Publishing is helping out with that, having a sale going on […]
Categories: Game Theory & Design

Unity, HTML5, CORS, and You - by Ben Vinson

Gamasutra.com Blogs - 22 June 2016 - 7:25am
When publishing your Unity content to the WebGL target, it is likely you will run into issues with CORS. This post gives an overview of how to configure your project to support CORS, and gives guidance on how to avoid some common pitfalls when doing so.
Categories: Game Theory & Design

Writing Bad: The Challenge of Writing a Villain&#039;s Story - by Josh Bycer

Gamasutra.com Blogs - 22 June 2016 - 7:25am
Video game storytelling has grown over the years, but is the medium ready to truly break bad?
Categories: Game Theory & Design

Creating Best Buds vs. Bad Guys with my son - by Richard Hill-Whittall

Gamasutra.com Blogs - 22 June 2016 - 7:24am
Best Buds vs. Bad Guys - about a game I created with my son Lucas, who was 11-years old when we began (he is now 12, fast approaching 13!).
Categories: Game Theory & Design

The Fighting Game Problem and How to Fix It - by Kronosaurus Teumessian

Gamasutra.com Blogs - 22 June 2016 - 7:21am
Fighting games are awesome, but the extreme learning curve that is more like a learning wall keeps some players from enjoying the genre even at a casual level. In this article we'll look at how to get a casual audience into your fighting game.
Categories: Game Theory & Design

Character Design - Part I - by Thiago Oliveira

Gamasutra.com Blogs - 22 June 2016 - 7:21am
Our studio has worked in creating a great variety of characters (so far we have around 80 different characters ready for the game). I'm showing off some of our game's art! In particular, characters that were inspired by real people or other characters.
Categories: Game Theory & Design

The Disco Generator: Procedural Level Creation in All Walls Must Fall - by Isaac Ashdown

Gamasutra.com Blogs - 22 June 2016 - 7:21am
All Walls Must Fall, the first commercial project from inbetweengames, takes place in the procedurally generated nightclubs of a divided Berlin. In this post, programmer Isaac Ashdown outlines the algorithm used to generate these clubs in Unreal Engine 4.
Categories: Game Theory & Design

Pages

Subscribe to As If Productions aggregator