Monthly Archives: February 2015

Putting Your Work Online

When we make games, it’s so people can see them, play them, and hopefully get some form of enjoyment out of them.

That does not happen if they never make it somewhere that people can find out about your games and then access them.

Therefore, you need to:
A. Tell people about your games.
B. Put your games where people can get to them.

We’ll tackle the second one First

Putting Your Games Out There

Used to, if you made a game, you needed a way to distribute it. This meant physical forms of distribution and lots of money. Thankfully, the Internet has made it extremely easy to put you games in front of a large audience. There are lots of free and inexpensive methods of putting your game out there for people to see and get at.

Game Hosting Specialty Sites

There are several sites that allow you to host your HTML5 game on them free of charge and a couple that have an add revenue sharing model. This is not a comprehensive list, just a few places to get started.

I put my first HTML5 game out on Itch.io and it was incredibly simple. After creating an account, you just need to upload a zip file containing your game and its assets. Just make sure the game has an index.html file.

Heroku

Heroku is a great hosting option if you are playing around with some server side code, or if you want to host your game their temporarily while you are testing it.

A Heroku app is free as long as it is only using limited resources, you can see more about their pricing model here. I use it all the time for testing little ideas.

You can use it to host your HTML5 games while you are testing them. However when you are ready to show them to the public, I recommend either putting them on at least one (read as ALL) of the free game hosting sites mentioned above or hosting the games yourself.

Self Hosting

If you are an extreme do-it-yourself type, or maybe you just want to learn more about the server side of things, you can pay to host the game on your own server somewhere. Almost any hosting provider will do, but I would probably recommend that you use something like Digital Ocean.

A nice simple server will run you about $5 USD a month. In addition, they have a ton of free tutorials on setting up almost any type of server you could want to set up.

Now time for the slightly harder part.

Telling People About Your Game

This is really important. If nobody knows about the awesome game you just made and put online, then nobody will ever get the joyful experience that you carefully designed and constructed for them.

Start With Friends And Family

Tell everybody you know about your game. Don’t be shy about it.

Also, make them play you game and ask for their honest feedback. This may be difficult to get, especially from your mom (who only ever wants to say nice things), but you should be able to tell if they are ready to put it down pretty quick, or if they seem to actually enjoy the experience.

Build An Online Audience And Tell Them About It

Start a blog and put your games and your progress on it.

This is a perfect place to build an audience of people that you can tell about your new games and get feedback from. Once you make a game you want to sell, it can be the place where you market first to people who already like what you do. Additionally if you ever decide you want a career in game programming or game design, it can become a showcase or portfolio of your work.

To get your blog set up, I recommend signing up for the Dev Career Boost blog email course put out by John Sonmez. This is email course is an easy to follow guide to setting up you blog and preparing it to be successful. I found all of the advice to very helpful, especially for deciding on a blogging schedule.

Also, John has a great site dedicated to advice for programmers at simpleprogrammer.com

Now go make some games and put them online!

Friction for Smooth Movement

One of my self challenges for 2015 is to create 1 game a month starting in February. So I decided to start with a classic type of arcade game, a scrolling shooter.

The first implementation of the game only moved when the player was using input to control the ship. As soon as the player let off the key or stopped touching the screen, the ship would stop. This did not feel natural at all. In order to give the game a smooth and more natural feel, I decided to introduce a friction factor so that the player is slowed down a little until coming to a complete stop. Like this

If velocity in x direction >= friction
velocity is reduced by friction amount
If velocity in x direction < friction velocity is 0 Same for the y direction. You may need to play around with what the friction value is to determine what feels natural. Also, the frame rate that you choose for your game will affect what this value is. Note: you may need to account for both positive and negative velocities, depending on how you implement movement in your game.

Monkey-X and Connecting to Your Server

While traveling to visit family this past weekend I was attempting to set up a simple high score server for Prism Ship. I decided to use Sinatra for the backend because it would allow me to make a very simple and quick server using only a couple of lines since I don’t need an interface of any kind. Little did I know this simple task would turn out to take several hours.

This was partly caused by my lack of familiarity with Monkey-X and partly allergies.

Backstory

I was staying with some relatives and the females all went shopping and what not. My brother-in-law had made plans to spend the afternoon gaming at a friends house (Dark Souls II anyone?) so I tagged along figuring I would just program while they played. Better than sitting in an empty apartment for 5 hours right?

I had been to this friends house before but forgot about the pets. Normally I don’t have any problems with dogs or cats and didn’t the last time I was there (which was probably because we spent a majority of the time outside on that visit). However, this visit caused very annoying allergy type symptoms to be present for 4.5/5 hours.

Now, the server was simple enough to set up. Just a few lines of Ruby using Sinatra to test.

require 'sinatra'

get '/' do
body "High Score List"
end

It’s really that simple.

First Problem – Different Domains

I noticed that despite following the instructions in the documentation for the brl.httprequest module in Monkey-X, I was not getting expected output. So I opened the dev tools in the browser and saw this:
Access-Control-Allow-Origin: access denied
After a brief investigation, it seemed to be related to CORS (Cross Origin Resource Sharing). It was caused by trying to run the game on the localhost and accessing the Sinatra server running on Heroku. This is fixed with a little addition to the Ruby code:
require 'sinatra'

get '/' do
response.headers['Access-Control-Allow-Origin'] = "*"
body "High Score List"
end

This is not very secure, but it fits our purposes for the time being.

Second Problem – Not Carefully Reading Documentation

A nose that is running because of excessive cat and dog dander will keep you from thinking straight and reading carefully. I missed an important line in the HttpRequest documentation that says – “Your application must continously call UpdateAsyncEvents at regular intervals (for example, once per OnUpdate) while an http request operation is in progress for it to complete.”

My little program was sending just fine, I could see the server send back a nice HTTP:200 code, but the game would not fire the OnHttpComplete method.

The very next time I sat down to work on this problem, it took less than 5 minutes of googling and reading to find the cause. I put the UpdateAsyncEvents line in and everything just started working.

Moral of the story

Read documentation carefully and try not to program somewhere that will cause you to have a runny nose (or other types of distractions).

Mini Ludum Dare 56 and First Game

So I had heard about Ludum Dare game jams before, but never participated in one. It just so happened that they were running a very loosely ruled 48 hour mini jam this past weekend and I submitted a game for it (and its actually kinda fun).

You can play it on itch.io

Prism Ship - Game 1/11

Prism Ship – Game 1/11

One of the hardest parts was I was trying to make the controls touch friendly, so it could be played on a smart phone or tablet (screen size/ scaling still needs to be made mobile friendly). The touch controls are a little more limited than the keyboard consequently. The keyboard allows movement in all 4 directions using WASD or the arrow keys while touch only allows left and right movement by touching to one side. I actually find it easier to drag my finger along under the “ship” to move it (which is why there is space under it).

Originally I was just drawing boxes to the screen, but forcing the browser to draw every update is a little slow and resource taxing so I made some simple graphics (that are essentially the same boxes) using a wonderfully useful and simple site called make8bitart. The interface is intuitive and very easy to use. Saving is as simple as dragging the image to your desktop from the browser. Highly recommend.

Lots of improvements to be made but not bad for my first game. Next week I will begin working on a simple high score server for it.