Wednesday, February 29, 2012

Windows Phone - Google Analytics tracking

Yesterday I had a look at the options available to Windows Phone developers wanting to add Google Analytics tracking to their Windows Phone apps. I had expected this to be a bit tricky since Microsoft and Google aren't best friends neither of them wish to promote the other's products. I was right.

There's something called Microsoft Silverlight Analytics Framework with support for a whole bunch of different analytics services and this seems to be the recommended framework if you want to track user behavior in WP apps. Unfortunately this doesn't come as a NuGet package so you need to download and install a separate MSI. I'm aware of the fact that the NuGet package manager isn't an official Microsoft product, but it really does simplify the process of installing third-party libraries.

Since I'm doing this with my Android hat on I was expecting something at least remotely similar in setup time to EasyTracker. I was wrong. Not only does it require me to write an AnalyticsService and AnalyticsTracker class and add the service to the App.xml, I also need to make sure to add the right dlls to my project (NuGet would have done this for me). Among the required dlls there's one called System.ComponentModel.Composition.dll and you would expect to find that one in the component called ComponentModel, but no, if you add that one you'll get a runtime error related to a class called CompositionHost. What you need to do is to make sure to add the Microsoft.SilverlightMediaFramework.Compatibility.Phone dll, because that's the dll that contains the correct version of the CompositionHost...

I finally figured it out and now I have the whole thing set up complete with dependency injection and all:

public class MyClass
 [Inject]
 public IAnalyticsTracker AnalyticsTracker { get; set; }

        public void SomeFunction()
        {
   AnalyticsTracker.TrackEvent("MyCategory", "MyName");

Note: Page tracking can be handled automatically by the framework so there's no need to do this manually.

Windows Phone from an Android Developer's Perspective - The first week

I recently got assigned to take a look at Windows Phone development for an upcoming project at work. I regret that I didn't start blogging about this from day one since it would have been an interesting account of how it is to come as an Android developer to the Windows Phone platform. Anyway, here's a quick summary of the first week with WP:

Language
My first reaction to Windows Phone and C# was actually a lot more positive than I had anticipated it would be. The C# syntax is not at all weird (unless you start messing with lambda expressions). It feels like a mix between Java and ActionScript, both of which I'm very comfortable.

Android vs Windows Phone
1-1
IDE
The standard Visual Studio Express IDE was a disappointment with a lot of features lacking compared to Eclipse. I'm aware of the fact that a lot of the shortcomings will go away once I get Visual Studio Professional and ReSharper, but that comes at a price of almost €800...


Android vs Windows Phone
2-1
User Interface
Another positive experience was the way Windows Phone user interfaces are created. Windows Phone UIs can be created using XAML files where components are arranged in nested tags just like on Android. Each XAML has what is called a code-behind C# file that initializes the view by parsing the XAML. From the code-behind C# file you get immediate access to the components on the view (you don't even have to do findViewById). And to add a big cherry on top you also have the possibility to add data bindings between the XAML and an underlying data context.

This way of defining the UI and the ability to use data bindings has led to the de-facto Windows Phone standard of separating view and logic into a pattern called MVVM (Mode View ViewModel). The idea is that the View (XAML + code-behind) is wired to a ViewModel using databindings and the ViewModel is the one responsible for providing the view with data to show from the model. This means that you'll have a ViewModel without any references to UI components and UI code, thus making it testable.

I wouldn't say that the Windows Phone way of defining and working with views and UI components is better than Android, but it sure has it's advantages. On the other hand does Android handle styling better (by a small margin though) and Android has some very nice features for working with shape drawables that I haven't seen on Windows Phone.

Android vs Windows Phone
3-2
Logging
Logging on Windows Phone is done using Debug.WriteLine() calls, similar to the Log.d() call on Android. If you want anything more fancy and wrap this into a framework with the ability to send logs to different targets, set log level filtering and things like that you probably go for SLF4J on Android. When you want to do the same on Windows Phone there's a few frameworks to chose from and the one I tested the most was NLog.

Unfortunately NLog wasn't as painless to work with as SLF4J. NLog has a lot of targets to chose from out of the box, but not one for the Debug.WriteLine. NLog can log to the console, but that only works on the emulator (and only after a registry hack). I tried to use one of the network targets to send logs to a separate log reader (for instance Apache Chainsaw) but it proved damn near impossible to get it to work. I ended up scrapping NLog and instead wrote my own wrapper for Debug.WriteLine with log levels and parameterized log messages (i.e. logger.debug("some output p1: {} p2: {} p3: {}", "param1", 2, parameterThreeObject)

Android vs Windows Phone
4-2
JSON
Json parsing on Windows Phone is as painless as on Android. On Android you either chose Gson or Jackson and similar functionality on Windows Phone is provided by Json.NET. There's also native Json parsing, but Json.NET is more feature-complete than the native functions.

Android vs Windows Phone
5-3

REST
Making network calls on Windows Phone is a really painless business. There's a simple WebClient with methods for doing asynchronous calls to not hang the UI and there is the more advanced HttpWebRequest. So far it seems like there's little need to use anything other than the WebClient. I did however also have a look at a framework called RestSharp and it handles automatic deserialization of XML and JSON (using Json.NET), supports GET, POST, PUT, DELETE, handles authentication and file uploads.


Android vs Windows Phone
5-4

Dependency Injection
I've come to fall in love with the concept of dependency injection/inversion of control and I've become really familiar with the way it's done on Android using Guice/RoboGuice. One of the first things I did when I started with Windows Phone was to try and find a Guice equivalent. The product that in my opinion best fills the role on Windows Phone is Ninject. Ninject supports several different ways of setting up the bindings, it has several different injection patterns, it supports providers and everything else you can do with Guice.



Android vs Windows Phone
6-5

Persistence
I have not had a chance to explore this enough yet, but I did try the IsolatedStorageSettings which is a persistent key-value pair map available only to your own app. It works in a similar way to the SharedPreferences on Android, but it handles any kind of values, even complex objects can be persisted. I haven't had a chance to try the file and database APIs yet, so I can't really judge those.


Android vs Windows Phone
6-5

Testing on a device
This was a real disappointment, but not really a surprise. I have gotten so used to the openness of the Android platform that I came to expect that I would be able to test my code straight away on the Nokia Lumia 800 phone we bought. Alas, you need a Live-ID (not a big deal), an AppHub account, a Zune installation and you need to unlock your phone for developer testing. Getting a Live-ID is not so different from signing up for a Google Account, it is what identifies you across the somewhat sprawling set of Microsoft products. Getting an AppHub account is a matter of signing up for an annual $99 subscription and if you are registering as a company waiting a few days until GeoTrust has verified your account. GeoTrust, seriously? Why on earth is this required at all and why is this process handed over to a third party? Zune is unfortunately unavoidable and it seems like unnecessary software for me as a developer to have to install on my machine.


Android vs Windows Phone
7-5


Summary
Working with Windows Phone was not at all as bad as I had expected it to be. I have been positively surprised by a lot of the things I've seen so far and I do hope that my initial positive experience will stick when I really get my hands dirty in the weeks to come.

Tuesday, February 28, 2012

Design your own piece of the dungeon

I'd like to invite everyone to create your own dungeon room for use in Dweller. The maps in Dweller are built using pre-defined blocks of 7x7 tiles, puzzled together so that exits align. A room can look almost any way you like as long as it has at least one exit. Exits are placed in the absolute middle of an edge (i.e. on the fourth tile of an edge, with three tiles to the left and three tiles to the right). Some examples of valid rooms:

 Room with four exits

 Corridor with two exits

 Library with one exit

Room with vault and four exits

If you'd like to give it a try and design your own room please use this online map editor my Callidus Rex. Once you are happy with your room click save and send me the comma separated list of map data. Most of the available tiles should be self explanatory. If you want to use an "exotic" tile that you haven't seen in-game before please let me know.

Sunday, February 26, 2012

Ad-supported version?

My goal with Dweller has never been to make a commercial game. Dweller was started many many years ago thanks to my childhood passion for roguelikes (I played Moria a little over 20 years ago). I had started experimenting with mobile development (I released a commercial game for the Mophun platform available on Sony Ericsson devices) and it occurred to me that there weren't any roguelikes available for mobile devices. I really liked the thought of trying to convert the traditional 20+ roguelike key-bindings to a device with only 12 available keys and a very limited screen resolution.

Looking back at the years of development it has been a real encouragement to get so much positive feedback from players. Knowing that players have enjoyed the game and stuck by it for so long has really made me want to keep developing Dweller. Thank you!

Still, the thought of getting some monetary encouragement as well as kind words is a nice one. So far the PayPal Donation option hasn't resulted in much money, but I'm truly grateful for the donations I have received. I have toyed with the idea of providing a commercial version of Dweller with more features (new games modes, a new playable class and so on) but Dweller is not there yet. If I ever add a commercial version it will not be at the expense of the free version. My goal is still to make Dweller the best free fantasy RPG/roguelike there is.

Another idea would be to have one ad-supported free version and one ad-free version sold for a small cost. Both versions would have the same functionality but the ad-supported version would show ads at the loading screen (but not in-game). My main concern is how this would be received among the players. Would you stop playing Dweller if you were presented with an ad while the game is loading?

Saturday, February 25, 2012

Opera Mobile Store

This post proves that I need to pay more attention to what I'm doing. Me and probably anyone else developing an Android game got approached by Opera (yes, the browser developer)/Handster in December 2011 about their new Opera Mobile Store asking me to upload Dweller to their store. And so I did (only the J2ME version) and totally forgot about it afterwards. Now when I log in again and have a look I saw that the version I uploaded 1.11.4 has been downloaded 20000 times! That's not bad but it also proves that I'm taking Dweller as a product a lot less serious than I should... I will think more about how to market Dweller (yes it's free, but it doesn't hurt to treat the game more serious anyway) and possibly also how to profit from it.

Friday, February 24, 2012

Calling all J2ME players part 2

Ok, so it wasn't the use of CLDC 1.1 that caused problems when trying to run Dweller on Nokia handsets. I do however think I've found the cause now, and it has to do with signing of the Dweller.jar file. I had always thought that signing a jar file for deployment on a phone worked the same way as when signing a normal jar file, but I was wrong.

I have decided to ditch signing of the J2ME version of Dweller. The primary purpose of signing a J2ME jar is to not have to ask for permission from the user to access certain parts of the API. And I'm not using any of that in Dweller so it's safe to publish Dweller as an unsigned jar.

I have uploaded a new version of Dweller for J2ME (1.16.9). I would very much appreciate if any Dweller players using J2ME handsets would report back to me if the latest version is working or not.

Thursday, February 23, 2012

Calling all J2ME players. I need your help!

I've been struggling for many versions now with problems reported by a lot of players that they can't get Dweller running on their J2ME phones. It seems like the most recent version that worked on all handsets was 1.9.1. In the next version I changed from CLDC 1.0 to CLDC 1.1 to be able to use floating point numbers for UI scale and alpha values. I believe it is this change that for some reason has been causing a lot of problems for some players. The problem seems to primarily exists on Nokia devices. Sony Ericsson is running Dweller just fine and I haven't heard of other devices that haven't been able to run Dweller.

Tonight I decided to revert back to fixed point math for scaling and alpha and by doing so it was possible to go back to CLDC 1.0 again. I also had to change my logging since something like LoggerFactory.getLogger(MyClass.class) doesn't work on CLDC 1.0 due to the fact that NoClassDefFoundError isn't included in CLDC 1.0

I am now hoping that as many J2ME users as possible out there would like to help me test the new version and verify if Dweller is running on their devices. Please try http://files.dwellergame.com/j2me/Dweller.jar (version 1.16.8) and let me know if it works or not

Tuesday, February 21, 2012

Dweller 1.16.7

This is yet another bug fix and balancing release. I was hoping to be able to have some time to add new features and improve spell casting, but that will have to wait until the next release. Things that have been fixed in this release are:


#83 Fix J2ME preverification
#79 Tweak orc disarm chance
#73 Nerf troll healing
#37 Improve level text in highscore list
#84 Add an option to disable pathfinding by tapping
#92 Problem with pushable stone blocks and tap-to-move
#90 Update cursor text when target dies
#86 Prevent certain monsters from being charmed
#81 Add a batch/shell file to the Dweller for Desktops release
#88 Missing translation when buying a service from an NPC
#87 Never switch dungeon branch when falling through a trap door
#91 Double "you are standing on" messages

Friday, February 17, 2012

Dweller 1.16.6

I had to do an unplanned release to fix some issues in 1.16.5 where keys sometimes became unresponsive. The new and fixed version is available to download on Android Market and in the Download section. Enjoy!

Thursday, February 16, 2012

Dweller 1.16.5

Dweller 1.16.5 is now available for download. The main focus of the release has been to improve the user experience. I have removed the <more> prompts (you can enable them from the settings menu if you really want them) to make the game faster. Another really great addition that many players have asked for is tap-to-move with full pathfinding to make exploration easier. Targeting feedback has also been improved and there's a new Equip menu that pops up if you pick up an item of a type that you aren't already using. Full change log:


#72 Items and monsters in walls
#50 Move buy/sell options to top of NPC menues
#57 Remove messages when selling/buying
#58 Change targeting icon when you can see but not target the selected creature
#47 Evaluate if a Equip popup should be shown when picking up an item of a type that isn't equipped
#73 Nerf troll healing
#69 Reduce amount of more prompts
#49 Remove blood splatter after a while
#30 smaller text log..
#17 Pathfinding
#42 Use Android display density to scale UI accordingly
#66 Monster sleep and idle animations not removed
#56 Improve item comparison
#77 Add "Miss" scrolling combat text (sct)
#78 EFFECT_LEVITATE_TARGET message missing/incorrect
#67 Allow buy/sell when a quest is ready to be turned in

Tuesday, February 14, 2012

Cube World - More Voxels please!

Cube World is a fantasy rpg set in a huge voxel world. The game is in development as a one-man effort by a guy called Wollay. Check it out one of the videos:


Monday, February 13, 2012

Roguelike Radio is getting better and better!

The Roguelike Radio team has outdone themselves these last few episodes and they've been a joy to listen to. The most recent episode with an interview with David Ploog (one of the designers behind the last few years of releases of Crawl) was great with a lot of excellent anecdotes and behind the scenes insights into one of the best roguelikes still in development.

The Infra Arcana and Procedural Generation episodes have also been outstanding. Well done guys!

Sunday, February 12, 2012

Preparing for the next release

My goal is to release the next version of Dweller during next week. I'm trying to finish up the features I'd like to have in the release and then start testing. Last night I started working on pathfinding and tap-to-move. And these are the features and fixes already done:

#72 Items and monsters in walls
#50 Move buy/sell options to top of NPC menues
#57 Remove messages when selling/buying
#58 Change targeting icon when you can see but not target the selected creature
#47 Evaluate if a Equip popup should be shown when picking up an item of a type that isn't equipped
#73 Nerf troll healing
#69 Reduce amount of more prompts
#49 Remove blood splatter after a while
#30 smaller text log..

Thursday, February 9, 2012

Please join the forums and help me shape the future of Dweller!

The Dweller forums have so far been a great success and a lot of good ideas and discussions have been started there. If you haven't already visited the forums please do so now and join the Dweller community!

Wednesday, February 8, 2012

Dweller 1.16.4

Dweller 1.16.4 has been released. The version solves some issues with pushable stone blocks, adds a new user created artifact and solves a problem that prevented panning the map after the menu has been opened. Change log:


  • CHANGE Weapons with draining now base the chance of success on attack vs defense instead of magic vs magic
  • #61 Opening menu removes ability to pan screen
  • #44 Added a new artifact
  • #15 Pushable stone blocks blocked movement in some cases

Tuesday, February 7, 2012

Quests are finally working on Android!

The very annoying bug on Android where quests sometimes didn't complete properly should now have been solved. If you are still experiencing problems with quests please let me know!

Monday, February 6, 2012

Hawken beta program

Some great news this week: My favorite mecha/robot FPS Hawken has opened up for signups to their beta program under the parole "War is a machine". Me like!


Thursday, February 2, 2012

Dweller 1.16.1

The recent change to hardware keys triggering on key up instead of key down unfortunately caused quite a bit of problems, especially for J2ME users, This new release primarily fixes this issue but it also addresses:

Wednesday, February 1, 2012

Please use the Dweller blog for Dweller related issues!

I am cross posting all Dweller related posts to this blog but I would like to encourage anyone interested in Dweller to visit the Dweller site and blog for more info. Thanks!

Problems with quests in 1.16.0?

I am very interested in hearing from people that still have problems completing quests or when quests do not progress further. If this happens to you please use the "Send save game" feature from the main menu. The first player to report such an issue and provide enough information for me to solve the bug will be allowed to design an in-game artifact.