Windows Phone Games with Construct 2

1
  • 65 favourites

Index

Stats

8,756 visits, 22,795 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Extending your Windows Phone games

We’ve covered the most important areas to get the sample .capx certified. The following sections cover additional functionality that you can use to enhance or add additional functionality to your own game.

Trial Mode

To enable trial mode within your game, simply change the Windows Phone object property Trial Mode to Yes. We won’t add this to the example.capx as it doesn’t contain trial mode functionality, but you can add it to your own game easily enough.

You can use the following to determine if the game is running in trial mode and log either “Trial Mode” or “Full game” depending on it’s status.

You can then use the Windows Phone action Prompt to purchase app to initialise a purchase of the full application.

Font replacement

Webfonts will not work locally in your Windows Phone 8 application. You have a number of different options to solve this problem:

1.) Use the third-party Sprite Font Plugin. This is a great way to use image-based text in your game and is my preferred method to get fonts working in Windows Phone games.

2.) Load the webfont from a remote URL. Using Web Fonts in the Text object has more information on this. This will require users to have an internet connection to display the webfont, so this approach isn’t ideal.

Rate game

Encouraging players to rate the game when you anticipate they’ll be enjoying it most is a great way to boost high ratings. In the Windows Phone object there’s a simple Rate App action that will trigger the rating dialog.

Tiles

Many Windows Phone games use Live Tiles to encourage users to pin their game’s icon to the homescreen and to communicate information from the game to the player. You can find out more about Live Tiles here: Tiles for Windows Phone. If you follow that link you’ll see three different template types: flip, iconic and cycle. The Windows Phone Plugin only supports flip as the others are more oriented towards applications rather than games.

To update a Live Tile you need to add the Update Flipped Tile action from the Windows Phone object. Below is a diagram that displays how each parameter corresponds to the different elements that comprise the tile.

When adding images for the tile, ensure the path is correct and that you’ve copied the images to your Windows Phone project and that they’ve been added in the Solution Explorer.

Leaving the text fields as “” or the numerical field at 0 will cause those parameters to not be updated.

Improving performance

If your game is particularly image-heavy, then you may notice that performance isn’t as good as expected. For reasons unknown to me (and apparently Microsoft) it appears that some sort of security check runs on every image on every tick, slowing down performance dramatically.

I discovered that you can encode your images as data uris into the JavaScript, circumventing the performance issues. Previously this used to be a long and arduous task, but fortunately @beufreecasse has built a tool that automates the process!

You can download the Base 64 Encoding Tool. Simply open the tool, load c2runtime.js and it will encode all the images into the JavaScript for you.

This method has it’s caveats. Be sure to test on lower memory devices as the c2runtime.js file has become exponentially bigger and it eats memory for breakfast. If the app doesn’t launch or crashes temperamentally, then we can try forcing the app to use higher memory limits.

Locate the file WMAppManifest.xml from the Properties folder in the Solution Explorer, right click and select View Code.

Following the ScreenResolution element, add the following code:

        <FunctionalCapabilities>
          <FunctionalCapability Name="ID_FUNCCAP_EXTEND_MEM" />
        </FunctionalCapabilities>

If this still doesn’t launch or crashes temperamentally, check the file size of c2runtime.js. If it’s dramatically over 5mb then you’ll need to look at reducing the size of your exported images before using the Base 64 Encoding Tool. Changing all your images to export to PNG-8 is a good start.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • 555-555-0199zft@example.com

  • I see that you tried to explain in as much detail as possible, but frankly it's a little confusing. Maybe you'll have a chance to record movavi.com/screen-recorder this tutorial? It would make life a lot easier for a lot of people, at least for me))