×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    25

    Question XNA games for WP 7 have problems on some WP8 resolutions?

    Hi all
    as Microsoft announced support for developing games with XNA in WP8 is not available anymore , but WP8 devices can run games developed to WP7 .

    So WP7 games work well on WP8 devices on resolution ( WVGA) as a full screen game .

    but on resolutions :

    - WXGA
    - 720P


    the game doesn't work on all the screen size there is always a black area distorted ( Vertical or horizontal according to chosen resolution) which look like the gamed doesn’t run on a full screen mode for the user.

    as there any work around to avoid this distortion ?

  2. #2
    Registered User
    Join Date
    Mar 2013
    Location
    Egypt
    Posts
    12

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    I have the same issue !

    I think you should start building it again using Direct3D 11, because I think that XNA will not be supported again.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    957

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    I dont think you will have a way to fix this unless you more your game to DirectX but then you will no longer be able to target WP7. Its not a easy decision to make. You can always consider Monogame, as its an easier path to migrate from XNA I think.

  4. #4
    Registered User
    Join Date
    Feb 2013
    Posts
    25

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Thx Mostafa for your help

  5. #5
    Registered User
    Join Date
    Feb 2013
    Posts
    25

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Thx Joao , Monogame still not fully implemented and there are some methods which through Notimplemented exception and moving to DirectX and C++ at the same time need high learning curve though I search for a solution to write XNA and run apps properly on Windows Phone 8 or another intermediate solution to deal with DirectX without need of thousands of hours to learn C++ & DirectX.

    Most third parties i found is not fully implemented and can't be dependable until now.

    Another challenge is that in some times I need only 3D models or some work like Panorama inside my application not Full 3D Game and in this case certainly I can't use XNA if my application is developed to WP8.

    So, as there any full implemented free third party i can use for 3D models and Panorama?

  6. #6
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    You can fix this easily. XNA is limited at 800x480 resolution and when you use it on 1280x768 resolutions, hardware scaler will scale up your image and you won't find any distortions. However, when you run your app on 720p displays, due to the fact that the aspect ration is different i.e. the screen is wider, your image is scaled up and padded with black rectangles.

    To avoid this issue, you need to detect if you are running on 720p devices using reflection and change back buffer dimensions to 800x450. Now you will not feature any black bands on either side. You have also gained some free performance since you are rendering less pixels.

  7. #7
    Registered User
    Join Date
    Mar 2013
    Location
    Egypt
    Posts
    12

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Quote Originally Posted by to_pe View Post
    You can fix this easily. XNA is limited at 800x480 resolution and when you use it on 1280x768 resolutions, hardware scaler will scale up your image and you won't find any distortions. However, when you run your app on 720p displays, due to the fact that the aspect ration is different i.e. the screen is wider, your image is scaled up and padded with black rectangles.

    To avoid this issue, you need to detect if you are running on 720p devices using reflection and change back buffer dimensions to 800x450. Now you will not feature any black bands on either side. You have also gained some free performance since you are rendering less pixels.
    Do you have any samples of how to detect that the Wp7 app is running on 720p device using reflection ?!

  8. #8
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Sure, here is the relevant snippet:
    Code:
    int? scaleFactor = null;
    var content = Application.Current.Host.Content;
    var scaleFactorProperty = content.GetType().GetProperty("ScaleFactor");
    if (scaleFactorProperty != null)
    {
    	scaleFactor = scaleFactorProperty.GetValue(content, null) as int?;
    }
    if (scaleFactor == null)
    	scaleFactor = 100;
    
    _width = _width * (double)scaleFactor / 100.0;
    _height = _height * (double)scaleFactor / 100.0;
    if (scaleFactor == 150)
    {
    	graphics.PreferredBackBufferHeight = 450;
    	graphics.PreferredBackBufferWidth = 800;
    }
    Also detect if you are running on Windows Phone 8 first.

  9. #9
    Registered User
    Join Date
    Feb 2013
    Posts
    25

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Quote Originally Posted by to_pe View Post
    Sure, here is the relevant snippet:
    Code:
    int? scaleFactor = null;
    var content = Application.Current.Host.Content;
    var scaleFactorProperty = content.GetType().GetProperty("ScaleFactor");
    if (scaleFactorProperty != null)
    {
    	scaleFactor = scaleFactorProperty.GetValue(content, null) as int?;
    }
    if (scaleFactor == null)
    	scaleFactor = 100;
    
    _width = _width * (double)scaleFactor / 100.0;
    _height = _height * (double)scaleFactor / 100.0;
    if (scaleFactor == 150)
    {
    	graphics.PreferredBackBufferHeight = 450;
    	graphics.PreferredBackBufferWidth = 800;
    }
    Also detect if you are running on Windows Phone 8 first.
    Thx for your help, I can detect by this code in WP7 apps as I can find:

    Code:
    var content = Application.Current.Host.Content;
    but what is equivalent to it in XNA which gives different scale factor for each resolution ?

    As using :


    Code:
    graphics.GraphicsDevice.DisplayMode.Width
    
    graphics.GraphicsDevice.DisplayMode.Height
    will give same values on all resolutions ?

  10. #10
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    My snippet will extract the scale factor. If it is 100, the resolution is 800x480. If it is 160, the resolution is 1280x768. If it is 150, the resolution is 1280x720.

    Of course your snippet will return 800x480 since that is the maximum allowed resolution for XNA. It will scale up to the real resolution automatically.

  11. #11
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    297

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Quote Originally Posted by to_pe View Post
    My snippet will extract the scale factor. If it is 100, the resolution is 800x480. If it is 160, the resolution is 1280x768. If it is 150, the resolution is 1280x720.

    Of course your snippet will return 800x480 since that is the maximum allowed resolution for XNA. It will scale up to the real resolution automatically.
    Your snippet will work only for apps, and not for XNA games.

    Quote Originally Posted by Windows Phone Developer
    but what is equivalent to it in XNA which gives different scale factor for each resolution ?
    I think what I found in the link below will not make you happy because what your trying to do is just impossible, you'll have to port your xna game to WP8 which uses D3D, fortunatly there are frameworks that can helps porting your game like MonoGame.
    http://social.msdn.microsoft.com/For...-1070ca1e49fb/

  12. #12
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Quote Originally Posted by Loukt View Post
    Your snippet will work only for apps, and not for XNA games.
    My snippet was extracted from a XNAGame project which is, according to Visual Studio, Windows Phone 7.1 XNA project. Do you want screenshot or a sample code as a proof?

    See for yourself.

    It works. Q.E.D.

  13. #13
    Registered User
    Join Date
    Mar 2013
    Location
    Egypt
    Posts
    12

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Quote Originally Posted by to_pe View Post
    My snippet was extracted from a XNAGame project which is, according to Visual Studio, Windows Phone 7.1 XNA project. Do you want screenshot or a sample code as a proof?

    See for yourself.

    It works. Q.E.D.
    but you didn't mention that you added a reference to System.Windows

  14. #14
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Oh, yeah...about that...
    It was kinda obvious since you don't have Application defined. But it is not as if it was impossible. Or that you needed to convert project or something

    I was half-wrong :P

  15. #15
    Registered User
    Join Date
    Feb 2013
    Posts
    25

    Re: XNA games for WP 7 have problems on some WP8 resolutions?

    Thx for your really appreciated help and support.

    Now I can detect each resolution correctly but I can't seen any change in scaling on 720 Resolution the distortion still exist.

    Another thing I want to know about these 2 lines of code:

    Code:
    _width = _width * (double)scaleFactor / 100.0;
    _height = _height * (double)scaleFactor / 100.0;


    I can’t see you use them in your solution , what they refer to?

Similar Threads

  1. Problems Douwnload Games using Combinated Delivery
    By Alvar_logo in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2007-04-21, 18:47
  2. 6288: problems with games
    By liusoren in forum Mobile Java Games
    Replies: 1
    Last Post: 2007-01-02, 23:13
  3. Problems with java games... crashes
    By DJAISI2k4 in forum Mobile Java Games
    Replies: 1
    Last Post: 2006-11-08, 22:40
  4. Problems with 6100 and installing of games
    By staff@mcsoftware2000.it in forum Mobile Java General
    Replies: 1
    Last Post: 2003-04-22, 21:53
  5. Problems running games on the 9210 emulator
    By itooam in forum Mobile Java General
    Replies: 0
    Last Post: 2002-05-19, 09:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×