This project has moved and is read-only. For the latest updates, please go here.

Porting the game to Windows Phone

Jan 11, 2014 at 9:58 PM
Edited Jan 11, 2014 at 10:03 PM

TODO list

  1. Extract game logic to a portable class library (WP8+Xamarin.iOS+Xamarin.Android)
  2. Move all localizable stuff to RESX resources
  3. Make sure Android version still works :)
  4. Create a separate Windows Phone project, build the UI:
    4.1. Main menu
    4.2. Game board
    4.3. Settings screen
  5. Wire up the UI with the game logic
  6. Implement pending feature requests for both platforms:
    6.1. Left-handed board layout
    6.2. Custom palettes
    6.3. Hot seat mode
  7. Publish the game to Windows Store
  8. Update Android app at Google Play
Note: the first version will not support network games,
I need to port Zyan to Windows Phone first.
Jan 11, 2014 at 10:13 PM
Android and Windows Phone platforms cannot share anything but the core logic of the game.
The UI layer for every new platform should be completely independent and created from scratch.
I don't currently know much about WP7/8, so I'm open to suggestions about the UI layer.

In Android version, game board is basically a table with a button in every cell.
The table is created at runtime, so that the board size is adjustable.
I think we can take similar approach for Windows Phone, can we?
Apr 9, 2014 at 2:47 PM
A similar approach must be possible.
I'll have a look on how to do that. (I already have a developer account for windowsphone)

I've made some of the screens (Home and settings)
I'll have a look when I'll have a moment for the other screens and the game core
Apr 9, 2014 at 10:52 PM
Welcome wtoscer, thanks for joining the project!

I haven't had much spare time for this project recently.
Extracting game code to the portable library is still on my todo list.

By the way, I've just had a look at your game W2048, it looks great, but it's not available in Russia for some reason.
Please update your application settings so I can install it on my phone.
Also, I can translate your resources to Russian, if your app has any messages to localize.

Regards, Alex
Apr 14, 2014 at 1:39 PM
Hello,
Just a message to say that the winphone project is on a good way.
I just have some problems with the multithreading on WP7, but I think I can solve this.
The game works in single player mode and IA mode
Apr 14, 2014 at 2:35 PM
Edited Apr 14, 2014 at 2:41 PM
Ah, that's great!

Could you please push your changes?
Have you managed to extract the shared game-related code into a portable class library?
Or just copied the files over to the Windows Phone project?
 
The game works in single player mode and IA mode
 
I think that should be enough for the first version!
Network gaming cannot be easily ported until Zyan framework supports Windows Phone platform.
Apr 14, 2014 at 2:37 PM
Also, what kind of multithreading problems did you encounter?
As long as I remember, thread synchronization in the game is very straightforward if you stick to C# 5.0 async/await pattern.
Apr 14, 2014 at 5:46 PM
Yes, i'll push my change, I just wait to have a good code

I'have copied the game-related code into my windows phone project, i don't know how to make a portable class library.

My problems with multithreading are with async/await pattern, my version of visual studio (v2010 for windowsphone) doesn't support this pattern, but I may have find the solution. I'll try as soon as possible.

For network gaming, I think same as you, that's why I did'nt try to make it work for the moment (I did'nt have a look to this part, so maybe it works, I don't know)
Apr 14, 2014 at 11:57 PM
Edited Apr 14, 2014 at 11:58 PM
No need to polish the code, that's perfectly OK to push work-in-progress! :)
I'll help extracting the code into portable class library to share binaries across two platforms.
Of course I don't insist, I can wait if you don't feel like sharing it right now.

As for async/await stuff, please consider upgrading to VS2012 or installing free VS2012 Express edition.
Without new asynchronous pattern, the code will grow much more complex and may need a serious rewrite.
Apr 15, 2014 at 6:20 PM
I think asynchronous is necessary just for network gaming no ?

For code sharing, I'll make it as soon as possible, I am on the tests for a first version now. The game work perfectly on single mode, and against computer (just some little bug to resolve)
Apr 15, 2014 at 8:44 PM
I think asynchronous is necessary just for network gaming no ?
 
Well, primarily, yes.
But, AI calculations can also consume time on slower devices.
That's why these operations are performed asynchronously: to ensure that UI isn't frozen.
Apr 16, 2014 at 2:59 PM
I see, this is a good reason.
But there is a problem, VS2012 is compatible with only Windows 8 and VS2013 can't make apps for WP7.. (I have a nokia lumia 800, so I need to develop for WP7)
Maybe we can make a portable library with a recent version of VS, and test if it works on WP7.

Here are some screenshots of the game on wp.
Image
Image
Image
Image

TODO :
Help page
async/await
Apr 17, 2014 at 12:00 AM
Edited Apr 17, 2014 at 1:34 AM
Looks great! :)
Does it support landscape mode? And left-handed version of the layout?
 
But there is a problem, VS2012 is compatible with only Windows 8 and VS2013 can't make apps for WP7.. (I have a nokia lumia 800, so I need to develop for WP7)
Maybe we can make a portable library with a recent version of VS, and test if it works on WP7.
 
Ah, I see!
So it looks like there is no official way of using C# 5.0 on WP7?

I've just bought Lumia 720 device for research and development purposes.
It has WP8 on board, so we'll be able to test the game on both platform versions.

By the way, help page is just a plain HTML file displayed using the built-in browser control.
It should simply be copied from the Android solution (see Assets folder).

Let's adjust a few things a bit so the layout matches the original version:
  • Game board should have the same padding on both sides as the panel with buttons below it
  • Status message (You have won...) with Play again/Quit buttons should be centered vertically and aligned horizontally
  • The cross symbol on the disabled buttons is not 'x' but large-sized '×' (unicode U+00D7, multiplication sign).
  • Background color is essential, it should be 003c45 (dark zyan). Hope it's possible.
Also, I must say that putting an email address on the front page wasn't that great idea :)
Of course I wasn't expecting tens of thousand downloads at the moment I did that...
Anyway I'm going to replace email with an url such as drench.codeplex.com for the next release.
Apr 17, 2014 at 1:15 AM
Edited Apr 17, 2014 at 1:29 AM
Here's what I mean:

endgame

Image

Image

I know that overriding OS styles is generally not recommended.
But games almost never follow this rule, they always use custom graphics regardless of the OS.
Also, the style should comply with the style of Zyan project (which is by the way the only reason why this game came into existence).
Apr 17, 2014 at 1:28 AM
Edited Apr 17, 2014 at 1:29 AM
One more thing: the lowest single-player limit should be 25, not 20.
I'll update this setting in Android version as well.
It's impossible to win at all when you only have 20 moves.
https://drench.codeplex.com/workitem/6

P.S. Overall, you did the awesome job!
I'm very impressed. Looks like the app is almost ready for release. Thumbs up!
Apr 17, 2014 at 5:10 PM
I'll try to make these changes (for the buttons, I don't know if it's possible, but I'll do my best)

For the mail, I understand, it was just for copying you app. A url website is a good idea.

C#5.0 on WP7, I haven't any idea, I just know that async/await is available on vs2012, I don't know how (via nuget if I remember)
Apr 19, 2014 at 5:43 PM
I'll try to make these changes (for the buttons, I don't know if it's possible, but I'll do my best)
 
Do you mean equal margins around the buttons?
It can be achieved by tweaking control paddings like that:

Paddings