FilmScout Released!

We are happy to announce the official release of FilmScout for iOS and Android.

FilmScout lets you keep track of your favorite filmmaker’s projects. You can search for information on your favorite movies and TV shows, check the filmmaking team, explore their works, and follow them to keep track of their upcoming projects.

Right now, you can track filmmakers in the following roles:

– Director
– Screenwriter/Writer
– Composer
– Cinematographer/Director of Photography
– Editor

Feel free to write to us with any feedback you have!

Handling AWS SNS notifications in Ruby on Rails

Today I’m going to share with you how to handle AWS SNS notifications in a Ruby on Rails app. An SNS topic publishes every message it receives to every subscriber, and our app is subscribed to receive these messages via HTTP.

SNS messages come in 2 types:

  • SubscriptionConfirmation: Is sent when a subscription is created to confirm that the endpoint is up an running. The confirm_subscription method handles this.
  • Notification: Once the subscription is confirmed, all the following messages will be of this type. These are the messages that are sent to a topic and then fanned out to every subscriber out there.

The verify_request_authenticity method is called first to verify the authenticity of the SNS message. It checks that the message is not empty and verifies its origin using the MessageVerifier class. Finally, the create method parses the message content accordingly.

I hope this can be of great help to everyone out there. Feel free to comment if you have any questions or feedback.

# frozen_string_literal: true

# Notifications coming from SNS
class NotificationsController < ActionController::Base
  before_action :verify_request_authenticity

  # @url /notifications
  #
  # @action POST
  #
  # Broadcasts a SNS message to an ActionCable channel
  #
  #
  def create
    case message_body['Type']
    when 'SubscriptionConfirmation'
      confirm_subscription ? (head :ok) : (head :bad_request)
    when 'Notification'
      message = JSON.parse(message_body['Message'])
      BroadcastExecutionNotificationJob.perform_later(message)
      head :ok
    end
  end

  private

  def verify_request_authenticity
    head :unauthorized if raw_post.blank? || !message_verifier.authentic?(raw_post)
  end

  def raw_post
    @raw_post ||= request.raw_post
  end

  def message_body
    @message_body ||= JSON.parse(raw_post)
  end

  def message_verifier
    @message_verifier ||= Aws::SNS::MessageVerifier.new
  end

  def confirm_subscription
    AWS_SNS_CLIENT.confirm_subscription(
      topic_arn: message_body['TopicArn'],
      token: message_body['Token']
    )
    true
  rescue Aws::SNS::Errors::ServiceError => e
    Rails.logger.info(e.message)
    false
  end
end

John Romero’s Core Principles for Game Development

Taken from his talk in GDC Europe 2016. You can watch the video at Youtube.

No prototypes. Just make the game. Polish as you go. Don’t depend of polish happening later. Always maintain constantly shippable code.

It’s incredibly important that your game can always be run by your team. Bulletproof your engine by providing defaults upon load failure.

Keep your code absolutely simple. Keep looking at your functions and figure out how you can simplify further.

Great tools help make great games. Spend as much time on tools as possible.

We are our own best testing team and should never allow anyone else to experience bugs or see the game crash. Don’t waste others’ time. Test thoroughly before checking in your code.

As soon as you see a bug, you fix it. Do not continue on. If you don’t fix your bugs your new code will be built on a buggy codebase and ensure an unstable foundation.

Use a superior development system than your target.

Write your code for this game only – not for a future game. You’re going to be writing new code later because you’ll be smarter.

Encapsulate functionality to ensure design consistency. This minimizes mistakes and saves design time.

Try your code transparently. Tell your lead and peers exactly how you are going to solve your current task and get feedback and advice. Do not treat game programming like each coder is a black box. The project could go off the rails and cause delays.

Programming is creative art form based in logic. Every programmer is different and will code differently. It’s the output that matters.

 

 

 

 

 

Track Squarespace form submissions with Google Tag Manager

I use Squarespace to build fast and beautiful marketing sites to attract customers to any product or service. Usually, these marketing sites include a contact form which you can use to track leads.

Squarespace offers poor documentation on how to track these form submissions with Google Tag Manager. I’ll explain how to do it assuming you already have an account with Squarespace, Google Adwords, Google Analytics and Google Tag Manager.

First, copy your Google Tag Manager code into Squarespace:

  1. Login into your Squarespace account.
  2. Click on “Settings”.
  3. Click on “Advanced”.
  4. Click on “Code Injection”.
  5. Copy your Google Tag Manager code in the header section.

code_injection

Now, let’s copy the following the code in the footer section.

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
  
var formSubmitted = false;

$(document).ready(function(){
    $('input.button').click(function() {
        window.setInterval(checkFormSubmission, 100);
    });
});

function checkFormSubmission(){
  if(($(".form-submission-text").is(':visible')) && (formSubmitted == false)){
    dataLayer.push({'event': 'formSubmission'});
    formSubmitted = true;
  }
}  
  
</script>

This code checks if the form is submitted without any errors and fires an event called formSubmission. We need to create a trigger in Google Tag Manager that fires when the formSubmission event is fired. That’s how we’ll track when a form is submitted.

  1. Go to the Triggers menu on your Google Tag Manager account.
  2. Click on “New”
  3. Write a name for this trigger. It could be “Web Contact Form Submission”.
  4. Select the “Custom Event” event.
  5. On the event name field write “formSubmission”.
  6. Click on “Create Trigger”.

web_contact_form_submission_trigger

Track contact form submissions on Google Analytics

  1. Go to the Tags menu on your Google Tag Manager account.
  2. Click on New.
  3. Write a name for this tag.
  4. Select product “Google Analytics”.
  5. Choose tag type “Universal Analytics”.
  6. Write you Tracking ID on the given text field (this is id is given by Google Analytics). Select “Event” in the Track type list and then click on Continue.
  7. On the Fire On step click on “More” and select the trigger you just created from the list and click Save.
  8. Click on”Create Tag.

web_contact_form_submission_tag

That’s it. Preview your tag to see check that everything is working and publish your changes. You can now check for this form submission event in your Google Analytics account.

Track contact form submissions on Google Adwords

  1. Go to the Tags menu on your Google Tag Manager account.
  2. Click on New.
  3. Write a name for this tag.
  4. Select product “Google Adwords”.
  5. Select “Adwords Conversion Tracking”.
  6. Fill at least the Conversion ID and name fields (if you have not created any conversions, follow this link and learn how to do it https://support.bigcommerce.com/articles/Public/How-do-I-add-Google-Adwords-Conversion-Tracking) and then click on Continue.
  7. Write you Tracking ID on the given text field (this is id is given by Google Analytics). Select “Event” in the Track type list and then click on “Continue”.
  8. On the Fire On step click on “More” and select the trigger you just created from the list and click Save.
  9. Click on “Create Tag”.

adwords_conversion_tracking

That’s it. Preview your tags to check that everything is working and publish your changes. Feel free to ask any questions in the comments section.

Special thanks to:
http://www.silvabokis.com/squarespace-tips/tracking-squarespace-form-submissions-in-google-analytics-using-jquery

 

 

 

Setup Resque in Heroku to Manage Background Jobs for a Rails App

Ha! You thought we were just about games, didn’t you? The truth is that we spent lots of time working on web apps, much more than games. And a lot of times these web apps need to send an awful lot of bulk email to spam their users. So here it comes, Resque to the rescue, to aid on the process.

Configuring Resque in Heroku was a painful experience that you should avoid by reading the following instructions carefully. I’m going to be pretty specific and show the exact configuration that worked for me. I’m going to avoid the localhost configuration and only stick to how to do it on production. I’m also assuming you already have Sendgrid installed on your Heroku instance.

First things first, make sure you’re using Rails 4.2 or above and Ruby 2.2.0 or above.

Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later. As it needs Redis to work you should have the following in your Gemfile.

ruby '2.2.2'
gem 'rails', '4.2.3'
gem 'redis'
gem 'resque', "~> 1.22.0"

Why Resque 1.22.0? Because on the official Rails API it says that Active Job has adapters for Resque 1.x. This is key. Don’t use the latest version, it doesn’t work. Stick to what’s in the docs.

If you’re unfamiliar with Active Job, check out this Rails guide : http://edgeguides.rubyonrails.org/active_job_basics.html

Now, go to your application.rb file and add the following code:

# We're telling Rails that we will use Resque to process background jobs
config.active_job.queue_adapter = :resque

Next, set up Redis in your Heroku instance. I’m using rediscloud here. There are other services available, but as I told you, I’m sticking to what worked for me.

heroku addons:create rediscloud
heroku config:get REDISCLOUD_URL

Create a new redis.rb initializer in config/initializers/ and add the following code:

if ENV["REDISCLOUD_URL"]
  $redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end

Create a new resque.rb initializer in config/initializers/ and add the following code:

# Establish a connection between Resque and Redis
if Rails.env == "production"
  uri = URI.parse ENV["REDISCLOUD_URL"]
  Resque.redis = Redis.new host:uri.host, port:uri.port, password:uri.password
else
  # conf for your localhost
end

Go to your lib/tasks folder and create a new file called resque.rake and write the following code:

require 'resque/tasks'

task 'resque:setup' => :environment

Now you need to create a Procfile if you don’t have one. Just create a file called Procfile in your Rails app root folder. A Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform. Add this to your Procfile:

resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=7 QUEUE=* bundle exec rake resque:work

This process will run every time you push your code into production.

You’re almost set. Now Change your email deliver method from .deliver_now to .deliver_later and push your code to Heroku.

Finally, go into your app’s dashboard and make sure you see something like this:

skitch

So that’s it. Sending emails should be working as a background process. Hope this was helpful. Don’t forget to leave a comment below.

We’re Alive!

Hello guys,

A couple of months have passed, but let me assure you that we’re close to releasing The Descent. As I predicted, our designer failed and we failed to meet our January release date. Then other things came up and we had to stop development entirely. The good news is that we’re releasing between May and June, no excuses. We’re working with a new designer who is producing quality work at a fast rate. Be ready! It’s just around the corner. You’re going to love this game!

Another Status Update of The Descent

Had a great meeting with our graphic designer yesterday. He got pretty excited and pumped up when he played the game and got a feeling from it I’m sure will help him on his work. But the most important thing is that he’s commited for the early next year release. I’m hoping it’s true, our last two designers have been very unreliable.

In other news, Tiogus is finally checking for bugs and sharing input on the game.

All is well, we’re on schedule and very happy to share this game with you guys very soon.

Status of The Descent

After almost two months of development, I’m happy and excited to announce that we are on schedule to release our iOS game (code named The Descent) early next year, hopefully on January. All the gameplay features are done. We’re going into beta phase right now. We’ll be polishing things up, balancing the game, and incorporating updated graphics stuff (we’ll have to push our designer hard).

As always, thanks for your support! You’ll be hearing a lot from us in the following weeks. Don’t forget to leave a comment below if you want to be part of the beta. Thanks again!

Game Documentary Recommendation – Indie Game: The Movie

Just finished watching this doc on Netflix. I highly recommend it, got me really inspired. I feel related in many ways to each character in the movie: the struggles, pain, grind and sacrifice everyone goes through. And ultimately the love that they feel for their craft that makes them fight till’ the end. I hope our story unfolds as theirs.

I leave you with two quotes that I liked:

You kind of have to give up something to have something great.
Tommy Refenes

If you don’t see a vulnerability in somebody, you’re probably not relating with them on a very personal level.
Jonathan Blow

Don’t forget to support the guys that made the movie:

Indie Game: The Movie