Monday 11 May 2015

Converting a game to Android

Blackjack game for mobile
Samsung Galaxy S6 edge.
Display:
Type-Super AMOLED, 16M colours
Size-5.1”
Resolution-1440 x 2560 ( 577 PPI )
Protection-Corning Gorilla Glass 4, Curved edge screen
Hardware:
OS-Android v5.0.2 (lollipop)
Chipset- Exynos 7420
CPU-Quad-Core 1.5GHz Cortex –A53 & Quad-Core 2.1GHz cortex A57
GPU-Mali-T760MP8
Memory:
Internal-32/64/128GB
RAM-3GB
Sound:
Vibration; MP3
Battery:
Non-removable Li-Ion 2600 mAh.
Wireless charging

Analysing Differences
The first step after choosing a smart phone, is to look at the differences between the platforms.
First of sprite and virtual buttons would have to be added to the screen as there are no other peripherals on a smart phone to use other than the screen.
So sprite movement buttons can be created and drawn on the screen, these sprites would then be referenced in a virtual key in a script. However a visible button would not be required as a transparent sprite could be placed on each side of the screen except the middle of the screen, more complicated scripts about accelerators.
The Blackjack game already has its own sprite buttons for twist and stick, so no other buttons would need to be added but in the script for the buttons a virtual_key function would be used. An exit button somewhere on the screen would be used as well, which could either exit the entire game or lead back to a main menu.

Sprites
Sprites and the entire game would be scaled down on the windows platform to fit the mobile screen size.


Coding and Steps
Android SDK
Install java JDK (Java Development Kit)
Install android SDK-
Run the Android SDK installer. You will be asked to install the Android SDK to the path "C:\Program Files (x86)\Android\android-sdk". We strongly recommend that you choose something with no spaces in the path, such as C:\android-sdk\, as the default path can cause problems with the actual Android updater program itself.
Once you have successfully installed the Android SDK you will be given the option to start the Android SDK Manager. This you must do, as it will install additional tools and device specific functions.

When it starts you should select only Android SDK Platform ToolsAndroid 2.1 (API 7)Android 2.2 (API 8)Android 3.2 (API 13)Android 4.0.3 (API 15), as well as the most recent version of Android (selected automatically by default by the manager). Please don't just select everything to be installed, as this will a) needlessly waste your bandwidth and HDD space, and b) might cause conflict errors during builds.
It should be noted that after installing these files the Android Download Manager may inform you that there are other files to be installed and that you should close and re-launch the SDK Manager, so please do this if asked.
It is advised to check the revision details and see if you don't already have the selected update installed. For more information on this process and the Download Manager
You should also set the PATH variable to allow you to run the command line tools

Run On a Connected Device
Make sure your device is connected to your pc through its USB data cable and that you have followed the device setup advice.
Click the Green play button at the top of the main Game Maker: Studio window to compile your game
As soon the compiling is complete, your game should appear on the device as designed.

Run on WiFi
Before you can use the WiFi setup, you need to make sure that the device to be tested has the YoYo Games runner installed. This can only be achieved through a data cable connection. This means that you must follow the connected device steps at least once before WiFi connections will work, as this is currently the easiest way to install the runner on the device.
Once the runner is installed on your phone,
Make sure that you have correctly configured GameMaker: Studio
Click the Green play button at the top of the main GameMaker: Studio window to compile your game
When compiled, tap the YoYo Games Runner on the device and you will get the "connecting" window. Your game will now run as normal, unless this is the first time you are running the WiFi mode, in which case you should also follow the next steps too.

Optimisation
Computers are generally more powerful than a smart phone however, smart phone technology is getting better games may need to be optimised in order to run smoothly and without any bugs. To solve this issue games need to be optimised which comprises of changing things such as graphic detail game functions, or just shortening code. The two most hardware restraining parts of a game are the in-game graphics and large amounts of code. To smooth out the gameplay coding can be deleted when not in use. One way this can be used in the blackjack game is by using Ds_Lists instead of arrays, Ds_Lists have a function which can be used which will destroy code or script once a set have events has been completed, for instance the random deck and picking cards for players can be destroyed once used, but for the blackjack game this is not entirely necessary as the game is not hardware intensive. 

No comments:

Post a Comment