Throughout the game play (either Android Game or others), the player's record is important to be always updated in order to let him/her continue the previous checkpoint. From the complicated RPG Games (levels, equipments, cash left, etc) to the simple mini games (high score, number of attempts, number of stages unlocked), records are necessary so that the players need not start all over again every time they engage the game.
In fact, the feature of saving data/records of the Android Games in Java is available here. The question is, how to implement the same thing in Actionscript 3?
1. import flash.net.SharedObject
The code which is similar to the SharedPreferences in Java is the "SharedObject". To use it, you need to import the flash library.
import flash.net.SharedObject
2. Define a SharedObject variable and a Record name
Define a variable named "shared" at which the records would be stored. You can provide any "RECORD_NAME" to create a shared object.
private var shared:SharedObject = SharedObject.getLocal("YOUR_RECORD_NAME");
3. Define your data in Object datatype and store it inside the 'data'
The "data" member of the SharedObject is nothing different from the datatype "Object" - an associative array. You can easily define your records in "Object" datatype before storing it.
For example, to store the levels, hit points, mana point of a character, the codes would be as below:
shared.data.characterData = {"level":5, "hit_point":100, "mana_point":100"};
In short, it isn't hard to have a data saving feature in your Android Game. So, next time when designing the game architecture, remember to have this feature included.
Android Gamify - a place to share everything about Android Games, especially Android Game development and Android Game Play.
Sunday, October 20, 2013
Saturday, October 19, 2013
How to solve "unsupported sampling/frequency" of audio files in AS3 (Starling Framework)?
As mentioned in the previous post, it is pretty straightforward to load audio/sound files in Starling Framework. But the thing is, it is annoying to learn that the adobe Flash Builder only allows to import the audio files that are recorded in the multiple of 11kHz (11kHz, 22kHz, 44kHz). And if it is not, you will get the error similar to the message below:
So, how to solve this "unsupported sampling/frequency" issue? (we are not sound engineers right?)
At the moment, I suggest using a third-party audio editor software, such as GoldWave to manually edit the sampling rate of your audio/sound files. (I personally hope that someone would make a browser-based version of that functionality)
To use the GoldWave, you could simply open your audio/sound files with it, and "Save as" a file in the "mp3" format, choosing any option which is in the multiple of the 11kHz frequency. (Here, i pick Layer-3 (LAME), 44100 Hz, 128kpbs, stereo.)
Once you have saved it, you can re-embed your audio/sound files again. :)
Description:
- Internal error in outgoing dependency subsystem, when generating code for ... : java.lang.NullPointerException
- The frequency 0 is not supported in file....
So, how to solve this "unsupported sampling/frequency" issue? (we are not sound engineers right?)
Solution: Manually down-sample/up-sample the audio/sound files
At the moment, I suggest using a third-party audio editor software, such as GoldWave to manually edit the sampling rate of your audio/sound files. (I personally hope that someone would make a browser-based version of that functionality)
To use the GoldWave, you could simply open your audio/sound files with it, and "Save as" a file in the "mp3" format, choosing any option which is in the multiple of the 11kHz frequency. (Here, i pick Layer-3 (LAME), 44100 Hz, 128kpbs, stereo.)
Once you have saved it, you can re-embed your audio/sound files again. :)
Wednesday, October 16, 2013
How to load audio/sound (.mp3) files with Starling Framework?
Sound effect plays an important role in any game. It stimulates the players to immerse themselves into the games. It manipulate the game paces, and the players' heart beat.
Similarly, an Android game without any background music or sound effect won't keep the players long. Hence, it is important to know how to load audio/sound files into your game, playing them at a correct timing. Here, the codes for doing it with Starling Framework will be displayed.
import flash.media.Sound;
[Embed(source="../media/sounds/move.mp3")]
public const MOVE_SOUND:Class;
public var sndMove:Sound = new MOVE_SOUND() as Sound;
sndMove.play()
Similarly, an Android game without any background music or sound effect won't keep the players long. Hence, it is important to know how to load audio/sound files into your game, playing them at a correct timing. Here, the codes for doing it with Starling Framework will be displayed.
1. Import Flash's Sound library
It is alright to just use the Sound library from the Flash. In fact, there isn't any specific library for the sound in Starling Framework.import flash.media.Sound;
2. Embed the audio/sound file
Like embedding the image files, embedding an audio/sound is similarly straightforward.[Embed(source="../media/sounds/move.mp3")]
public const MOVE_SOUND:Class;
3. Define the sound variable
Here, note that it is necessary to use "as Sound" when defining the variable.public var sndMove:Sound = new MOVE_SOUND() as Sound;
4. Play the audio/sound file
With the play function, you can directly play the audio file, with customizable parameters. (specify start time, loop times, sound transform)sndMove.play()
Wednesday, October 9, 2013
Monkey - a programming language for Games Development on multiple platform
Cool. As the title suggests, "Android Gamify", now even the name of "monkey" has been taken for the language of Games development. And it claims to target at Android, iOS, Desktop, HTML5 and XNA.
The download page of the "Monkey" presents a Demo Version (free) and a Full Version ($99 USD). Here, i would only be able to show the Demo Version. In short, the interface is pretty clean and intuitive.
The IDE of Monkey is quite fast to load. For beginners, there are a number of monkey samples available to start with. I am not that familiar with the language, but it looks like Actionscript (from the way it declares the data type).
The red rocket button is the one to build and run your project. Fast and clean.
However, the important question to ask here is that: How to build an Android apk file from this Monkey demo version? To our dismay, the demo version doesn't have the feature. I would personally be better impressed if it is included, so that I could write a little more about the Android Games Development using Monkey, precisely, Monkey programming language.
Beware of how vulnerable your Android Games (.apk files) are!
Ok. This is not a threat, nor a nonsense.
Here, I would like to emphasize on the vulnerability of the Android Games (.apk files), in order to raise the awareness of all the games developers.
Plagiarism takes place everywhere, from websites contents to the games elements, across any industry and brand. But when it comes to the Android Games, it is really sad to reveal that recently there has been cases such as the hard work pieces "Chase Burger" from Elventales Studio had been copied and published on iOS and Android Play Store under the name of Hungry Chase. When i said "copied", i mean it isn't just about the game logo or the genre, but about the duplication of the ENTIRE GAME, from images, buttons location to the character appearance. By changing only "Game Title" and editing a little bit on the color, those jerks simply claim the games as theirs.
What is even more discouraging is that, it happens not only on the famous games (which are from the well known studios). Even the indie games are not spared of. And that definitely poses a question: How on earth are those scumbags be able to reverse engineer the Android games, such that the entire games could be manipulated and re-published so easily? Why the apk files are so vulnerable?
You may argue that this scenario is inevitable, and it actually pesters the iOS game developers as well. But the thing is, as the developers who hope to earn some income for a living through the Android Games development, we are really disturbed by the hacking and stealing prone games ecosystem. And in fact, with the Google search engine (alright, is stackoverflow, etc), you can 'conveniently' get the ideas of how to intelligently reverse engineer de-compiling any Android apk file. I know that they are not to blame. But I wish the play store (such as Google Play Store) would be more vigilant and efficient when handling the apk theft.
Wish to know some demo on how an Android apk file is stolen? I won't show the whole ugly picture, but here's an example:
a) Randomly grab and download an apk file from here.
b) Rename the apk file with a ".zip" at the back
c) Extract / unzip the file
Here you go, i only partially demo how to steal the assets (pictures) of an Android apk file. It could be performed so so easily.
So what to do to enhance the security? No idea. But as observant games developers, the only thing that we can do, is to always keep an eye on the play store, filing reports whenever necessary and pray that those games thieves would be busted without affecting the reputation of your games brand.
Here, I would like to emphasize on the vulnerability of the Android Games (.apk files), in order to raise the awareness of all the games developers.
Plagiarism takes place everywhere, from websites contents to the games elements, across any industry and brand. But when it comes to the Android Games, it is really sad to reveal that recently there has been cases such as the hard work pieces "Chase Burger" from Elventales Studio had been copied and published on iOS and Android Play Store under the name of Hungry Chase. When i said "copied", i mean it isn't just about the game logo or the genre, but about the duplication of the ENTIRE GAME, from images, buttons location to the character appearance. By changing only "Game Title" and editing a little bit on the color, those jerks simply claim the games as theirs.
What is even more discouraging is that, it happens not only on the famous games (which are from the well known studios). Even the indie games are not spared of. And that definitely poses a question: How on earth are those scumbags be able to reverse engineer the Android games, such that the entire games could be manipulated and re-published so easily? Why the apk files are so vulnerable?
You may argue that this scenario is inevitable, and it actually pesters the iOS game developers as well. But the thing is, as the developers who hope to earn some income for a living through the Android Games development, we are really disturbed by the hacking and stealing prone games ecosystem. And in fact, with the Google search engine (alright, is stackoverflow, etc), you can 'conveniently' get the ideas of how to intelligently reverse engineer de-compiling any Android apk file. I know that they are not to blame. But I wish the play store (such as Google Play Store) would be more vigilant and efficient when handling the apk theft.
Wish to know some demo on how an Android apk file is stolen? I won't show the whole ugly picture, but here's an example:
a) Randomly grab and download an apk file from here.
b) Rename the apk file with a ".zip" at the back
c) Extract / unzip the file
Here you go, i only partially demo how to steal the assets (pictures) of an Android apk file. It could be performed so so easily.
So what to do to enhance the security? No idea. But as observant games developers, the only thing that we can do, is to always keep an eye on the play store, filing reports whenever necessary and pray that those games thieves would be busted without affecting the reputation of your games brand.
Subscribe to:
Posts (Atom)



