Thoughts on Heroku

After deploying over 10 applications with Heroku I think that I can finally make a fair assessment on the general developer / Heroku relationship.

After watching an excellent talk by Matz at Waza (link at the bottom) I was taken aback by how much he seemed to respect Heroku’s ability to support the developer that wants to build. Heroku’s use of  AWS to anyone to standup a system to run their code at no cost is an absolutely stunning accomplishment .

My skepticism with this idealistic view is that at the end of the day Heroku is a business that needs to make money. But they also need to keep their image and offer the “playground” to build and prototype without needing a budget.

During the talk Matz mentions this ability to spin up a prototype at no cost which as being something fundamentally new and exciting. Having this ability eliminates a the large risk of money puts people in a new age; one where there is no barrier of hardware costs preventing concepts to come to life.

Heroku as a company proves that hardware is cheap and that it is feasible to remove the hardware barrier that used to exist less than 10 years ago(someone tell me if I’m wrong, I was 13 and it was too expensive for me). For developers that like to build things from the ground up Heroku is a wonderful tool that should be utilized to its fullest for as long as you can use it for free.

I am not sure about the exact price model of Heroku’s production ready systems are but I think that it becomes clear pretty quickly that if you are building to grow and scale Heroku may not be the best option.

I will use a real world example of a small sinatra app that is currently hosted on Heroku for the steep price of $0.

I have 1 Dyno with 512 MB of RAM that likes to shut off when it becomes inactive for a certain period of time (smart on Heroku’s part for sure to keep costs down), 1 MongoHQ instance with 512 MB of storage (they call it sandbox mode so this is an expectedly low amount of storage).

When upgrading from the Standard (free) dyno it would cost me $34.50 to essentially double my computer power and have a cycling set of dynos that will work together as a failsafe mechanism. I have just recently started crashing dynos and am thinking that it would be nice to have a backup that is reliable without having to do any system work to setup proper restarting and recovery (no god debugging for me sounds pretty sweet).

For any additional storage I would be paying around $18 per GB of SSD storage hosted through MongoHQ (of course an Amazon service wrapped in an add-on pricing model). I am not sure what the going rate for a mongoDB hosted solution but that seems a bit pricey to me if you are going to do large lazy data storage like I have been enjoying. But to be fair that could easily be moved to another database since in reality it’s just a minor detail.

When laying out the costs to double the performance of my small application it would be ~$52 a month. TBH that isn’t a horrible price for no extra work scaling. I am curious what the minimal cost of this setup would be on AWS directly (I do know that if you want to run tests on postgres instances it will cost you a pretty penny at the end of the month).

References

Matz at Heroku’s Waza (2013)

Stop Being Lazy and Learn Haml

There is nothing wrong with the desire to write familiar code when writing dumb views. There seems to be this idea that using erb is good enough because so many of us are used to seeing good old standard html. As someone who has done many projects without haml (simply because it was easier to get started) I feel like a fool for falling into this trap over and over.

When researching Haml it may not be clear what you are getting yourself into.

To be honest the above code doesn’t look to be that bad to me. Clear and to the point. Plus I have a good idea of what the browser output is going to be.

The raw number of keystrokes should be striking to get the same browser output. The declarative simplicity that Haml provides is unbelievable when you consider all the bullshit we deal with when writing HTML. Anyone who written web apps can tell you at least one tail of a missing closed tag.

I was hesitant about writing something that wasn’t what I knew and used for a long time. The notion of “what works for me” is not a good enough reason to write code that is sub par. Since most devs are bright enough folk I don’t think learning Haml is more than a 1 micro-project away from being your new favorite way to write your views.

For more information on Haml check out the Haml Homepage. All links to get started should be easily accessible from there.

The beauty of using haml in every day development is that your code shape will be forced to be much nicer and cleaner. Consider writing a container div with a header, body, and footer.  One would hope for clear structure that tells a “foreign eye” exactly what is going on in the given view.

Just imagine the skeleton that would evolve in the html version of this as a clean slate to start from.

As anything gets added to this skeleton you hope that the structure stays readable. I think that the forced structure prevents you from being your own worst enemy . Because of this simple fact I am turning into a Haml guy and think a weekend using it will convert any non-believers.

 

 

Merging Projects in Gamemaker

2 projects sometimes need to get merged together but GM utilities are not able to do this cleanly / at all. Because of this we have to turn to a manual merge strategy (possible automation would be simple) but here is the basic strategy.

Grab the project that you want to merge into the master project and figure out what will be needed in order to recreate the game in the other project. Below is a picture of the import that I was doing for a project

runnerGame

Resources work in the same way so I will use the example of an object. We will add the obj_bee to the master game.

First we want to go ahead and add an empty object to the master project.

beforeObjects becomes afterObjects

Save and Close GM.

Now we use our handy explorer to perform a copy and paste of our completed object(on left) into the master project (on left)

copyReplace

Now we reopen our project and we should see the changes in our object.

objectFilled

Adding sprites is similar except you will also need to add the proper image found in the sprites/images folder. The rest of GMs resources follow the same structure and can be imported in no time flat.

Hopefully GM will fix the functionality of the import button but in the meantime this is how I am doing them.

* If this is not patched by next major release I will ask for / create a utility to do this. (Drill down the structure of project to be imported and create the resources)

 

Plants vz Zombies: Garden Warfare

Review: Plants vs Zombies: Garden Warfare

I have to say I was skeptical about what EA was going to be delivering for the 30 dollar price tag. Since the original Plants vs Zombies had been so successful and widely played it made sense to try and create a new game with the same mass appeal as the original. I was fortunate enough to be introduced to the game on the PC and had a great time creating my structures of peashooters and sunflowers.

http://static-www.ec.popcap.com//www.popcap.com/sites/all/themes/popcap_2012/games/plants_vs_zombies/screenshots/pvz3.jpg

PvZ History Lesson:

Plants vs Zombies was released in 2009 by PopCap for OS X and Windows. It was massively popular with anyone who put their hands on it (I have not asked anhy Evangelicals about their opinions) and was good enough for ports to be demanded for the usual players (Xbox, iOS, PSNm DS, Android, Windows Phone, Vita, Blackberry 10). Yeah the game was good enough for them to make it on Blackberry, unreal.

Unfortunately all the success must have gone to an execs head and Plants vs Zombies 2: It’s About Time is born. The release came out in 2013 and came packed with the ever loved In-App Purchases. I got an iPhone around this time and was stoked to play a new PvZ game but upon ~ 2 hours I was over it and pulled up the original for old times sake (because I wanted to play quality again).

http://images.gizmag.com/inline/plants-vs-zombies-2-review-3.jpg

And now another game is set for release with the hopes of pulling in the Xbox One crowd who have <15 games to choose from (as of April 2014). While the game does not do anything particularly “next-gen” on the One it does play flawlessly and looks great.

#INSERT GAMEPLAY CLIP

The game is split up into 4 recognizable game modes; Team Vanquish (Team Deathmatch), Capture/Defend(Gardens and Graveyards), Non-stop Onslaught/Horde(Garden Ops), Bomb Plant(Gnome Bomb). The first 2 are the main modes for competitive online play and can be played in various matchmaking options which allows for whatever spectrum of variety you want. The final mode is exactly what you expect and want from any Nazi Zombies/Gears Horde mode; building defenses and holding out until you lose or die of boredom (I’d much rather nerd stomp than beat a computer, but that’s just me).

The Plants and the Zombies are played as separate factions with various classes much like you would find in TF2.

http://upload.wikimedia.org/wikipedia/en/5/59/TF2_Group.jpg

Fortunately the guys over at PopCap had a pretty good cast to work with and really did a great job capturing many of the lesser used but still memorable plants (tossing a Chilli Bean Bomb out and catching multiple zombies). The game does not leave the player hanging on any of the upgrades for both weapons and appearance that all Call of Duty fan boys would expect from their freshly skinned clone.

http://media1.gameinformer.com/filestorage/CommunityServer.Components.SiteFiles/imagefeed/featured/electronic-arts2013/popcap/PvZGardenWarfare/PlantsVsZombiesGamescom-610.jpg

Balance feels right on target; you get punished for doing stupid things (peeking multiple enemies) and you get rewarded for holding good angles like you should in any shooter. The variety of classes has been more than enough to keep my interest for long sessions and short stints on a Chomper spree.

The humor and general attractiveness of conflict between plants and zombies shines and excels in the third person genre. While the most hardcore shooter fans may not enjoy the childish nature of the game, and the fact that you have to use the mute all button at all times because of the amount of children yelling into their headsets about their childhood issues. If you can get past the small annoyances of a game being tailored towards kids then third installment of the Plants vs Zombies franchise is a huge success.

http://images.gameskinny.com/gameskinny/40a23d8460ea8e56f285eeb5bac9f356.jpg

The game has ticked all the boxes that I had going in to make a truly enjoyable shooter (I have stopped playing Titalfall as my goto shooter for 2 4 weeks). Even though the game can feel hectic on the initial intake of online with the 12 man teams, after some experimentation and learning it becomes clear what you can and can’t do in this “kiddie shooter”.  I found myself taking Gardens and Graveyards matches seriously even while playing a Sunflower healing a flaming Cactus. Plants vs Zombies: Garden Warfare is a great game on it’s own but when done on top of a beloved Tower Defense game it is truly one of a kind.

4.5 / 5
*Includes +.5 personal bias for extending the original game to a great shooter

Working for Clients

Not really sure how to start this but I have been put in a strange position as a programmer. I was given an amazing opportunity to work with talented artists and create games for clients who did not want to make the games themselves.

We were essentially being contracted to make a client’s games a reality. This sounded strange to me initially but whatever it was an opportunity to work on some games with some talented artists (what artists do blows me away so I am like a giddy child at this point).

First client wants us to make a platformer that he wants to be “kinda like the new Mega Man”. First off, Mega Man is da bomb like dude how am I supposed to compete/make the new Mega Man after those guys had 4 attempts to make the best Mega Man game and possibly the best platformer in that era of gaming.

In addition I am told I can’t see source code for the original engine that was built and abandoned.

At the point I was coming to the game I was given the base art that was being used (player, enemies, the animated goodies) and some background that were built for a kickstarter that was planned on being launched.

Over the course of 3 weeks I spent every weekend and every night I could after work on this game to get a working prototype 2 weeks before the kickstarter was set to launch.

http://i.imgur.com/BdYiqaE.png

Client is excited and then fades off the face of the earth. Gotta love cyberspace.

New client comes to us and says he wants a card game made that he has already created into a physical game that could be played. What the wa?! I am a nerd so I played a ton of Magic (MTG) and was beyond excited to make something even half as cool and get paid to do so in my free time.

This client was much more interactive and gave constant constructive feedback on the prototypes I was building for him (~1 a week) and I honestly thought we were on track to get this to the playable alpha on android we were seeking for.

http://i.imgur.com/iKL93dG.jpg

Again client does not pay and does the classic Houdini trick.

The reality of the situation is that client work is dependent on the client. When bad clients are found and free time is spent on projects that will never see the light of day it is disappointing to folks like me who wanted nothing more than to make your vision a reality.

I have worked with great clients before and think that this should just be a warning that this is a possible reality.

Keen1a

Advice to Young Gamemaker Game Makers

Learn.

Everyone has to start somewhere; John Carmack stared with Commander Keen before he created the original Doom nearly 3 years later.

It is important to understand that the discipline of programming extends beyond just creating a games. In order to properly understand and utilize GM and all its magic its important to try other engines, build targets, languages, anything you can get your hands on and have fun with.

Commander KeenDoom (duh)

Never ask for a copy paste answer, figure out the answer for yourself; ask questions when/where you don’t understand, read others’ code to learn about how they have solved similar problems.

Only way to be a better programmer is to try new things in the pursuit of knowledge.

*Just my thoughts. Was much more of a rant before the 3rd edit.

flappy-bird

5 Games to Clone that Aren’t Flappy Bird

Motivation for this comes from the number of posts I have seen in the past week from folks looking to clone Flappy Bird as a way to learn GML. I personally don’t see that as a particularly exciting exercise and wanted to offer a list of alternative games that could be cloned (in the name of learning).

1. Snake – Simple game with few requirements (food generation, score tracking, snake movement, growth, edges, etc.)

http://www.bubblews.com/assets/images/news/1441384178_1365795351.jpg

2. Asteroids - Classic space combat “simulator”. Much like Snake there isn’t a large number of requirements but movement is more complicated to get right.

http://cdn.unleashthefanboy.com/wp-content/uploads/2013/07/Asteroids.jpg

3. Galaga – One of those classic games that helped define the side scroller space shooter for so many others. There are so many ways to take this exercise but remember to keep it simple.

http://upload.wikimedia.org/wikipedia/en/2/2a/Galaga.png

4. Contra - This is not an exercise of creating an impossible game but rather a creation of an action side scroller with solid jump and shoot mechanics. It would be a good bonus to work on creating reactive enemies.

http://nerdbacon.com/wp-content/uploads/2013/12/sensor.jpg

5. Final Fantasy (JRPG) – The classic turn based attack system. Good exercise to keep track of player stats, enemies, items, and general phases of gameplay. The most important part of the exercise would be to implement a simple fighting system

I think each of these are much more valuable learning exercises and should not be beyond the scope of someone looking to learn more about making games. Imitation is the highest form of flattery so pay respects to the greats.

jumpin

Handling Jump

Platform Breakdown: The Jump

Programming a jump is pretty simple but there are a few types to consider when making the jump for a platformer.

First consider the game City Jump nothing simple just a game where the only controls are to jump either low or high. Now consider the game Super Meat Boy, where jumping can be done in various increments of height all controlled by when the jump button is released.

These two games represent two unique styles of jumping: (1)You get what you get, (2)Hold for Max Or Release to Fall.

Both are valid for the given game but for the example I have selected the implementation is done for the second case, because it’s more interesting.

Handling Jump

We want to start to launch the player upwards but want to make sure the jump is allowed with a _can_jump verification.
In this example I am passing around a _jump *convenience* variable around that is not necessary since you can take a look at the current vspeed to determine the state of jump.

Release Jump Button

The desired effect is for the player to be able to control the end of their jump with the release of the button.

Step Event

I want to limit the max fall rate so I do that at the same time I am ensuring the convenience gets set.

For all intents and purposes this step event could be removed because they are extra constraints attached to the example.

Nothing too complicated just a little bit of experimenting to find the right height and max fall rate and you are good to go.

horizontal movement

Horizontal movement

Platform Breakdown: Horizontal Movement

Moving left and right is not a difficult task to program but there are few things that if passed over will create an uncomfortable feel.

Uncomfortable controls in any game are a big no-no so let’s try to avoid that at all costs.

The sample code if for a platformer with a few basic ideas; when running you can reach a top speed(allows you to make longer jumps), slowing down from top speed is noticeable or Acceleration and Friction.

Keyboard Right

Everything you would expect to see in movement; set appropriate sprites and scales for drawing, convenience variables, and the actual movement.

Edit: Much cleaner to remove magic of hspeed (cbbc21)

There is some playing to be done here to figure out exactly how fast your base movement speed should be.

Handling Acceleration

This is done in the step event and for this example is being done whenever movement begins. You can easily change the conditional to wait for another button press to create some type of sprint button.

Key-release Right

On release there is a lot of resetting to be done but we want to make sure that things don’t jerk to a halt.

Friction

When release is set we want to slow down until we reach the inevitable halt. The equation used to calculate horizontal speed is pretty simple.

The important thing here is to set friction at a reasonable rate. Reasonable rate may mean different things: in Sonic when on flat dry land friction and acceleration are the same value, for the game this sample code was taken my friction rate is 3 times greater than acceleration for the exact same situation.

I would highly recommend having some fun experimenting with different acceleration/friction combinations.

resurrection_sonic_the_hedgehog_2

Sonic-esque Timer in GML

The timer in some games is a must and really easy to get a timer for any of situation.

For my purposes I want to be as detailed as possible so the code will be for a 00:00:000 timer but obviously can be adapted to whatever you want.

Create Event:

Step Event:

You may have noticed the pause and pauseTime variables in those two events. In order to make any functional timer for a game we need to keep track of the time when the player pauses or stops the timer.

Stopping the timer is pretty trivial, all we have to do is record the time when we paused.

To unpause we need to increase the offset by the amount of time passed on the timer.

Pretty easy feature to implement but very helpful to understand and have in your back pocket when making a time based game.

of an optimistic programmer on whatever I'm into today