How to publish your HTML5 game to other game platforms
In this tutorial, we’re going to download a game created on WiMi5 and we’re going to publish it on a local Web server. This is only an example which will allow us to test that our game works correctly. But the real goal of downloading a game is to be able to publish it on any game portal and therefore make it available to the widest audience possible. And the package that you download using this tutorial will allow that.
Step 1: Create a downloadable .zip file
Before packing it, you need to have created and deployed your game at least once. The package resulting from this process is simply a compressed .zip which contains the files required to be run on the web server.
- From the WiMi5 Dashboard, select one of your projects and go to Settings by clicking on the icon shaped like a gear. Once you can see the details of that project, in the left side menu, there is a section called Publish with several subsections. Click on the Download section.
- Create the .zip file of your game by clicking on the pack button. This process will take several seconds.
- Once it’s packed, the pack button will change into a button with an icon that symbolizes that you can now download your game as a .zip file with the files of your game.
Step 2: Check that the game works
To check that the game works correctly, we’re going to run it on a local web server. The game must be authorized so that it can be run from this specific server. To authorize the server, consult Appendix A: Authorizing a Server.
Once the game is authorized, we can test the HTML5 game on our local web server. We’ll have to have a Web server installed on our computer. In this example, we’ll use a Phyton server, but there are many other web servers available.
Let’s see how to check the game on a Phyton server.
- Create a directory called games.
- Go to that directory.
- Create a directory for the game and go to it.
- Decompress the game downloaded in step 1
- Go to the root games directory
- Launch a web server. By default, the games will be on the server http://localhost:8000 by writing out this order on your console:
python –m Simple HTTPServer 8000
- Add the origin from the WiMi5 Platform (See Appendix A)
- Open a browser and go to the URL http://localhost:8000/games/
- Click on myDownloadedApp
- Enjoy your game!
Appendix A: Authorizing a Web Server
It is currently necessary to authorize the web servers that will be used by the games created with WiMi5. This includes the local web server that we’re using in this example.
This is because the games created with WiMi5 need to access the WiMi5 platform to use some backend services, such as User Management, Rankings, Persistent Storage, or Virtual Goods.
You have to go to the WiMi5 Dashboard and select the Settings of our game myDownloadedApp. Go to the Publish section and click in the Download option. In the Origins form you have to enter the URL of your Web server. This way you are allowing the access from this server to the WiMi5 Platform.
Add origin to Project Dashboard
An origin has this format: <protocol>://<host><port>
- protocol: it could be http or https
- host: a host name ( localhost, example.com, google.com,… ) or an IP address (127.0.0.1, 126.96.36.199, … )
- port: a port in the range from 10 to 99999
For example, if we want to host our game in the Gamejolt Website we should use this origin:19/12/2014 / 2 Comments
- How to Integrate a Game into Your Website
- How to integrate a WiMi5 game in Moodle
- How to create texts from sprites using a SpriteText Blackbox
- How to clone a project
- New ways of interacting in wimi5
- How to easily adapt WiMi5 game templates to create your own games
- How to monetize your games using Virtual Goods
- How to use the CodeRunner blackbox
- How to use Game Session Storage
- How to Use Rankings
- How to publish your HTML5 game to other game platforms
- How to publish your HTML5 game on the Google Chrome Web Store
- How to set up game levels based on data from a text file: using the ParamMap.
- How to create a scoreboard for lives, time, and points
- How to Make a Scroll and a Parallax Scroll in 2D Games
- How to create collisions
- How to debug in WiMi5