22 Apr

Mobile Market links

Here is how game can link to publisher’s page or another game in different mobile markets:

Google Play:
Publisher: market://search?q=pub:<publisher_name>
Game: market://details?id=<package_name>
More info: http://developer.android.com/distribute/googleplay/promote/linking.html

App Store (iOS):
Publisher: http://appstore.com/<publisher_name>
Game: http://appstore.com/<game_name>
itms:// and itms-apps:// didn’t work for me.
More info:
http://developer.apple.com/library/ios/#qa/qa1633/_index.html
http://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store
http://itunes.apple.com/linkmaker/

Kindle Apps market:
Publisher: amzn://apps/android?s=<publisher_name>&showAll=1
Game: amzn://apps/android?s=<game_name>
More info: https://developer.amazon.com/sdk/in-app-purchasing/sample-code/deeplink.html

Samsung Apps market:
Publisher: samsungapps://SellerDetail/<selleer_id>
Game: samsungapps://ProductDetail/<package_name>

Blackberry App World:
Publisher: appworld://vendor/<vendor_id>
Game: appworld://content/<game_id>

SlideME App market:
Publisher: sam://search?q=pub:<publisher_name>
Game: sam://details?id=<package_name>
More info: http://slideme.org/blog/linking-your-apps-slideme

NOOK Apps market:
No market links, so just use regular web links or NOOK API.
Publisher: http://www.barnesandnoble.com/c/<publisher_name>
Game: http://www.barnesandnoble.com/w/<game_name>/<game_id>

Window Phone 8 store:
Game: http://windowsphone.com/s?appId=<game_id>
More info: https://msdn.microsoft.com/en-us/library/windows/apps/ff967553(v=vs.105).aspx

18 Feb

Adobe AIR In-app Purchase native extensions

I have spent some time searching for free extensions for all the possible platforms and would like to share my results.
Also, I made my own in-app purchase extension for Android, as I couldn’t find a good and free one.

1. In-app Purchase for Blackberry Playbook.
There is an extension that comes with BlackBerry SDK for Adobe AIR.
API docs: http://developer.blackberry.com/air/apis/playbook/net/rim/blackberry/payment/PaymentSystem.html

2. In-app Purchase for iOS.
In-app purchase extension comes with Adobe Gaming SDK

3. In-app Purchase for Amazon Kindle.
It comes with Amazon SDK: https://developer.amazon.com/sdk/in-app-purchasing/documentation/adobe.html

4. In-app Purchase for Android.
I have found two extensions:
First is free extension from Freshplanet, but it is outdated.
Second is from Milkman for $50.
So, I have decide to make my own. 🙂
You can find it here: Adobe AIR In-app Purchase native extension for Android

Hope, it will help someone in its mobile app development.
Read More

23 Dec

Adobe AIR for Blackberry Playbook

So, I have finally started to port Solitaire and Mahjong games to Blackberry Playbook and have some notes.
I would like to mention them here, mainly for myself, just as a reminder.

0. Latest Adobe AIR SDK supported by Playbook to date is 3.1.

1. blackberry-airpackager sometimes doesn’t pack all the files to .bar file, if they are not in the same directory as blackberry-airpackager. In my case, it didn’t pack .swf file. App will crash on start in that case.

2. In order to get your Author ID, you need to rename debug token .bar file to .zip, find it in manifest.mf file or execute the following command:

blackberry-airpackager -listManifest [your_debug_file.bar]

3. Description of bar-descriptor.xml file can be found here.

4. According to the link above, permission for the app can be set with <action> tag, while sample HelloWorld project from BB AIR SDK use <permission> tag. Which one is correct – have no idea.

5. Mochi doesn’t work with Adobe AIR Mobile, and I’m not talking about ads, nothing works and it’s been for a long time.

6. Some good guide to AIR apps for playbook.

7. Blacberry SDK for Adobe AIR API Reference.

8. App version for Playbook should be X.Y.Z, not just X.Y as it’s by default in AIR settings.

9. It is always good to verify your .bar file before submitting it to Blackberry with the following command:

blackberry-signer -verify [your_bar_file.bar]

10. Testing Playbook App, especially payments.

11. QNXStageWebView for showing ads inside your app. I’m going to try Leadbolt and Millennial Media for now.

12. Payment System for AIR on Playbook, quit easy to implement.

13. Regular payments (in games or in App World) might stop working after running you own application in development mode. So, you need to restart Playbook to get it working again.

14. Using native extensions for Adobe AIR.

15. If you need to get info (like expiration date) from your certificate file, you can do the following:

blackberry-keytool -exportcert -storepass [your password] -keystore [your_certificate_file.p12] -file output.crt
blackberry-keytool -printcert -file output.crt

07 May

AS3 events

While working with Bloom Lite framework, I have discovered Native Signals – “a new approach for AS3 events, inspired by C# events and signals/slots in Qt.” I have read before, that Events in Flash was slow, but I have also read, that the fastest way to do events is just call required listener (function) directly.
And I’ve decided to make my own fast and ugly approach for AS3 events.
It has only one class and, I believe, works super fast.
It is available for download from GitHub: https://github.com/pozirk/misc, and it’s very easy to use, here is an example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
public class MyClass extends Eventer
{
  public static const MYEVENT:uint = 1;
  ...
  public function myFunc():void
  {
    if(...) //something happened
      fireEvent(MYEVENT, anyObjectHere);
  }
}
 
...
 
var my:MyClass = new MyClass();
my.addEvent(MyClass.MYEVENT, funcToCall);
 
...
 
public function funcToCall(obj:Object):void
{
  ...
}

So, any class can extends Eventer class, or just has it as a variable, and each class defines its own events (static IDs), which can be fired.

My approach doesn’t have anything like bubbling or capture phases, also there is only one listener possible for every event, but I was aiming for speed and I have thrown away everything and made it as fast as possible.
Hope, it will be useful for someone else, although there is nothing special here.

28 Mar

Free traffic for your website

Are you a flash game developer?
Do you want to get free traffic to your website?
OK, I’ll teach you. Nothing illegal! 🙂

It’s all about site-lock version of the game.
Usually, code for locking the game looks like that:

1
2
3
4
5
6
7
8
9
10
if(...) //domain name is correct
{
  //let's play the game
  ...
}
else
{
  //show some angry message, or don't show anything at all
  ...
}

I do it the same way with one small change:

1
2
3
4
5
6
...
else
{
  //redirect to the page with the game at your website
  try {flash.net.navigateToURL(new URLRequest("http:// www.yourdoamin .com/your-flash-game/"), "_self");} catch(e:Error) {}
}

Now, if someone host the game somewhere, where it is not supposed to be hosted, it redirects player to your website.
And everyone is happy: player can play the game, you get +1 visitor.

All my games are available for download and host on other websites, but they come with ads or sponsor’s brandings. Same games can be played at my own website and they don’t have ads. Of course, ads-free version of the game is site-locked.

But there are some smart guys, like one from “jeux .com”, who grabbed ads-free version of the game, put it to his website and didn’t even check it.
Now, I have +1500 extra visitors per day, mainly from France.
Merci, mon cher ami! C’est très gentil. 🙂

04 Dec

WCK. Conveyor belt problem.

For Dolly The Sheep game I’m using WCK + Box2D Alchemy Port.
It’s a very handy framework, but unfortunately, it lacks documentation and has some bugs.
One of the bugs, I have recently discovered was with the build-in Conveyor belt.
Here is an example.
There are 3 boxes, they should move to the same direction, while they are lying on the conveyor, but… their behavior is unpredictable.

I’ve decided to make my own simple Conveyor Belt, by listening Contact Events.
Here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
public override function create():void
{
	friction = 0; //this is very important, otherwise objects on conveyor will be moving with different speed
	reportBeginContact = true;
	reportEndContact = true;
 
	super.create();
 
	listenWhileVisible(this, ContactEvent.BEGIN_CONTACT, onBeginContact);
	listenWhileVisible(this, ContactEvent.END_CONTACT, onEndContact);
}
 
public override function update(param:Param):void //your own update function, calls every frame
{
	//set velocity to objects lying on the conveyor belt, I'm only using horizontal velocity here
	//_dir - direction, where object on conveyor should move to
	//_shape._normal - only the "y" of the normal, when object has contacted conveyor, in my case it can be only 1(from above) or -1(from below)
	for each(_shape in _shapes) //go through all the objects, contacting conveyor
	{
		_shape2 = _shape._shape;
		_shape2.b2body.SetLinearVelocity(new V2(_dir*_shape._normal*_speed, 0));
	}
}
 
protected function onBeginContact(event:ContactEvent):void
{
	//add object and its contact normal to the list
	//event.other.m_userData - our object
	//event.normal - our normal of the contact, that points from conveyor belt to object
	//if event.normal.y &gt; 0, object has contacted conveyor from below
	//if event.normal.y  0 ? -1 : 1)));
}
 
protected function onEndContact(event:ContactEvent):void
{
	//remove object, that is not contacting with conveyor from the list
	...
}

Of course, my version has some problems too, mainly because of the zero friction.
Hope, new version of Box2D Alchemy Port with fixed bugs will be released soon.

13 Oct

Space Age. Report 2

Report #2, and I have something to show.
While working on project I have discovered some problems.
1. Away3DLite is “too lite”. 🙂 It doesn’t not support a lot of features, that Away3D supports, like Sprites. Although Away3DLite version from SVN (http://away3d.googlecode.com/svn/trunk) has Sprite3D, but it doesn’t work correctly with FastRenderer so far.
2. Away3DLite has horrible mouse behavior performance. FPS drops significantly on MouseEvent3D.MOUSE_DOWN event, so I’ve just turned it off for now. I still need to explore this problem.
3. Flash can’t draw dashed lines and circles. Fortunately there is a graphics.curveTo function.
Her is my code:

1
2
3
4
5
6
7
graphics.lineStyle(2, 0x00FFFF);
graphics.moveTo(_midX+_radius, _midY);
for(_i = 6; _i &lt;= 360; _i+=12)
{
  graphics.curveTo(_midX+(_radius)*Tools.cos(_i-3), _midY+(_radius)*Tools.sin(_i-3), _midX+(_radius)*Tools.cos(_i), _midY+(_radius)*Tools.sin(_i));
  graphics.moveTo(_midX+(_radius)*Tools.cos(_i+6), _midY+(_radius)*Tools.sin(_i+6));
}

It draws circle with dashes every 6 degrees.
_midX and _midY are the coordinates of the center of circle.
Tools.cos and Tools.sin are my own functions for cos and sin, they return values from a prefilled arrays.
4. Game is 800×600, but as I know that some sponsors don’t accept that.

Next week I’m planning to do a lot of coding and planning and game menus and logic.

Ok. Here is what I have for today:

30 Jul

AS3 String VS Number

I was accidentally stored numbers as a strings in my objects.
Something like that:

data = {x: "200", y: "100"};

instead of that:

data = {x: 200, y: 100};

So, the problem starts when you try to sum or deduct these “numbers”.
For example,

trace(data.x+90);
Output: 20090
trace(data.x-90);
Output: 110