Game Announcement: Stargazer

It’s been almost 2 years since we released a game (The Descent) as we’ve been busy building and managing eCommerce apps for some of our clients. Early in January 2017 we decided to play around with some puzzle game ideas and have been working on a gameplay mechanic prototype ever since. We opted for a different development methodology this time – play test game mechanics first on a crude prototype and focus on technology later. Years ago we would have started with a specific technology in mind and then try to fit gameplay into the technology code already in progress (bad approach).

The prototype has pretty good potential to morph into a game of its own so at this moment we would like to announce Stargazer – targeted for release by Q1 2017. It will be exclusive for Android initially.

Stay tuned for more news.

 

 

Migrating from Parse Push Notifications

Several months ago Parse took everyone by surprise and informed developers that they would shut down all of their services by the end of January 2017. While the news initially seemed like an April Fool’s joke similar to their public announcement of Parse Pigeon, we disregarded the migration message that appeared in on the screen every time you logged into your Parse Dashboard:

The Parse hosted service will be retired on January 28, 2017. If you are planning to migrate an app, you need to begin work as soon as possible.

However after countless logins into the Parse Dashboard the message kept appearing in the topmost banner, almost as if laughing at us, and gradually we began coming to terms with the harsh reality – Parse was indeed shutting down and we were (again) forced to migrate our apps to a different Push Notifications provider. This is not new to us – we’ve been dealing with these kinds of migrations since early 2015 when we migrated one of our apps from Urban Airship to Parse.

Back then we had a single Android app that used Urban Airship to receive push notifications from a web application written in Rails. The notifications workflow was simple – the app user would receive a push notification every time an order was placed by a customer through the YouOrderIt platform. The Android app was intended for an administrative audience such as restaurant managers and admin staff and the push notifications simply contained basic order details. We built the app in October 2014 and selected Urban Airship as the push platform of choice because it was free and because we refused to evaluate other options – Urban seemed like a tried and tested choice so we picked it.

And then sometime in January 2015 Urban Airship began charging monthly fees for their services. We had been all along in the beggar’s free tier, which they couldn’t support anymore (I don’t think any provider truly achieves high margins in this push notifications business) so we got an email from Urban Airship Support to the effect that we had to pay a $200 monthly fee going forward. We didn’t have that kind of money to spare so we had to switch to something else (free) immediately.

A friend recommended Parse so we started looking into it. The platform seemed solid, very well documented and their Dashboard was more user friendly than Urban Airship’s. They also had a beggar’s free tier throttled up to 30 requests per second (RPS) and we were confident we would fall beneath that threshold since our apps were not experiencing load above 30 RPS. We migrated the Android app to Parse and experienced good push notifications performance and decent reliability. After this experience we decided to use Parse for our complete app portfolio.

So a couple of months ago while mourning Parse’s looming demise we were faced with a tough question: migrate to what? We were back again to the drawing board just like in the pre-Urban Airship days. For a complete month we deliberated the idea of implementing our own platform based on Amazon SNS, and we even studied technical guides on how to migrate from Parse to Amazon SNS (gruesome process), but we didn’t wish to become a push notifications technology provider. That would have further derailed us from our core focus.

We realized that no matter what we wouldn’t be able to come up with a flawed assessment that identified a perfect, always-free and long-lived push notifications platform. The #1 push notifications platform today might be dead one year from now (even if it’s backed by Amazon, Google or even Facebook – ironically, before announcing their shut-down Parse had been engulfed by Facebook), and that’s just a fact of the brutality of technology. Even if it doesn’t die the platform’s creator might wake up annoyed one day and decide to start charging monthly fees, giving you only two viable options – pay or get the hell out and migrate.

Given the fast-changing technology landscape we are constantly subjected to, we have to be willing to switch platforms ever year if possible and be prepared for the changes entailed with these migrations. We decided to switch to the next best FREE choice that catered to our requirements. So when another colleague recommended OneSignal, we checked it out and after noticing it was free and had a decent breadth of features, we decided to migrate to that.

Android Setup

From an Android standpoint migrating to OneSignal only entails a couple of code changes. Besides the OneSignal SDK setup, generation of a Google Server API Key and Gradle changes mentioned in the OneSignal documentation, you just need to add the following initialization method. Make sure this is called in your main Application’s onCreate() method:

void initOneSignal() {
    OneSignal.startInit(this).
              setNotificationOpenedHandler(notificationsHandler).
              setNotificationReceivedHandler(notificationsHandler).
              init();
}

In this example we are using a custom notifications handler but this is optional. For instance if your app only needs to display the push notification using the built-in behavior a custom notifications handler is not required. However if you need your app to perform custom logic every time a notification is received or opened, we recommend using a notifications handler:

public static PushNotificationsHandler notificationsHandler;

If you decide to use a custom notifications handler make sure you override the notificationReceived() and notificationOpened() methods depending on your notification handling requirements.

public class PushNotificationsHandler implements OneSignal.NotificationOpenedHandler, OneSignal.NotificationReceivedHandler {

    public PushNotificationsHandler() {
        super();
    }

    @Override
    public void notificationReceived(OSNotification notification) {
        // Handle notification received event here
    }

    @Override
    public void notificationOpened(OSNotificationOpenResult result) {
        // Handle notification opened event here
    }

}

That’s all for the basic code changes. However these code changes might not be enough to fully migrate your app and platform to the new notifications service. Consider the following situation – you make your code changes in your Android app to migrate from Parse to OneSignal and push the changes to Google Play Developer Console. If you already have users using a previous version of your app (the codebase of the previous version uses Parse or some other platform), they might opt to NOT update the app (which contains the new OneSignal code changes) for a while. You will be faced with a situation where different users are running different versions of your app – one Parse enabled and the other OneSignal enabled, and you have to support them both for business continuity’s sake.

As part of your business, if you are sending notifications to apps directly from the Admin Dashboard, this is simple since you can manually target these two audiences separately. However if you have a complex platform where notifications are sent from a web application that sends notifications to devices using the OneSignal API, you need to write logic to handle these 2 separate paths – the path to send notifications to devices using Parse and the other path where you send notifications via OneSignal. However this code will be temporary, once all of your users update their apps to the newest version using OneSignal, you just need to handle the OneSignal path.

We faced this situation with one of our apps. We have an e-commerce app that can be used to place orders. It is currently used by thousands of customers and was originally Parse-enabled. With the Parse implementation, when users placed orders the Android app would send order details to our platform’s RESTful JSON API, including the Parse device token of the user’s device placing the order. This info would be saved in a database server-side for later use. If an order was confirmed, the web app would read the order details (including the device token), and send a push notification to that specific device token using the Parse API. This was the Parse path. To handle OneSignal we made one small code change in the Android app – the app would send the device’s OneSignal userId instead (also known as playerId) to our platform’s API when sending order details. Retrieving the userId is simple, but you have to make sure you retrieve it after OneSignal successfully initializes. Also the implementation is asynchronous so your Android app needs to handle this non-blocking behavior gracefully:

// Call this inside your Android app if you need to retrieve the device's userId for later use

OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
    @Override
    public void idsAvailable(String userId, String registrationId) {
        if (userId != null) {
            // Save userId or registrationId
        }
    }
});

When we introduced OneSignal we had to create a separate path server-side to handle the OneSignal-enabled apps. The server-side pseudocode to handle both paths ran something like this:

// The code below runs when the server needs to send a push notification to a device

Order order = getOrderById(orderId);

// Parse path
if (order.hasParseDeviceToken()) {
    String deviceToken = order.getDeviceToken();
    Notifications.sendPushUsingParse(deviceToken);
}
// OneSignal path
else if (order.hasOneSignalUserId()) {
    String userId = order.getUserId();
    Notifications.sendPushUsingOneSignal(userId);
}

Once all of your users update their Android apps to the latest version running OneSignal, you no longer need the first IF statement in the server-side code to handle the Parse path. You can remove it and your notifications platform will continue uninterrupted.

Game Engines – To build, or not to build: The Eternal Conundrum (Part 4)

Go to Part 3

Design and Development of Condor Wars

It was June 2012. It had been almost 1 year since I traveled to Bogota to work on The Descent for 3 long weeks as I mentioned already in Part 3. During that time we completely forgot about game development for a while and parted ways momentarily. Elias continued work on his baby YouOrderIt, which he was developing exclusively for his restaurant and I continued my graduate studies. In Summer 2012 I started a 12-week internship close to Detroit, Michigan and found myself with a lot of free time on my hands. I was also in a contemplative mood and somewhat depressed during the first couple of weeks of the internship. This was prompted by many factors – the work was not hands-on and I feared losing my technical coding skills. I had this paranoia that if I stopped coding in cold turkey fashion (my new career path demanded a different set of skills – mostly technical but strategic) I would be bound to forget coding and the dread of this idea made me feel worthless. I had been coding for almost 11 years so programming was an essential part of who I was. For this very reason I always kept a side project under my belt at all times in addition to my full-time professional responsibilities.

The situation in Summer 2012 accelerated my desire to get back into coding mainly to feel better about myself:

  • I was afraid that after taking a 1 year break my coding skills had decreased (a fallacy since Bill Gates in 1995 claimed he could write “slicker” code than John Carmack during a Windows 95 event even though he hadn’t obviously coded for many years)
  • I was living in the middle of nowhere and the setting was depressive, further exacerbating my depressive mood
  • I was running out of Breaking Bad episodes to watch, needed something to do ASAP

The situation above made me open Android Studio immediately. I had never played around with Android and OpenGL so I decided to develop a small proof of concept to test ideas and scrape off some of the coding rust I had hypothetically developed over the past year. Also, I didn’t want to deal with the Android Canvas library ever again so OpenGL seemed like the only alternative available. Ten years before during undergrad I had dirtied my hands with OpenGL for 3D programming so I didn’t expect a steep learning curve.

I toyed around with the concept of a spaceship flying through the vacuum of space, moving with the use of thrusters and attempting to avoid planets and asteroids. After a couple of days I had the proof of concept in pretty good shape and had tested out OpenGL graphics rendering, physics, game controls and some game mechanics ideas. It felt like I had gotten back in coding form so I archived the proof of concept and began brainstorming other ideas that had the potential of maturing into an actual game.

After a call with Elias we decided we wanted to release something very small – even smaller than The Descent. The Descent’s development was problematic due to the limitations we faced with the Android Canvas library and because of our lack of focus and direction. We also faced some challenges in our art department which added more obstacles into the mix. After learning from previous mistakes we didn’t want to play around with new ideas but rather with something simple that felt familiar. We also wanted to avoid having to depend on an artist or graphic designer to deliver game assets. We only had a 10-week timeframe and we wanted to control all aspects of development – adding a 3rd party artist/designer in a constrained timeline felt like adding a potential dependency for release. My internship ended by the end of August 2012 and we were targeting to release before I went back to graduate school.

We decided to resurrect a game that Elias had developed in assembly language many years previously called Condor Wars. We already had the game assets – there were only 2 types of sprites: the player’s spaceship and the enemy alien. The latter came in 2 flavors: green and red. The game is reminiscent of Galaga and Galaxian and the mechanics simple – you control a spaceship at the bottom of the screen that can only move left and right. Enemy aliens spawn from the top of the screen and zigzag downwards towards the player. They spawn randomly at certain intervals and the game objective is to dispose of them with the laser. The player can shoot the laser by tapping the screen. The simplicity of this gameplay made the technical requirements trivial:

  • Draw a player’s spaceship sprite and the spaceship laser
  • Draw a black background with randomly generated stars that move downwards to give the illusion the player is traveling through space
  • Draw enemy alien sprites
  • Manage an array of enemy objects that spawn randomly from the top of the screen (NPC object management).
  • Draw enemy alien explosion animation
  • Draw the player’s spaceship explosion animation
  • Draw raster fonts that display the player’s score
  • Handle collision detection between the player’s laser and enemy bounding boxes and also between the player’s bounding box and enemy bounding boxes (simple rectangle to rectangle collision detection).
  • Play sound effects (no music)

The limited technical requirements above didn’t warrant the use of an SDK such as Corona or Cocos2D so using OpenGL seemed like a decent option. There were only 5 types of objects displayed on the screen at any point in time: 1) the player’s spaceship, 2) the player’s laser, 3) the enemy aliens, 4) raster fonts and 5) the black background with stars. Managing the rendering order for these 5 objects was already predefined so a complex Scene Graph implementation was not required. For example we knew the rendering order would be the following:

  1. Background and fake star field
  2. Player’s spaceship and player’s spaceship explosion effects
  3. Enemy aliens and enemy alien explosion effects
  4. Player’s spaceship laser
  5. Raster fonts

In the draw() method we just made sure to render the game scene in the above order. Some complexities were involved with the loading, managing and rendering of OpenGL Textures for all of these 5 objects. However we developed boilerplate OpenGL texture loading and management code and carried on without deliberating if using an 2D Graphics SDK made better sense.

So after 10 weeks of development we were close to release. My internship ended in late August 2012 and I went back to school. Two weeks later we finished development and released Condor Wars to Google Play. After almost 8 years Condor Wars became Helldorado Team’s first game officially released to an app store. Everything we had done before amounted to technical demos, prototypes and proof of concepts. We downloaded v1.0 of the game from Google Play and the game crashed horribly due to a last minute production release bug. A fix was made and we released v1.1. So we downloaded the patched version and played the game again. But after playing the first couple of levels we realized something: The game was terrible. After 2 or 3 levels we found ourselves bored and you were lucky if you didn’t find yourself yawning beyond level 4. If you had to find 1 word to describe the game it would be sleep-inducing. A friend of ours claimed to have reached level 255 (the last level of the game and a nod to the 8-bit era) but I’m prepared not to believe such tales.

We realized we had found ourselves releasing yet another prototype masquerading as a game – but that had been our intention all along. We had committed to develop and release a technical demo to Google Play in order to experience the Android app release cycle, and we learned valuable lessons from that process. Before development both our mission and goal had been clearly defined and we followed through till the end. In some ways Condor Wars was a pilot test, and the foundational code that was developed for it served as springboard for the development of Condor Wars Redux, where we made some of our biggest mistakes in our game development experience. For Condor Wars we picked the right library (OpenGL) for the technical requirements which had been correctly identified before development, so the mistakes we made with The Descent were not repeated.

When tempted to release something (either a prototype, a demo or some semblance of a game) early due to external or egotistical pressures some conflicted developers advice to consider the words an ancient and wise monarch (who was also an accomplished coder) once said:

“Cherish an unpolished gem in your local machine. Abhor a turd in the App Store.”

– Alexander the Great of Macedon

With Condor Wars we learned that as a developer you are constantly faced with the following predicament: release your technical demo too early thinking that it can pass off as a game, or hold off the release of your pet project until it achieves a certain level of “perfection” or it fulfills your unrealistic ambitions. Most of us are tempted to lean towards the latter, and this is exactly what happened with The Descent (amongst other issues). Despite what Alexander the Great once said, it is better to release a piece of excrement to customers and gain valuable feedback than to let your closely guarded, ambitious project that hasn’t seen the light of day fall into oblivion due to your own high standards.

The disappointing story of Condor Wars Redux, as it was codenamed, will be the subject of our next article.

Game Engines – To build, or not to build: The Eternal Conundrum (Part 2)

Go to Part 1

As game developers, our main goal is to make games, and fun games. And by fun we mean games we want to play and games that will be dowloaded and played by others consistently. For the purposes of this article we are not going to dwell on all aspects of game development – from coding to play-testing all the way to marketing. We will only focus on development aspects because these are the areas we as game developers can control and cannot be affected my external factors or luck. After all whether your game gets 1000+ downloads on its release date is due to many factors. These factors will generate their own set of headaches so it would be best not to focus on them at this time.

However, you can control gameplay mechanics – if you want the game character to move left or right depending on the intensity of the swipe of the screen (for a mobile game) you just open Xcode (or Android Studio or any other IDE) and code the damn thing. Whether you succeed in this attempt might also depend on the number of brain cells you have but we assume your brain is perfectly equipped with these otherwise you wouldn’t be reading this article.

The game development landscape has changed quite a bit. We now have countless of avenues that can be used to release our games for instance Steam, Google Play, and App Store to name a few. Literally thousands of games are released every day and there is no such exclusivity and scarcity of games like there was in the past. In the early-to-mid 90s if you wanted a free PC game you had to scavenge your way through shareware sites and you were lucky if any of the titles available tickled your fancy. We now have an irresponsible overload of games and the result of this folly is that Google Play and App Store have become graveyards for the majority of games that are released every day. There are just too many games out there. Sometimes I ponder why we haven’t faced a mobile game industry crash like we did with video games back in 1983 (thanks Atari!).

Even if you (as an independent developer) think your game is solid and “fun”, there is no guarantee that your precious little addictive game will not be at the bottom of the App Store rankings and fall into oblivion together with thousands of other orphaned titles. The basic lesson is that game development is hard not because coding is hard but because game development is an intractable medium with success factors that cannot be easily controlled. And we have to learn to live with it. For many aspiring developers months of sweat and blood during development hells amount to nothing. Titles are released by countless of established companies or independent teams with the uncertainty of Julius Caesar crossing the Rubicon. You push the Archive button in Xcode with high hopes to release your title to the App Store and literally alea iacta est, the die is cast – leaving almost everything to chance and leaving your hundreds of hours of development at the mercy of App Store ranking algorithms.

My wish is not to alarm readers – I am just basing the above observations on previous experience. In a nutshell the main lesson is that game development as a whole is hard albeit fun and rewarding and we should be prepared to navigate the harshness of the terrain ahead throughout our game development journey. This demands a different kind of mentality. Understanding the uncertainties ahead we have to cherrypick our battles wisely and know what to focus on when we sit down and open Xcode to start developing.

As a game developer it is very easy and quite tempting to get bogged down on unnecessary details such as the technical intricacies of developing a new “font rendering library” or a “special effects/particle rendering system” for our little game even if it sounds fun to write and perhaps because I could potentially learn something useful from writing it. We sometimes face Developer’s FOMO (Fear of Missing Out). If we don’t know something inside out, or if we don’t develop it ourselves we don’t feel in control. Using someone else’s library or SDK equates to surrendering control to a 3rd party who is a subject matter expert in a specific area, and this thought hurts our ego. We are even prepared to think: “That random guy in Ukraine created this beautiful PNG compression library for hardware accelerated games which I probably need for my game. He built this library with his bare hands, so I can too! I will probably learn something cool and useful along the way!”. These internal monologues pigeonhole us into unrealistic and inefficient paths – further detracting us from our goal to focus on more value-add game development activities for example pure gameplay mechanics.

We even make ourselves believe that some 3rd party developer’s highly acclaimed font rendering library could become obsolete or deprecated in the future and create a potential external dependency. An asteroid could also fall on the 3rd party developer’s head and kill him and that would be a frustrating inconvenience – who will support that library in the future? Better to write it ourselves right? We dread having to deal with these external dependencies and factors so we have the temptation to avoid them at all costs. The worst thought of all is thinking we need to write something ourselves because we could potentially modularize it, package it and use it in the future for another game. Maybe even sell it! The possibilities are boundless! Chances are your nice little font rendering library works fine for a subset of use cases isolated to your game and cannot be used a second time because your next game might have different font rendering requirements. Chances are that perhaps you are never going to build a second game because you wasted all of your energies writing foundational engine code, recreating graphics, physics and all other core libraries yourself and no longer have the stamina to focus on gameplay code for your hypothetical second game.

Our optimism and wishful thinking clouds our judgement and we easily lose interest or get burnt out along the way. We end up with games made up of 70% foundational engine code and 30% half-baked game play mechanics because we didn’t have the discipline to focus on gameplay code – we have no gas left in the tank because we focused all our energies on library and game engine development and nothing else. We end up with half-finished prototypes or nifty technical demos that only we can admire in silence as we secretly pat ourselves in the back on a job well done. We are delusional to a certain degree. We admire the intricacies and the complex moving puzzles of our custom-made particle rendering system even though users are not playing (or reviewing) our games over and over again due our special effects library’s ability to render 50K particles in a single frame with ease. It’s how gameplay mechanics interact with other technical subsystems to provide players with an overarching experience that is fun, challenging, rewarding, immersive and stimulating. As game developers this should be our sole focus.

At Helldorado Team we’ve fallen prey to all of the above fallacies during the past several years and we would like to share our experiences answering the to build or not to build question in our past game projects whenever we’ve faced a decision to build core engine code. Stay tuned for more.

Go to Part 3

Game Engines – To build, or not to build: The Eternal Conundrum (Part 1)

A young, aspiring game developer is one of the most admirable human specimens you will ever encounter. Eager, hopeful of the future and with a insaciable hunger for knowledge, he strives to learn by experience anything he can lay his hands on. In this respect a young game developer is like a sponge and no dissimilar to a 2 year old toddler. Knowledge is a precious jewel to be acquired and guarded at all costs. During the early phases of learning a game developer has no focus since everything could be potentially useful – algorithms, design patterns, optimization, data structures, game engine fundamentals, graphics programming, rudimentary AI concepts, Newtonian Physics, etc. The list goes on an on, but during those stages everything is interesting and non-trivial – as each of these topics has the potential of building on the foundation necessary to become a well-rounded game developer.

Many of us recall those early phases – deep-diving on graphics programming concepts, contemplating on the differences between 2D and 3D graphics programming, understanding (or more accurately attempting to understand in vain) Binary Space Partition (BSP), texture mapping, software rendering, shadowing, the different kind of shading (flat vs Gouraud vs Phong vs whatever else became industry-standard these days). Those are just a subset of topics, but we all recall the countless prototypes we put our hearts and souls in – written in old Microsoft DirectDraw interfaces or OpenGL. Little algorithms that we feel so proud of, that satisfied intellectual and problem-solving longings but more than that strengthened our foundations in game development. These little programs served their purpose at the time – we needed to understand these concepts well and we felt a fascination in understanding the complex, interwoven puzzles that make up what we see on the screen – from the pixel drawn on the screen to the shadow cast by a game character in a simulated ground.

Our first prototype of a pixelated blur resembling a spaceship blasting away more pixelated bullets was one of the most gratifying moments of our professional or amateur careers. We understood why those pixels move and how the algorithms we wrote organize the bullets to be shot. The academic and intellectual goal reached, we moved on to more ambitious prototypes in the search of testing newer and more complex ideas. At the time, the more we read and the more the dug inside the game engine trenches the more intriguing the whole experience became. Today we learn how a pixel is drawn on screen, tomorrow we could learn how to perform full object culling with algorithms written with our bare hands. The possibilities seemed limitless.

The desire and the hunger for dwelling to such granular levels in our conquest of every game programming is also rooted by the stories we read as well – real or romanticized. We read how highly motivated duos, trios, quartets or even lone wolves lock themselves up in a basement or a lake house and by the sheer momentum of ambition pull off a feat unmatched by today’s standards. These are the Carmacks, Romeros, Sweeneys and the Ken Silvermans that we both admire and to some degree despise. Admire because of their monumental accomplishments that we so highly covet. But we also hate them because they accomplished so much with so little at their disposal at the time. In turn today we have so many resources at our disposal that this comparison seems both unfair and shameful. John Carmack and Tim Sweeney both developed game engines from scratch on their own. Carmack single-handedly developed software and hardware-rendered graphic engines for multiple blockbuster titles with the rapidity of an industrial assembly line. Sweeney performed a similar feat. Ken Silverman is honored now with a more memorable task given a shorter timeframe – this one man army surpassed the technical accomplishments of id Tech 1 (Doom Engine) and produced the Build Engine now used by several games that are household names in the PC gaming community. He was 17 at the time. We need not pay homage to Romero here. This self-proclaimed “Project Specialist” did everything that was necessary to ship a game out the door – game design, game programming, graphics programming, tools programming, level design and even PR to name a few.

I believe that the stories we read in books such as Masters of Doom both inspire and set the wrong expectations for aspiring game developers in 2016. Inspiration is most welcome, but truly speaking the dangers of setting wrong expectations (or standards) as game developers far outweigh the benefits of short-term inspiration. After reading such books we want to be heroes like the ancient legends of the 80s and 90s and feel the need to become jack of all trades like them. We want to be able to write gameplay code, draw digital art ourselves as well and similarly be able to re-create Carmack’s Reverse Shadow Volume Algorithm by memory. This is what developers did back then so why should we be deprived of similar honors?

Our egos are already hurt because we are now one Google keyword away from finding that solution in StackOverflow that has eluded us for days on end. However we now live in a highly-specialized environment. We are no longer in the nostalgic era of the 90s. Highly dedicated garage duos are now seldom producing and releasing blockbuster titles in Steam, Google Play or the iOS App Store. In the same vein there are no such things as prodigious hermits living in grandma’s basements developing every single granular component of a game (graphics, physics, AI, network, etc.) themselves. This myth is both dangerous and irresponsible to believe. The current environment is forcing us to become more specialized in the skill sets we can offer to the game industry.

To be a game developer 25-30 years ago meant many things. Nowadays it has a very different meaning.

In this series of articles I will be discussing one of the conundrums that has been a heavy burden for Helldorado Team (for many years actually) regarding Game Engine Development: to build or not to build your own game engine. I will discuss the wonders, perils and what to take into consideration when attempting to tackle this dilemma. Stay tuned!

Go to Part 2

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.

The Descent v1.2 and Free Version Released!

We just released an update to The Descent (v1.2) but we realized that a small but pestering bug was introduced related to achievements (boo!). Somehow, even though the game only has achievements you can unlock once, Game Center will keep showing the “you’ve unlocked achievement..” after unlocking the same achievement over and over again. Somehow we believe Game Center doesn’t really know you’ve unlocked the achievement so it keeps unlocking it all the time after you earn it. We are looking into the issue ASAP and will let you know (via a blog post or a push notification directly to The Descent app) when we find a solution.

Luckily, we also released a free version of The Descent that is now available for download:

The Descent Free!

This version doesn’t exhibit the weird achievement bug mentioned above and it also shares the leaderboard of the paid version of The Descent. Switch now to the free version so you don’t get blasted by repeated Game Center “new achievement unlocked” notifications!

The Descent v1.1 Released!

After a couple of hiccups during the v1.1 app update review process, The Descent v1.1 is finally released – available exclusively on the App Store. We added music on the title screen and new sound effects on the game over and new record screens. Some bug fixes have also been included in this update.

We’re working on the v1.2 update which will include more bug fixes and some new UI elements. We will also be including push notifications to help us keep players informed when new game updates are available.

At the same time of the v1.2 update we will be releasing the free version of the app for players who want to try the game before purchasing it. The v1.2 update and the free version of The Descent are scheduled for release sometime this week (depending on how the update review takes). Stay tuned!