How to publish your game online?

This blog is intended for those people who are aspiring game designers and want to create an online protfolio of their games. I have recently experimented a lot on Unity developing games. But what is the point in developing a game, if others (atleast your friends) don’t get a chance to play your game? I tried searching online for the ways in which I can host my game online for free. All the techniques that I saw involve spending some money from your pocket and some techniques involve uploading your game to dropbox/google drive and share the link to people for playing it online. All these techniques didn’t attract me much. I tried to find a way in which people can play my game right in their system browser. After discussing with some of my friends and searching online if github can support it, I finally came up with a feasible solution!

For those who are familiar with Unity 3D, you should be knowing that thorugh Unity you can build a game to any type of platform that you want. You also should need a github account for hosting your game.

  1. After completing your game, go to File -> Build Settings…<\br>screen-shot-2016-11-05-at-4-02-01-pm
  2. This will take you to a new window named ‘Build Settings’. Select WebGL -> Select all the scenes that you want in your build -> and click on ‘Build’. <\br>screen-shot-2016-11-05-at-4-05-30-pm
  3. Type the name of the folder with the name you want to call your game (per say <gameNameFolder>) in the ‘Save As’ section and click on Save button. By default this folder will be saved under the folder where your game is saved.
  4. Open a terminal and navigate to the <gameNameFolder> location.
    • cd <gameNameFolder>/
    • open index.html
  5. The above commands should open your game in a new tab in your default browser. Check if your game is working properly and if it does, let us move to next step.
  6. Upload the <gameNameFolder> as a new repository into github (refer github docs).
  7. After successfully uploading your project on github, open terminal and write the following commands.
    • cd <gameNameFolder>/
    • git checkout -b gh-pages
    • git push origin gh-pages
  8. That’s it… You can find your game in the ‘https:// <your-github-username>.github.io/<gameNameFolder>’.
  9. Happy Gaming and share the links anywhere in the world to your friends to play in their web browser 🙂