Book Image

Windows Phone 8 Game Development

By : Marcin Jamro
Book Image

Windows Phone 8 Game Development

By: Marcin Jamro

Overview of this book

<p>Currently almost everyone has a mobile phone that is used not only for calling, texting, and browsing the Internet, but also as an entertainment and social platform. Developers can create advanced 3D games with outstanding functionality that allow the player to enjoy the game directly on the mobile phone and cooperate with other players via the Internet!<br /><br />Windows Phone 8 Game Development is a practical, hands-on guide that will show you how to create a 3D game for the Windows Phone 8 platform. From setting up the environment to publishing your game, you will first learn how to implement 3D and 2D graphics with Direct3D, XAML, C++, and C#. We will then look at the game logic, steering with sensors, detecting collisions, as well as using maps, geolocation, augmented reality, social networks, and web services to share data between players. Featuring many code examples, images, and diagrams you should find the content both engaging and easy to understand.</p>
Table of Contents (22 chapters)
Windows Phone 8 Game Development
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Languages


A programming language has a very important role in the development process and is used to create the code that specifies how the application is executed. As you know, there are a lot of programming languages, however, in case of this book, C# and C++ are used. What is more, you will learn XAML markup language that performs other roles than programming languages do, because it is used to describe the user interface in an easy way.

C#

The first programming language, which is often used in managed development approach, is named C# (pronounced c sharp, also referred as Visual C#). It was created by Microsoft and presents an object-oriented approach of programming. C# uses strong typing and its syntax is similar to C++ and Java. The language can be used for implementation of various projects, not only for mobile, but also for desktop, web, and even for distributed solutions. For this reason, you can use the same language to perform various tasks and create different kinds of applications.

You can use several features of this language, including classes, inheritance, interfaces, events, delegates, generic types, as well as a set of concepts known from functional programming, such as lambda expressions. It is worth mentioning that data types in C# language can be divided into two groups: value and reference types.

C# is a managed language compiled to CIL (Common Intermediate Language) that is later executed by the runtime environment. Therefore, it uses some features that make development easier, including a garbage collector, eliminating a necessity of preparing parts of code for allocating and releasing memory. The C# language, together with the .NET Framework platform (described later), also introduces many security mechanisms, such as checking types and CAS (Code Access Security). The language supports exception handling and can benefit from many classes and interfaces available in various parts of the .NET Framework, as well as created by developers.

What is more, C# supports calling the native code, which can be created in C or C++ and is available in the form of a DLL (Dynamic Link Library) file. In the newest version of the language, some additional features are added, for example, regarding asynchronous methods.

There are a few versions of C# language and the current one is C# 5.0. It cooperates with the .NET Framework platform in Version 4.5 and Microsoft Visual Studio 2012 IDE.

C++

Projects for the Windows Phone 8 platform may be created not only in C# language, but also in the native approach using the C++ language (also referred as Visual C++) together with concepts from the modern C++. Thus, you can create less code in comparison with the traditional C++, which is even easier to understand and modify, as well as achieve better performance than with the managed development approach. The last factor may be especially important in case of complex 3D games, where you often need to achieve possibly the highest performance.

With the modern C++ language, you can also use smart pointers, instead of raw ones. It is a really useful solution, because it helps to eliminate problems with memory and resources leaks, as well as provides exceptions safety. What is more, many STL (Standard C++ Library) structures and algorithms are available for developers, as well as some additional functions such as for_each and sort.

According to information at http://msdn.microsoft.com/library/60k1461a, the Visual C++ language supports a set of libraries, such as C Runtime Library (CRT), Standard C++ Library (STL), Active Template Library (ATL), Microsoft Foundation Class Library (MFC Library), Parallel Patterns Library (PPL), C++ Accelerated Massive Parallelism (C++ AMP), and Windows Runtime C++ Template Library (WRL).

It is worth mentioning that, in the book, you will also use the Visual C++ component extensions (referred as C++/CX) to create applications for the Windows Phone Runtime in a significantly easier way.

XAML

The last language presented in this appendix differs significantly from others. It is named XAML (Extensible Application Markup Language) and is used to design user interfaces (UI) in a declarative way. This language is common while developing user interfaces for desktop and mobile applications, which run on Windows 8 and Windows Phone 8 operating systems. It is based on XML and provides developers with an easy and fast way of describing various UI elements, including buttons, textboxes, and also more complex ones, like maps. The available elements depend on the technology and additional libraries. Apart from placing some common elements in windows or pages, you can create graphics (both 2D and 3D) and animations. You can use many controls available out-of-box, as well as create your own and reuse them later.

The XAML has a lot of interesting features, such as data binding, styles, and data templates, which are presented and explained in this book. They can simplify your work, shorten time required for development, as well as ensure that the code has better quality and the project is easier to maintain.