Showing posts with label XNA. Show all posts
Showing posts with label XNA. Show all posts

Sunday, March 27, 2011

Windows Phone 7 XNA Games advertising

My earlier post Windows Phone 7 Silverlight, Adcontrol step by step, tricks and issues was mainly about admanager on WP7 Silverlight.

To implement admanager in XNA games, especially when you use XNA Gamestatemanagement sample Game State Management

Insert the following code in the GameplayScreen.cs file LoadContent method.

#if DEBUG
Guide.SimulateTrialMode = true;
#endif
if (Guide.IsTrialMode)
{
// adManager = new AdManager(this.ScreenManager.Game, "test_client");
adManager = new AdManager(this.ScreenManager.Game, "applicationid");
adManager.TestMode = false;

// Create a banner ad for the game
// bannerAd = adManager.CreateAd("Image300_50", new Rectangle(0, 700, this.ScreenManager.GraphicsDevice.Viewport.Bounds.Width, 120), RotationMode.Manual, false);
bannerAd = adManager.CreateAd("unitid", new Rectangle(0, 700, this.ScreenManager.GraphicsDevice.Viewport.Bounds.Width, 120), RotationMode.Manual,false);

this.ScreenManager.Game.Components.Add(adManager);

}



When you want to test it with the testad set adManager. TestMode true, uncomment the test_client admanager constructor and comment out the applicationid admanager contructor.



When you want to test with real ads, set adManager.TestMode false, comment out adManager test_client method and uncomment adManager applicationid constructor.



applicationid and unitid Identifies the application and is assigned to you during the publisher registration process.



Interesting discussion on this in this thread in which I participated!Where to insert the admanager in Gamestatemanagment sample

Friday, December 31, 2010

Windows Phone Connect Tool without Zune from Visual Studio

You need Zune to connect from Visual Studio 2010 to Windows Phone 7 Device to deploy applications from Visual Studio. This connection mode does not let you allow to debug with Media Library.

You can connect to Windows Phone 7 from Visual Studio 2010 using the Windows Phone 7 Connect Tool.

The following link from  Sebastian Schütze’s blog is   helpful:

Debug with Windows Phone without using Zune

Get the following tool

Windows Phone Developer Tools October 2010 Update.

Use the following link to use the Connect Tool

How to: Use the Windows Phone Connect Tool

I have given  below excerpts from this web site

To use the Windows Phone Connect Tool
  1. Open a command prompt and navigate to the directory containing the Windows Phone Connect Tool (WPConnect.exe). The location of this file will be %ProgramFiles%\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect for 32-bit installations. For 64-bit installations it will be located at %ProgramFiles (x86)%\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect.

  2. Connect your Windows Phone to your computer and ensure that it is detected by the Zune software.

  3. Close the Zune software after your Windows Phone is connected.

  4. At the command prompt, enter the command WPConnect.exe.

    NoteNote:

    You will receive confirmation that your device is now connected. Also, you do not need to disconnect from this tool. At any time, you can re-establish connectivity with the Zune software by launching the Zune software. However, after reestablishing connectivity with the Zune software, you must repeat the preceding steps if you want to debug an application with media APIs.

You should now be able to debug your application without the Zune software running.

Saturday, December 18, 2010

Windows Phone 7 XNA Assets

Some times, I start with the examples given by Microsoft or other bloggers and modify them to my requirements. This works fine. The trouble starts when you want to combine some of the snippets from one of these projects with new projects. You start running into configuration problems.

I got the errors in model loading in XNA and images. One of the errors is given below.

I got this error Cannot find type Microsoft.Xna.Framework.Content.Pipeline.Graphics.NodeContent when I tried to run a Windows XNA project with models.

I also had errors about not finding images.

I had to  move all the models and images to content. In addition I had to make sure in the properties of the model, we have the following:

  1. Build Action Compile
  2. Content Importer X File – XNA framework
  3. Content Processor – Model-XNA framework

For images

I have the following for both Content Importer and Content Processor Texture- XNA Framework

Friday, December 17, 2010

XNA 3d translation, rotation and scaling, Windows Phone 7

I had a several cubes in a Windows Phone 7 XNA application. I wanted to animate the cubes by rotating them on their axis. Let us say the cube is at Vector3 (-offsetx, –offsety,0f) position.

I used the following code to spin it on its own axis it   worked fine. 

 rotAxis = new Vector3(-offsetx, -offsety, 0f);
rotAxis.Normalize();
worldlist[iworld] = Matrix.CreateFromAxisAngle(rotAxis, angle) * rectangleTransform;



The rectangle transform brought it to where I wanted it. However I ran into problems when I wanted to spin it any other axis using rotaxis for example



 rotAxis = new Vector3(1.0f, 0f, 0f);


Then I saw this nice article   Rotations and translations  by Riemer. By the way if you want to do something in XNA you have to read the great tutorials in this site. His XNA book is also great.



So I did the following code where I translated the cube to move it  to center. Then I can spin the cube  on any axis!



 rotAxis = new Vector3(1.0f, 0f, 0f);
rotAxis.Normalize();
worldlist[Selectcount] = Matrix.CreateTranslation(new Vector3(-offsetx, -offsety, 0f ))
*Matrix.CreateFromAxisAngle(rotAxis, angle)*rectangleTransform ;

Wednesday, December 15, 2010

Create Games for Windows Phone 7, Recipes

Went to user group meeting on Windows phone 7 in Mountain View. Kenny Spade, Microsoft Evangelist showed us an excellent Microsoft site.

This is more like a Windows Phone 7 code samples or recipes site. Excellent and very useful. This will save you weeks of research of your own in any topic. All of this is under Microsoft

Go to Create Games for Windows Phone 7

Click on the Education/ Education Catalog 

which takes you to

Education Catalog

All of this under

Microsoft Permissive License (Ms-PL) 

Enjoy!!!

Windows Phone 7 XImporters, TextureImporters error

I wanted to run some of my old XNA projects which gave me a cryptic error message XImporters or TextureImporters missing. When I looked in my references these assemblies where there and properly referenced.

Then I came across this blog Assembly references in XNA Game Studio 4.0 beta projects need to be updated after installing the final release by Aaron Stebner.

As per Aaron’s recommendation I removed all references to the Microsoft.Xna.Framework.Content.Pipeline assemblies and added them again. It worked.

The assemblies are in the following folder: C:\Program Files\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\

The offending assemblies in my project were:

Microsoft.Xna.Framework.Content.Pipeline.AudioImporters
Microsoft.Xna.Framework.Content.Pipeline.EffectImporters
Microsoft.Xna.Framework.Content.Pipeline.FBXImporters
Microsoft.Xna.Framework.Content.Pipeline.TextureImporters
Microsoft.Xna.Framework.Content.Pipeline.VideoImporters
Microsoft.Xna.Framework.Content.Pipeline.XImporters

a

Friday, July 23, 2010

Winphone XNA deployment in Toshiba Satellite L305-S5944

Finally I think that I have the XNA game studio working in my Toshiba laptop. It did not have the 10.1 directx capability. Hence I did the following:

  1. Downloaded Intel® Graphics Driver for Windows 7* and Windows Vista* (exe) from Intel site. Ran it with lot of trepidation because I was worried the screen is going to become blank! It failed. Ran it again! It updated the driver.
  2. Compiled a Windows Phone application and it failed.
  3. Ran dxdiag which showed that I had 10.1 installed.
  4. Downloaded and installed DXSDK_June10.exe. This is not required, but I did it to get the DirectX Caps Viewer Tool mentioned in the Release notes.
  5. Ran the C:\Program Files\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\DXCapsViewer.exe and checked the results. It looked OK. I expanded the Direct3D 10.1 folder and saw entries for  D3D10_FEATURE_LEVEL_10_0 or D3D10_FEATURE_LEVEL_10_1. Direct3D_11 folder also had similar entries for D3D_FEATURE_LEVEL_10_0.
  6. Tried to install the following and it said not applicable to my system!
    1. Update for Windows Vista (KB971512)
    2. Update for Windows Vista (KB971513)
    3. Update for Windows Vista (KB971514)
    4. Update for Windows Vista (KB960362)
  7. Tried to deploy the Winphone application. Same error.
  8. Became bold and adventurous!  followed this instruction:
    1. It is possible to bypass this capabilities check in XNA Game Studio by setting the following registry setting: HKEY_LOCAL_MACHINE\Software\Microsoft\XDE XNAEnableGPU = 1 (REG_DWORD)Caution: If you override this registry key, the project will attempt to deploy but only a black screen will be displayed in the emulator if the required graphics card capabilities are not available.
  9. Voila! I was able to deploy. This is an empty application. Will check with the Hello world and update this post again!
  10. Update: Unfortunately this does not work. Posted in the Windows Phone forum.WDDM 1.1 driver, The current display adapter does not meet the emulator requirements to run XNA
  11. Will be updating laptop to windows 7. Let us see whether this solves the problem!
  12. Windows 7 resolved it!