Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Construct 2

You're reading from  Learning Construct 2

Product type Book
Published in Dec 2014
Publisher
ISBN-13 9781784397678
Pages 234 pages
Edition 1st Edition
Languages
Author (1):
Aryadi Subagio Aryadi Subagio
Profile icon Aryadi Subagio

Chapter 9. Mastering the Best Practices

Congratulations! By now, you already have more than enough skill to create games in Construct 2. Not only that, but you also know how to look for bugs in your game and eliminate them. However, there's one more important thing you need to know: best practices. You should know this because rather than trying to kill bugs later, it'd be much better if you can prevent them from appearing in your games in the first place.

In this chapter, we will cover the following topics:

  • The recommended file formats to use for assets

  • Common things that are recommended for any projects

  • Optimizing memory usage in your games

Applying common best practices


As per my experience, I've divided best practices into two big groups:

  • Common best practices: These are the ones you apply on all your projects, no matter how big or small. Not applying them usually won't give a performance hit to your game but can still slow down your project's development.

  • Technical best practices: These are the ones that give a performance boost to your games. These are usually used on big games that require heavy resources or mobile games where there might be technical constraints. Though these kinds of best practices can also be applied to smaller projects, there's little point in optimizing a game that doesn't need to be optimized. Nevertheless, it's still a good practice.

Backing up data regularly

One really important thing to keep in mind is this: your computers might crash when you're working on your project, thus resulting in lost projects. Other things such as flood, fire, or someone stealing your computer can also cause you to lose...

Using technical best practices


Now that you know all about the usual kinds of best practices that can be applied to all Construct 2 projects, let's move on to the technical kind of best practices. This advice is really useful to improve the performance of your game, and, therefore, it is best suited to be applied to mobile games where the specifications of mobile phones are not as great as desktop computers. Tablets have generally better specs than mobile phones, but when developing your game, it's a good practice to assume that your players won't have a device with as good specs as your device.

Optimizing for mobile platforms

One thing to keep in mind while developing for mobiles is that smartphones aren't as powerful as desktop computers. So, making your game run fast enough should be one of your concerns when you're making a mobile game.

Test your game on mobile phones from the start. A very good way to ensure that your game runs on a decent framerate on a mobile platform is to test it on...

Using your memory wisely


Okay, I have covered the common and technical things you should know when you want to squeeze the best performance out of your games. However, there's another thing you must know when developing your games: memory. Mobile devices have limited memory resources, so always keep memory usage in mind when developing on mobile platforms.

Avoid using large image files

Maybe, you still remember that I said not to use too many sprites in your project, or if you need to use an image repeatedly, then it's better to use a Tiled background object instead, because Construct 2 counts it as one object. Another thing you must keep in mind is you shouldn't use image files that are extremely big or detailed in your game. If you're a designer and want to use an HD image for your level, just know that it won't work, especially on a mobile.

The reason is a bit technical, but let me try to explain. Images are made up of pixels, so an image of 1920 x 1080 pixels will consist of 2073600 pixels...

Summary


Knowing how to make a game sometimes isn't enough; you also need to know how to make a game the right way. This is to make sure that your game runs fast enough even on slower mobile phones. There are a lot of things you can do to make sure that the performance runs well enough, starting from testing it on mobile phones from the beginning to make sure that you know how your game runs on mobile devices. You can increase performance by not creating a lot of objects on the screen because this slows down the game. You should also remember that physics objects are CPU-intensive, so try not to use too many of them.

In using your assets, you need to remember the best file format to use; use a 32-bit PNG file for images and a 16-bit WAV file for sounds. Construct 2 converts the audio to appropriate file formats to use for all range of browsers. Also, when using images for your games, it's better to use a lot of small images rather than a single big one.

You now know how to make games in Construct...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning Construct 2
Published in: Dec 2014 Publisher: ISBN-13: 9781784397678
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}