Pardon the mess, Play My Code is in beta!

READY TO PLAY?
CLICK TO LOG IN!

sign up - lost password

Game Development

Introduction

Game development on Play My Code is simple, yet flexible enough to allow any kind of game to be written. No additional tools or plugins are required, whilst there's no need to book web hosting either as your game and all assets will be hosted here, for free. Meanwhile, anyone can embed and share your games- just like a youtube video.

Games on Play My Code are written in Quby, a simple yet powerful language with a Ruby-like syntax. When a game's code is loaded into a game player it is instantly parsed into JavaScript, which then executes natively in the browser using a HTML5 canvas element. This means developers get the benefit of a simple, beautifully elegant programming syntax which is far more suitable for game creation than raw JS, while enjoying the power and performance that JS provides. Please read the Quby Syntax Guide to learn more about programming using Quby.

Play My Code's Quby implementation also provides a variety of API functions out of the box to provide easy-to-implement handling of the essentials of games: keyboard and mouse control, graphics drawing and collision detection to name but a few. The API couldn't be easier to use, and allows you to knock a basic game together in mere minutes! Please read the API reference to learn more about the many API functions.

Project Creation & Management

Once you've signed up, head to the Build section at www.playmycode.com/build. This is where your game projects are kept. A new user will have no projects: click New Project and enter your new game's title into the dialogue box which will appear.

Your newly-created project will appear, with a few corresponding buttons: Edit loads the game's code and assets into the online IDE (Integrated Development Environment), and this is where game development takes place. Delete obviously deletes the project, whilst Status determines whether the game is classed as Hidden, Public or Published:

Project Development Using the IDE

Clicking a game's Edit button will load its code and assets into our cloud-based IDE. The IDE is simple and streamlined, yet powerful enough to make game development on Play My Code both blazing fast and extremely simple.

A game's code appears in the pane on the left. A newly-created project will, by default, display the code for a Hello World program, a very basic example- feel free to tinker with this, or just delete it and write your own code.

The window to the right of the code pane is the IDE Game Player, where the code you are writing executes. Clicking the Run button beneath the code pane will cause your project to run in this window- use it to execute the provided Hello World example if you want. When you're done, simply click Stop.

For advanced users there are also a number of keyboard shortcuts you can use in the editor. These are listed here

The other buttons beneath the code pane are as follows:

Finally, beneath the game Game Player is the Error Console. This displays syntax errors and other problems with your code, and will tell you the line number where an error is occurring to aid you in solving the problem. Do not publish games containing errors!

Managing Game Graphics

Game graphics are managed through the aforementioned Images Library. Click the Images button beneath the code pane to open it. Clicking in the box beneath Upload New Images allows you to upload and add graphics to your game- choose the required assets from your computer's hard drive (in .png, .jpg or .gif format) and then click Upload. Once they have uploaded successfully they will appear in the library, and from here you can also delete unused assets by clicking the grey x beneath the thumbnail of the image you want to delete.

When you want to use an uploaded file in a game, you refer to it in the code as such:

	$SHIP_IMG = new Image("ship.png")

where $SHIP_IMG can be any variable name so long as the filename (in the above example, "ship.png") matches that in the Image Library. You can see image filenames above their corresponding thumbnails in the Image Library.

Further Reading

At Play My Code, we very much hope that you find game development using Quby and our online IDE easy and fun.

As far as further reading about the Quby language is concerned, the Quby Syntax and Quby API documents are a great place to start. Also, the source code on any game on Play My Code is viewable: simply navigate to that game's page and click Code above the game player to view it. Learning from other users' code can be a great way to increase your own skills.

Very soon we hope to have more and better documentation, example demo games and tutorials available onsite. Watch this space, or follow @playmycode on Twitter for the latest updates.