xna

XNAWP7-1 A introduction


Hello ,

I’ve been thinking about what should be my next post. I’d like to talk about WCF RIA, where I have had some encounters, but it’s like too soon to write about it. On the other hand, I won a raffle and the prize was a book about Windows Phone 7 Game Development (Thanks to 101FreeTechbook and additionally there is going to be a free workshop about XNA 4.0 development at gamedevelopedia (Starting at 17-Jan-2010). Thus, I’ve decided to write a set of tutorials about XNA and WP7 for those who wants to start as well as I want. If everything goes well the series will have the following tag XNAWP7, and I’ll try to post every week about the every new topic. So, lets get started.

WP7: Windows Phone 7 Development
Windows Phone 7‘s the platform Microsoft has release to create new experiences on Windows Phone development. This new platform is based on managed code, so it’s backed on .NET Compact Framework. At this time it’s possible to write application C#. There are two main framework available for WP7 development:

XNA: Xna is Not an Acronym
XNA is a high-performance game framework. It’s over DirectX and it allows to create application taking advantage of high performance on Graphics, sounds, networking and input devices. Additionally, it can take advantage of Microsoft Live to have a customized game experience. The only drawback of this platform is that you have to create most of the components almost from scratch or get a third party framework instead.

SL: Silverlight
Silverlight is framework build on .NET and it allows to create rich interactive applications by using a declarative language (XAML). Xaml uses XML to describe how the UI is drawn, and the C# to details on logic and interaction. This framework also supports game development, this framework is fairly enough for games which does not have high-performance graphics nor have tons of elements. Event though, SL4 is already in the market and SL5 is on feature request on Jan-2011, WP7 uses an special flavor of Silverlight 3. This special flavor of SL3 has removed not related feature of mobile such as System.Window.Browse namespace, and it has added specific new namespaces in order to take advantage of the platform specific items.

Windows Phone 7 and its hardware
Microsoft has defined very specific hardware in order to be able to run properly WP7 Operative System (WP7 OS).

  • 1 Ghz CPU processor
  • WVGA (480×800) or HVGA (480,320)
  • Accelerometer sensor. This sensor helps to detect the orientation of the device, this means it allows to detect if the device is point up, down, left right, etc..
  • GPS sensor This sensor helps to detect the position around the world by detecting the latitude and longitude

Development on WP7
At lats but not least, let see what it’s required to develop on WP7 platform. The SDK is free and it can be downloaded at AppHub If you have Visual Studio already installed the WP7 tools will integrate with VS automatically. If you don’t have Visual Studio, then you can get the Visual Studio Express version for free at Visual Studio Express.
If you wan to run you application in you phone, then you’ll need to get a XNA creators account to being able to deploy your application into your phone. Additionally by acquiring an account you’ll be able to publish your game in the Market place, at this time (Jan-2011) only US and Europe are available to publish content, it’s planned to open more countries during the next years.
Don’t get worried if you don’t have a Windows Phone 7, you can start coding using the emulator which is already included with WP7 SDK, however it’s strongly recommended to use a physical WP7 to perform final tests.

An initial application
As traditional, the hello world application. So, on this little sample you it’s possible to appreciate the basis to display text and sprites.

The Main Game loop
If haven’t worked with game frameworks before, let me point out a concept known as game loop. Traditional programing models are event based, this means that a certain functionality is executed by a given trigger. But the most common video game frameworks does not work on this scheme, instead they use the game loop which is a “infinite” cycle where the application performs an update and then draw the scene. Frameworks such as XNA have methods invoked before and after the game loop is executed to perform initialization tasks, or free resources. This main loop game is implemented by the Game class of XNA. BTW there is a particularity of using XNA on WP7. Normally an application has an entry point such as the main function, and you can clearly see this function on a WP7 template project. However WP7 loads looks for instances of Game in your projects and handles them such a contract to define the execution of your application.

A sprite
The word sprite is an term which hasn’t changed from its origin. During the age of 8-bits the very first images that were drawn on a screen were called sprites. So, an sprite a two dimensional rendered figure ;-). Sprites have become a great resource because much of the game frameworks does not have a graphic interface library (GUI), thus sprites provides a good-alternative mechanism. On XNA an sprite is represented by the Texture2D class.

Sprite font
Particularly XNA has decide to draw text by using sprites. Which means that all the charset is backed by images. A font on XNA is associated to an spritefont. On XNA an sprite is represented by the SpriteFont class.

Drawing sprites
XNA defines a tool for drawing sprites (or spritefonts). XNA helps you to deal with the resources of you application by providing a content loader. This content loader is able to load the sprites, fonts, audio files that you application will consume.

some csharp code
With all the previous things said I’m attaching what it would be the first post (hopefully of many more posts).

Source code is at http://github.com/hmadrigal/xnawp7

Advertisements

XNA 4.0 beta and Swf2Xna


Hi,

I was reviewing a couple of feeds from and I found two very cool news. The first one is about the XNA 4.0 beta has been released, and it includes a new Touch API which detects gestures 😉

See some information at:

http://blogs.msdn.com/b/nicgrave/archive/2010/07/12/touch-gestures-on-windows-phone-7.aspx

The second news I’ve found it’s about an open source project called Swf2XNA (quite amazing!), so you will be able to run Swf application (aka flash app) in you Xna platform (Xbox, Windows OS, Zune or Windows Mobile 7), … quite good! isn’t ?

http://blog.debreuil.com/?p=152

That’s all for today!

Enjoy it

Windows Mobile 7 Silverlight or XNA?


Hi,

You might be wondering why there are two programing models for Window Mobile 7. Well, it’s simple it’s because each model satisfy a different need.
The following link contains a table comparing general capabilities in both frameworks (XNA and Silverlight)
http://klucher.com/blog/silverlight-and-xna-framework-game-development-and-compatibility/

Regards,
Herberth

Microsoft book for Windows Mobile 7


Hi,

Microsoft press is giving a free preview of the Microsoft Book for Windows Mobile 7. Check it at:

Article (and download)
http://blogs.msdn.com/microsoft_press/archive/2010/03/15/free-ebook-programming-windows-phone-7-series-draft-preview.aspx

Online preview
http://docs.google.com/gview?url=http://download.microsoft.com/download/7/C/8/7C820C6F-C205-4ECF-B9F3-1505DD13F9BF/ProgWinPhonePreview.pdf

Windows Mobile 7, Silverlight and XNA


Hi.

Today at Mix2010 it was revealed the oficially the Windows Mobile 7 SDK. As expected it’s possible to create applications using two of the most popular frameworks.

XNA: It’s like a nice wrapper for DirectX. So, very intensive graphics, sounds and high performace applications can be built on this framework. It’s important to mention that XNA does not include (at least in previous versions) a GUI library, so it’s not like a RAD framework.

Silverlight: Silverlight is light framework for developing rich and interfactive applications. Particularly Windows Mobile Supports a special subset of Silverlight 3 (currently the Web Version of Silverlight is reaching number 4). BTW, I mean with a special subset that this Silverlight mobile does not support all the features of SL3, and also it includes features that are special for Windows Mobile.

What next??

In the mean time I’ll  have to continue learning about python and Google application’s engine. However my friend Antonio Baker (aka arbot) has publish a small sample where he show how easy is to create applicatinos with this new SDK (using blend and the phone simulator). Check it out at http://abakerp.blogspot.com/2010/03/my-first-windows-phone-7-app.html

I’ve collected some topic from the MSDN site that I consider might be important wherther or not you have had experience with silverlight.

Getting Started Guide for Developing for Windows Phone
http://msdn.microsoft.com/en-us/library/ff402529(VS.92).aspx

Code Samples for Windows Phone
http://msdn.microsoft.com/en-us/library/ff431744(VS.92).aspx

Porting SL Apps to SL Mov Apps
http://msdn.microsoft.com/en-us/library/ff431808(VS.92).aspx

Reactive Extensions for .NET Overview for Windows Phone:
http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx

Media on Windows Phone
http://msdn.microsoft.com/en-us/library/ff426928(VS.96).aspx

Optimizing Windows Phone Emulator Performance
http://msdn.microsoft.com/en-us/library/ff402567(VS.92).aspx

How to: Handle Manipulation Events
http://msdn.microsoft.com/en-us/library/ff426933(VS.96).aspx

Saludos,
Herberth

XNA y Windows Mobile 7


Hi,

This year there is an amazing new, XNA platform will be supported included as a Framework to develop Windows Mobile Applications.

See http://www.ozymandias.com/break-with-the-past-bright-new-future-windows-phone-application-development-platform-built-on-xna-and-silverlight

And it’s even better because of it will support 3d ;-).,. Also for those who want to built enterprise applications they can use Silverlight 😉

Regards,

Herberth

XNA, MonoTouch and XNATouch


Hi,

I’m currently developing a XNA Application for the Zune HD. At this time Zune applications are developed by using XNA Framework and an special addon for Zune (it’s called Zune Extensions).  In some part of our project, we were talking about MonoDevelopment and their support to Mac Applications. Developing applications on Mac by using C# as language, but also we found  a couple of promising projects.

XNA Touch Logo

http://xnatouch.codeplex.com/

Project Description
XnaTouch is a free implementation of the XNA Framework for MonoTouch. Your goal is help the port of Zune games for the IPhone / Ipod Touch (and vice versa).

We got very excited because of we might be able to port our current project to IPhone without recoding. So, we decide to start porting one of us prototypes.  (Currenlty I selected the wrong prototype, it was good because of it was a more advance prototype, however it required some recoding anyway…).

So, we found that most of our project didn’t need to be recoded. Actually we haven’t to change the login. However because of the lack of some features in the Mono framework, we had to write a custom comprarer when we were using generic dictionaries. The other slightly change was about the assets names, that images in XNA Touch uses the file name instead of a custom name.

After that couple of minor changes, our prototype was running in IPhone. Sadly we haven’t been able to run it in the a real IPhone because of we don’t have a license of MonoTouch, however we saw our prototype running in a IPhone simulator. (Sorry if I cannot show it images yet, but I need to ask for a permission).

So, what I’ve learned it’s simple: There is a chance to write Zune HD and IPhone games almost without recoding, it will be matter about some conditionals symbols and be carefull of using XNA and .NET resources that are implemented in XNA Touch and Mono Framework.

BTW, I mentioned that are two projects, the second project is MonoXNA that is the base for XNA Touch on codeplex.

Mono Xna

http://www.monoxna.org/

MonoXNA is other port of the XNA to other platforms. Unfortunatelly we haven’t checked this one first. So, I cannot comment about this port.

Best of luck,

Herberth