Windows Phone development

Hi,

What is the current status of Windows Phone 8 development? Is there a way to go native? Or should I use a javascript mobile framework? Do you have any advice or tutorials?
I already made an android/ios app, I just need to port it on Windows Phone.

Thanks for your time.

At the moment, I believe that you should be able to support Windows Phone using HTML5, though we do not help automate support through the command-line tools. I personally had a lot of problems with getting approved to really target the platform.

If there’s an interest, I think that the tools could be extended to support Windows Phone using HTML5, at least, as a starting point. There are some technical things that make it difficult to target the platform on a native level – it does not support OpenGL, though I hear the ANGLE project (which implements OpenGL over DirectX) has added Windows Phone support over the time. The other blocker was “unmanaged C++ code”, which I believe was improved in the release of Windows Phone 8.

My first test would be to use the Windows Phone SDK to create a sample HTML5 project, and get it running. Take a simple OpenFL project, and paste it in the project folder – overriding the index.html, or possibly using a tweaked index.html if necessary. This should give a good indicator of whether this all is viable. I don’t think a different JavaScript framework would work better, generally speaking

1 Like

Ok thanks, I will probably use HTML5.

So… I’ve tried this with very simple project and it worked on windows phone! :slight_smile:
Will do more complex experiments soon.

3 Likes

Here is my experience on Windows Phone 8.0 and 8.1 when targeting HTML5 and issues I’ve been running in to:

  • If I provide ANY audio, the game fails to finish loading. Otherwise, it completes an runs.
  • Touch input doesn’t fully work. I tried IE on Windows Phone 8.1 on a lower-end device and they did work just fine. On a separate, faster device, I tried Windows Phone 8.0. Button presses were not being detected and every time you tap the screen, the entire game content area highlighted briefly. I upgraded this same device to 8.1, and the highlight has stopped, but clicks are still not detected. Mouse X and Y do report correctly if you drag your finger around/ tap. This is weird to me as both of these devices are the same manufacturer and line of phones.
  • Frame rate is poor if much is going on in game. As a test (on all browser/device combos), I displayed 250 sprite sheet animations simultaneously. PC/Mac browsers can handle this at steady 60 fps. Android and iOS browsers fall down to 25-30 fps. IE on Windows Phone drops to 1-5 fps.

I would also like to see improved support for Windows phone (many clients want to include these devices nowadays). If anything I’ve mentioned is better fit for another thread, let me know. Also I can provide more details/answer questions to help.

1 Like

The audio issue could be a matter of providing the format it expects, or it could be a SoundJS bug (like we’re talking about on the other thread).

I believe there were some touch event coordinate fixes in recent dev builds, on browsers that dispatch mouse events, its not an issue, but some devices or systems report only touch events, this fix has not gone out in a release yet, but could be worth trying: https://github.com/openfl/lime/commit/f2d8b91306d86ccbc3b6ef96bd8ecb87e576fdcb

Some browsers suffer from overdraw, it’s possible that using “-Ddom” for DOM mode would help, as it means you can use a static background image (for example) and have it remain in a DIV instead of being blitted each frame. Any BitmapData operations will still blit to a single canvas, so .draw or in the case of sprite sheets, Graphics calls also blit to a single canvas, so that might still perform as expected.

With Windows Phone 8.0, I expect that C++ support could be done, now, but each time I reached out to Microsoft employees with certain questions I had, I never got anywhere. I’m also unsure of the time commitment for getting it all working and supporting it, but if Microsoft or anyone else were interested in helping make it a reality (assuming we would use ANGLE to use OpenGL rendering over DirectX, I think) then that might be a much better target long-term than only HTML5, though we might as well improve any low-hanging fruit with the HTML5 support regardless

1 Like

Thanks. I will try that updated code and see if it makes any difference.
UPDATE: I updated the hx file you posted, and it didn’t make any difference to IE mobile : (
UPDATE 2: See below post re: mouse events.
UPDATE 3: Fixing this to the correct event type (MouseEvent) has enabled audio playback. Two birds, one stone!

I also forgot to mention in my post that I cannot get IE to play any audio via openfl HTML5 target (if I runtime load instead of preload, which never advances). I need to do some more testing, but audio will play on PC/Mac/Android/iOS in any browser with me only providing OGG and MP3 formats. The browsers can all play M4A files on their own without plug-ins or the like, but just not through openfl/soundjs it seems. Again, I notice M4A is not considered in some source code (that I think was in soundjs), so I will try modifying that and see if I can get that format simply working. I’ll also check out soundjs threads to see if anyone has mentioned this there and report back.

Again, I appreciate your support!

And I forgot to mention, for the touch support, I am using TOUCH_BEGIN and TOUCH_END to toggle a down/up state on a button and trigger the callback. I also tried swapping in “pointerbegin” and “pointerend” event strings to no avail (supposedly IE supports these).
UPDATE: I changed the Touch events to Mouse events and it is working now on my windows device. Sigh, I guess yet another conditional for IE. Wonder if we can eventually support Pointer events to mitigate these issues (http://www.w3.org/TR/2014/WD-pointerevents-20141113/).

Do you think there’s a patch here we should apply within OpenFL or Lime, for now?

If you can get at the event chain, that may help a bit. Here’s along the lines of what I had to do for IE mobile detection when I register my events:

#if js
  var userAgent = js.Browser.navigator.userAgent;
  var mobilePlatforms = ~/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i;
  
  //check if platform is IE mobile
  if( userAgent.indexOf( "IEMobile" ) > -1 )
      //use mouse events...
  //check if platform is mobile
  else if( mobilePlatforms.match( userAgent ) )
       //use touch events...
  //non-mobile
  else
       //use mouse events...
#end

So in your case, for a quick fix, if IE mobile then detect MouseEvent and dispatch a TouchEvent in it’s place.

It may be worthwhile/better to incorporate Pointer Events, since it seems like that’s going to be the new web standard, which would mitigate these checks. For now, maybe we can safely deal with events through a PointerEvent type (listen for touch/mouse and dispatch Pointer in-place of) until PointerEvent is fully supported across browsers, then we can switch to use it normally. What do you think?

UPDATE
One of the updates to openfl (I suspect) seemed to resolve the mouse event problem where it wouldn’t trigger on mobile. I still think it’s a good idea to go with Pointer Events, but for now Mouse Event works again as intended on mobile touch screen browsers.

We should catch mouse events and dispatch a touch event in addition to it, already. I wonder why this is not working, yeah, but I think we need to handle pointer events where appropriate

Long-term, I think that native support of Windows Phone and the Windows Store are ideal, I’ve had serious problems trying to get it to work, and the Microsoft evangelists I spoke to said they would find someone to help, but never did. I understand, though, it’s hard to find the right person sometimes :slight_smile:

2 Likes

Hi Joshua,
Maybe this will sound crazy , but do you try to reach Satya Nadella ? He try to make a dramatic changes in Microsoft with shift of some product to be using on other platforms such as Android and iOS ( MS Office at example) . I think if you write to him a letter with clear explanation what you try to achieve and how this will help to Windows ecosystem ( the benefit will be enormous , more games and application in windows store, more developers ) he will response. You can’t lose it if you try. This is him email which I found in internet : satyan [at] microsoft.com

I expect you have, but for the record…

Have you contacted MS Open Technologies? They contributed (and maintain) a Windows Phone back end to another popular open source game engine for all the reasons @LarryB mentions above. This is the one I’ve started working with now because I have to target WP8, but I’d really much rather write Haxe than C++ :smile:

Also, are you aware of the Kha engine? It’s also Haxe, open source and can target a lot of platforms including WP8 and even PSM. Perhaps lessons could be learned from its code?

I’m also intrigued by the console targets that have been mentioned. If XB1 is on the list, as it seems to be, then doesn’t that imply a DirectX compatible back end is coming? :wink:

We’re targeting a console middleware that supports everything

So, I was able to run HTML5 version of my game on Nokia Lumia 521 with Windows Phone 8.1.
Problems are the same as mentioned by @jonnym:

  1. Sounds not loading;
  2. Game works a bit slow;
  3. Problems with fonts alignment, multilines + some others. These problems apply to HTML5 version on desktop as well.
  4. Other minor problems.

Guess, we need some native support.
Here is a screenshot of the game. :smile:

2 Likes

Can you tell us more about the process to run an html5 game on WP8? Is there a WP8 html5 framework to use? Did you made some externs?

Also, I get recently in touch with someone on MS and I think they will provide some help for a native target soon.

If anyone is interested please send them my way :slight_smile:

I was doing the same as @singmajesty said before:

  1. Built project for HTML5
  2. Created blank project with Visual Studio
  3. Then just copied my project files, including resources to this blank project and build it.
1 Like

Currently I’m choosing engine/framework for crossplatform development. We will need iOS/Android and Windows Phone support.

So I’m wondering - are there any updates on native Windows Phone support in OpenFL?