Sunday, January 24, 2016

Mobile Income Report #18 - December 2015






previous parts
  Mobile Income Report #17 - November 2015
  Mobile Income Report #16 - October 2015
  Mobile Income Report #15 - September 2015
  Mobile Income Report #14 - August 2015
  Mobile Income Report #13 - July 2015
  Mobile Income Report #12 - June 2015
  Mobile Income Report #11 - May 2015
  Mobile Income Report #10 - April 2015
  Mobile Income Report #9 - March 2015
  Mobile Income Report #8 - January and February 2015
  Mobile Income Report #7 - December 2014
  Mobile Income Report #6 - November 2014
  Mobile Income Report #5 - October 2014 
  Mobile Income Report #4 - September 2014 
  Mobile Income Report #3 - August 2014
  Mobile Income Report #2 - July 2014
  Mobile Income Report #1 - June 2014
  Apps page - Portfolio (what are my assets?)


 If you do not want to miss any of my Income Reports you can follow me on Twitter. Just click the button above.

 Under Apps page you can see my portfolio. It is list of the games that are then reported in Income Reports. The portfolio is regularly updated with new information (releases for new platforms, new updates, ...)


What I did in December

  • purchased Spriter Pro license. So, I can implement Pro features into my Spriter player for Phaser (GitHub) in future,
  • our upcoming HTML5 match-3 game with pirates has finally name: "Pirates!, the match-3",
  • created another editor for Pirates!. This time the editor is for game maps (not levels or tile maps). In most of our latest games we had some map player is moving on. This editor allows me to easily manipulate with important map places as well as decorate map wit either static images or Spriter animations. Technology used is C# + WPF:

  • worked hard on Pirates! We finished map selection screen - all is animated and pretty dynamic:

  • continued experiments with Unity. Dived into shaders and pixel perfect cameras. As a result I have shader for normal mapped 2D sprites that cast and receive shadows.



Report


 I did changes in regular report part of these posts. As we started using two more ad networks (Unity Ads and Heyzap) in December, the current report would get too complex. So, it is simplified now:



 Currently all apps are in one table and columns are income sources.

 Most income is again from Shards - the brickbreaker game (iOS, Android).

 Additionally, in December we got some income from our HTML5 games licences - $8130.

 Total income for December is $144,2 + $8130,0 = $8274,2. Income from mobile games is still very poor. Income from HTML5 games is currently saving me. Figures reported here are for whole team and while it still may look as a big income, do not remember, that it is first good income since July!


Next

 

 Work on "Pirates!, the match-3" speed up a lot in last days. Work on it will continue. Beside this I am doing some smaller hired HTML5 work. And I will also continue in my Unity experiments.












Wednesday, January 13, 2016

Phaser tutorial: Using Phaser signals

 





Previous Phaser tutorials:
Phaser tutorial: Breaking the (z-order) law!
Phaser tutorial: Phaser and Spriter skeletal animation
Phaser tutorial: DronShooter - simple game in Typescript - Part 3
Phaser tutorial: DronShooter - simple game in Typescript - Part 2
Phaser tutorial: adding 9-patch image support to Phaser
Phaser tutorial: DronShooter - simple game in Typescript - Part 1
Phaser tutorial: custom easing functions for tweening and easing functions with parameters
Phaser tutorial: sprites and custom properties for atlas frames
Phaser tutorial: manage different screen sizes
Phaser tutorial: How to wrap bitmap text


 In many situations you need some mechanism how to notify one object in your game with something, that happen in another object of your game. There are several levels how to solve this form tight coupling of objects to loose coupling. If you also want to make parts of your game reusable, then we can say, there are several levels from bad solution to good one from this point of view.
 As this is Phaser tutorial, we will not reinvent the wheel, but describe mechanism, that is available in this engine - Phaser.Signal. But first, I will show some bad solutions as this will help to show advantages of signals later in contrast.


Worst case

 Imagine you have class Game, that counts score and you also have some class ScoreCounter responsible for displaying it:

            class Game {
                private _score: number;

                public get score(): number {
                    return this._score;
                }
            }

            class ScoreCounter {
                private _game: Game;

                public update() {
                    var actualScore = this._game.score;
                        :
                }
            }

 Class game keeps score amount. ScoreCounter is keeping reference to Game object and has some update method, which is executed every frame. When it is executed, then it asks game for current score and does something with it. It is inefficient as update is called every frame and also classes are tightly coupled. You can not take your ScoreCounter and put it simply into another game unless it has class Game with score property.


Bad case

 What if  we change it in way, that Game class will call some method in ScoreCounter when score is changed?

            class Game {
                private _score: number;
                private _scoreCounter: ScoreCounter;

                public addScore(points: number): void {
                    this._score.+= points;
                    this._scoreCounter.update(this._score);
                }
            }

            class ScoreCounter {
                public update(actualScore: number) {
                        :
                }
            }

 This is better. ScoreCounter's update method does not need to be executed regularly. Game class is keeping reference to ScoreCounter and when score is changed inside game, it calls update method of ScoreCounter. In this case, ScoreCounter can be in some kind of library which you can reuse for other game. But, what if we want to notify other class than ScoreCounter with minimum effort?


Listener

 Now, we will define interface IScoreListener. And every class that implements it can be notified of score change. Reference to listener is stored in Game class in _scoreListener variable. In our case it is again ScoreCounter that implements IScoreListener, but it can be any class. It just has to have onScoreChange method implemented.

            class Game {
                private _score: number;
                private _scoreListener: IScoreListener;

                public addScore(points: number): void {
                    this._score += points;
                    this._scoreListener.onScoreChange(this._score);
                }
            }

            interface IScoreListener {
                onScoreChange(points: number): void;
            }

            class ScoreCounter implements IScoreListener {
                public onScoreChange(actualScore: number): void {
                        :
                }
            }

 If interface definition and ScoreCounter are in your library class then it is reusable. Game does not know anything about ScoreCounter. It just knows about "some"  IScoreListener implementer. In your game you can then create other classes that implements this listener like MonsterCountingScore and if it implements IScoreListener, you will get monster that will get notified on score change (for example some boss inflating its size as you are hitting it and getting score for it). Just do not forget to change reference in Game class from ScoreCounter implementing IScoreListener to MonsterCountingScore implementing IScoreListener.
 We are getting close, but in current solution we can have only one listener. What if there is more of them - you want to notify ScoreCounter as well as monster.
 Solution is to create some list or array of IScoreListeners and call them all in for-loop. You would also need some add / remove mechanism how to add new listeners and remove old ones (like when monster is killed). Additional features like testing whether some listener is already on list would be handy. What about passing parameters, one-time listeners, ... If you are using Phaser than all of this is already implemented for you in Phaser.Signal class.


Phaser.Signal

 Signals are Phaser built in event dispatching mechanism supporting notification of one or more listeners.
 Let's start with simple example:

            class Game {
                public onScoreChange: Phaser.Signal = new Phaser.Signal();
                private _score;

                public addScore(points: number): void {
                    this._score += points;
                    this.onScoreChange.dispatch(this._score);
                }
            }

            class ScoreCounter {
                public setScore(actualScore: number): void {
                        :
                }
            }

 In this example all listeners stored in onScoreChange Phaser Signal will be notified with current score. Notification is fired with call to dispatch method. But in the beginning this list of listeners is empty. You have to fill it with couples method-context first.
 In example with interface we did not need context as listener reference was storing object. On the other hand that object had to implement specific interface. With Signals we can use any method, but we also have to provide correct context.
 Initialization for above example can look like this somewhere in your code:

            var game = new Game();
            var scoreCounter = new ScoreCounter();

            game.onScoreChange.add(scoreCounter.setScore, scoreCounter);



Phaser.Signal class features

 Phaser.Signal class has many features. Following I will describe most of them (for all methods see documentation):


add(listener: Function, listenerContext?: any, priority?: number, ...args: any[]): Phaser.SignalBinding;
addOnce(listener: Function, listenerContext?: any, priority?: number, ...args: any[]): Phaser.SignalBinding;

 These two methods adds listener to list. In second case event for this listener will be dispatched only once and then the listener will be removed from list.
 First two parameters are method and context you want to call. With next argument you can assign priority to your listeners in case you need some of them to be called earlier than others. Then, you can add any number of arguments that are specific for listener and that will be called to it with dispatch method. I will show example in moment.
 It also checks, whether listener is already on list to prevent multiple adding.


dispatch(...params: any[]): void;

 dispatch method fires notification process. You can add any number of parameters to it. In our original example we sent actual score value through it.

 Now, as we have some parameters on add(Once) method and dispatch method, let's see small example how it works:

            var signal = new Phaser.Signal();

            // listener 1
            signal.add(function () {
                console.log("listener 1");
                for (var i = 0; i < arguments.length; i++) {
                    console.log("argument " + i + ": " + arguments[i]);
                }
            }, this, 0, "listener - 1", "listener - 2");

            // listener 2
            signal.add(function () {
                console.log("listener 2");
                for (var i = 0; i < arguments.length; i++) {
                    console.log("argument " + i + ": " + arguments[i]);
                }
            }, this);

            //dispatch
            signal.dispatch("dispatch - 1", "dispatch - 2");

 Here we added two listeners to signal class instance. These listeners are anonymous functions and only thing they do is to output all parameters passed to it in console window. First listener is added with two extra parameters (strings): "listener - 1" and "listener - 2". In the end we call dispatch with parameters "dispatch - 1" and "dispatch - 2". Here is console output if you run the code:

listener 1
argument 0: dispatch - 1 
argument 1: dispatch - 2 
argument 2: listener - 1 
argument 3: listener - 2 
listener 2
argument 0: dispatch - 1 
argument 1: dispatch - 2

 As you can see first parameters our listeners got are those from dispatch call. After that follow listener parameters.


has(listener: Function, context?: any): boolean;

 has method returns true or false and allows you to test, whether Signal has listener in argument already attached.


remove(listener: Function, context?: any): Function;
removeAll(context?: any): void;

 With remove and removeAll you can remove particular listener from list while removeAll clears whole list. Method removeAll has optional context parameter, that allows you to remove all listeners, but only for given context.


dispose(): void;

 With dispose, you can clear list of listeners as well as all internal references to external objects. After this call you cannot use signal anymore and it is ready to be garbage collected.


Conclusion

 Hope this tutorial helped you to understand Phaser.Signals.







Saturday, December 19, 2015

Mobile Income Report #17 - November 2015






previous parts
  Mobile Income Report #16 - October 2015

  Mobile Income Report #15 - September 2015
  Mobile Income Report #14 - August 2015
  Mobile Income Report #13 - July 2015
  Mobile Income Report #12 - June 2015
  Mobile Income Report #11 - May 2015
  Mobile Income Report #10 - April 2015
  Mobile Income Report #9 - March 2015
  Mobile Income Report #8 - January and February 2015
  Mobile Income Report #7 - December 2014
  Mobile Income Report #6 - November 2014
  Mobile Income Report #5 - October 2014 
  Mobile Income Report #4 - September 2014 
  Mobile Income Report #3 - August 2014
  Mobile Income Report #2 - July 2014
  Mobile Income Report #1 - June 2014
  Apps page - Portfolio (what are my assets?)


 If you do not want to miss any of my Income Reports you can follow me on Twitter. Just click the button above.

 Under Apps page you can see my portfolio. It is list of the games that are then reported in Income Reports. The portfolio is regularly updated with new information (releases for new platforms, new updates, ...)



What I did in November

  •  Jupiter, who stands behind Shards graphics and levels, prepared 10 new levels. Android version at Google Play is already updated.

  •  I finally dived into WPF as I choose it as a technology I want to build our match-3 level editor on. I really like it and editor is now finished. So, we can finally continue our work on this game, which I believe a lot in. Here is screenshot from the tool - most of the icons are test ones just to create working tool:
  • trying to make one of our HTML5 games work with new Windows Store. It is really easy to make it run, but the hard part was to make Google Analytics work and we also struggled with required graphical assets (icons, tiles) - big resolution for these is required, while size limits are pretty restrictive. On making 3rd party Google Analytics SDK ("Google Analytics SDK for Windows and Windows Phone") work I wrote tutorial here,
  • still learning Unity. After publishing our first game we made in it (Futoshiki) I think it is time to make something more complex with it. I always loved games with pixel characters, so this may be the way...




Report


 Now, for the sad part - financial data. Here is income from paid versions:

 And here is percent split:
 ... almost all income from Shards.

 Figures for free apps supported with ads:

 There is decrease from $142,2 in October to $110,2. Biggest one is in AdMob income - from $42.6 to $25,6 - October was really good month for AdMob, now it returned back to regular numbers.

 Still most profitable network is Chartboost.

 Additionally, we got some small profit from HTML5 games - $95,80.

 Total income for November is $17,1 + $110,2 + 95,80 = $223,1. It is 43,9% increase, but only thanks to income from HTML5 games.


Next


 In December I am working on our match-3 game. Thanks to finished level editor, we can move forward. Also working on preparing our first game for Windows Store. And still learning Unity.





Monday, December 14, 2015

How to make "Google Analytics SDK for Windows and Windows Phone" work with Windows 10 Javascript application.






 In past day I had to implement Google Analytics (GA) into Universal Windows 10 app written in HTML5/Javascript. Due to security restrictions it is not possible to add it in standard way - loading external Javascript libraries. I searched internet and found "Google Analytics SDK for Windows and Windows Phone" SDK at Codeplex. Unfortunately, making it work took me some time, so in this article I will share my findings.


Google Analytics SDK for Windows and Windows Phone


"Google Analytics SDK for Windows and Windows Phone" is available here. It comes in two flavours:
  • NuGet package written in C#,
  • vsix install package written in C++ (recommended for Javascript and C++)
 As author (timgrenfield) says:
 "The vsix installs a 100% native version (written in C++). The NuGet package is 100% managed (written in C#). While the C# version will work just fine in JS apps, the native version is recommended for JavaScript apps because it removes the dependency on the CLR (Common Language Runtime) and therefore will result in slightly better performance, lower memory usage, and better battery life for apps."
 In case of using NuGet version you can use "Any CPU" as architecture. In case of vsix package you have to to use separate x86, x64 and ARM architectures - "Any CPU" will not work. Three separate architectures result into Windows Store package to be 3 times bigger as it contains your game or app three times (once for every architecture). Fortunately, Windows Store should be clever enough to deliver only the correct one to user, when downloading your app from store.


NuGet package


 Now come the bad news: NuGet nor vsix did not work for me. I am not experienced in NuGet packages, so I would be happy if anyone could update this article if they find working solution. Problem with NuGet was: references under References in Visual Studio Community 2015 (VS) were marked with small yellow warning triangle after installation. Removing them and adding back by hand removed these warnings, but during compilation there were complains about missing win10{} in project.json file (which was missing completely). As I am not NuGet guy, I got lost.


vsix package


 I focused on vsix package, as it is recommended for Javascript apps and it was my case. After vsix installation go to References in Solution Explorer (right click → Add References)


 In Extensions tick Google Analytics SDK. But be sure to tick the right one – in right panel you can see properties, so choose the one with Targets UAP 10.0 (Universal application):


When compiling, be sure to set target architecture to x86, x64 or ARM:


 Now, building for ARM and x86 works, while attempt to build for x64 fails:


 Reason for this is missing dll library. Go to:
c:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\GoogleAnalytics.Native.SDK.Win10\1.3\Redist\CommonConfiguration\
 (you can get this path if you place mouse cursor over extension name)

And you will find, that x64 directory is missing (it is missing already in vsix package – you can open it with zip and watch):


 Solution is to build missing dll from source:

1) go to https://googleanalyticssdk.codeplex.com/SourceControl/latest and download latest source code.

2) open GoogleAnalytics.VS2015.sln in VS,

3) change build to Release and select Configuration Manager … at the top:


4) change platform for Google.Analytics.Native.Win10 to x64:


5) build Google.Analytics.Native.Win10 from Build menu:


6) to make things more dramatic, there is syntax error in PlatformInfoProvider.cpp – you have to delete the "=" sign and run build again:


7) in your project root, there should be now new directory x64\Release\GoogleAnalytics.Native.Win10\ with compiled dll:


8) take it and copy it into x64 directory where library is missing (c:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\GoogleAnalytics.Native.SDK.Win10\1.3\Redist\CommonConfiguration\)

 Now, when building package for Windows Store select architectures like this:



Using Google analytics in code


 To use Google Analytics in your Javascript code, initialize it first with config, where most important part is your Google Analytics tracking Id:

    var config = new GoogleAnalytics.EasyTrackerConfig();
    config.trackingId = "UA-XXXXXXXX-Y";
    config.appName = "My app name";
    config.appVersion = "1.0.0.0";
    GoogleAnalytics.EasyTracker.current.config = config;

 Track events and page views like this:

    GoogleAnalytics.EasyTracker.getTracker().sendView("main");
    GoogleAnalytics.EasyTracker.getTracker().sendEvent("category", "action", "label", 0);

 Now you can switch to you Goole Analytics console and check if you see new users, page views and events.







Friday, November 27, 2015

Mobile Income Report #16 - October 2015






previous parts
  Mobile Income Report #15 - September 2015
  Mobile Income Report #14 - August 2015
  Mobile Income Report #13 - July 2015
  Mobile Income Report #12 - June 2015
  Mobile Income Report #11 - May 2015
  Mobile Income Report #10 - April 2015
  Mobile Income Report #9 - March 2015
  Mobile Income Report #8 - January and February 2015
  Mobile Income Report #7 - December 2014
  Mobile Income Report #6 - November 2014
  Mobile Income Report #5 - October 2014 
  Mobile Income Report #4 - September 2014 
  Mobile Income Report #3 - August 2014
  Mobile Income Report #2 - July 2014
  Mobile Income Report #1 - June 2014
  Apps page - Portfolio (what are my assets?)


 If you do not want to miss any of my Income Reports you can follow me on Twitter. Just click the button above.

 Under Apps page you can see my portfolio. It is list of the games that are then reported in Income Reports. The portfolio is regularly updated with new information (releases for new platforms, new updates, ...)


What I did in October

  • our Futoshiki puzzle was approved at iTunes. We were also reviewed at "Gotta solve it", which is blog related to puzzle and brain games. Another review for Futoshiki appeared at RayWenderlich.com, which is site with great tutorials.


  • big portion of time I spent working on reskin of one of our former HTML5 games. The reskin turned into lot of changes and for mobile version of the game I had to explore Cordova tools. Now, most of the problems is solved. Unfortunately, Cordova wraps are still very slow on some devices. But in the end, I think that game looks nice - it is full of animated farm animals and has nice country related music:
  • still learning WPF as I want to use it in future for making tools, like game editors.



Report

 Here are figures for paid apps in October - more or less the same as in September:


 Most of the income is still from Shards:



 And here are free games with ads inside:
 Here is decrease from $169 in September. Main decrease is in income from Chartboost.


 Total income for October is $12,8 + $142,2 = $155,0. It is -13,6% decrease.



Next

 In November I will continue in working on our match 3 game - my current target is to create some level editor for it. I will also continue in my exploring of Unity.




Friday, October 23, 2015

Mobile Income Report #15 - September 2015






previous parts
  Mobile Income Report #14 - August 2015
  Mobile Income Report #13 - July 2015
  Mobile Income Report #12 - June 2015
  Mobile Income Report #11 - May 2015
  Mobile Income Report #10 - April 2015
  Mobile Income Report #9 - March 2015
  Mobile Income Report #8 - January and February 2015
  Mobile Income Report #7 - December 2014
  Mobile Income Report #6 - November 2014
  Mobile Income Report #5 - October 2014 
  Mobile Income Report #4 - September 2014 
  Mobile Income Report #3 - August 2014
  Mobile Income Report #2 - July 2014
  Mobile Income Report #1 - June 2014
  Apps page - Portfolio (what are my assets?)


 If you do not want to miss any of my Income Reports you can follow me on Twitter. Just click the button above.

 Under Apps page you can see my portfolio. It is list of the games that are then reported in Income Reports. The portfolio is regularly updated with new information (releases for new platforms, new updates, ...)


What I did in September


  • next I was working on Futoshiki remake in Unity. Futoshiki is now released for Android and is in approval process on iOS. I had to struggle with lot of issues from simple ones to hard ones. But, at least we managed to use Soom.la libraries for IAPs (Soomla Store) and social networks (Soomla Profile) as well as ads integration and mediation with Heyzap (+ Unity Ads, Chartboost and AdMob).



Report

 Figures for paid apps in September looks like this:

 September earning are half of the August ones. As usually most of the income is from Shards.

 Free versions with ads inside are here:

 Big increase in iOS Fruit Dating downloads is because of promotion event at AppGratis. Ad network shares changed only slightly in favor of Chartboost.

 Total income for September is $10,3 + $169,0 = $179,3. It is +2,4% increase - in other worlds: it is almost the same as month before.



Next

 I will continue our work on match 3 game. I have one big task ahead - to make some level editor for it. As I finally got some experience with Unity (good as well as bad), it is maybe time to think about some game bigger game in it.




Sunday, October 11, 2015

Futoshiki





Futoshiki at Google Play Futoshiki at iTunes

 If you like Sudoku, then you'll love Futoshiki. Futoshiki is another popular Japanese numeric puzzle game.

 On a 5x5 grid the aim is to put, in each row and column, numbers from one to five, so they do not repeat themselves. Numbers must also respect the relational signs placed between some cells. Some cells may already be filled from the beginning. They are, like the relation signs, part of the puzzle and cannot be overwritten.

 To make notes, simply tap the selected cell second time. Tapping once again exits notes mode.

 For solving puzzles you get "win points". You can unlock new background themes with them.

 The game includes a generator offering the player three difficulty levels, from easy through medium to hard. For each generated puzzle only one unique solution is guaranteed.