Book Image

PlayStation Mobile Development Cookbook

By : Michael Fleischauer
Book Image

PlayStation Mobile Development Cookbook

By: Michael Fleischauer

Overview of this book

With the PlayStation®Mobile SDK you can create stunning games for the PlayStation®Vita and PlayStation™Certified devices (PS Certified devices). It includes everything you need to get started, including an IDE for developing your code and even an emulator to test your creations. "PlayStation®Mobile Development Cookbook"| is an exciting and practical collection of recipes that help you make the most of this exciting new platform. It provides you with everything you need to create complete 2D or 3D games and applications that fully unlock the potential of the SDK. After quickly covering the basics, you'll learn how to utilize input sources like touch, gamepads, and motion controls, and then move on to more advanced content like creating and animating 2D graphics, networking, playing sound effects and music, adding physics, and then finally jumping into the world of 3D.
Table of Contents (17 chapters)
PlayStationMobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Publishing Your Application
Index

Preface

The PlayStation Mobile SDK presents an incredible opportunity for developers to easily and affordably create and sell applications for the PlayStation Vita, as well as a number of PlayStation certified devices. This represents the first time it has been possible to write applications for a console quality portable device without first having to spend several thousands of dollars on professional development kits.

It includes all of the tools you require to successfully create a game, including a complete Integrated Development Environment (IDE), a C#/Mono based compiler and runtime, as well as the tools and utilities required to create interfaces and import game assets. The SDK is suitable for a range of developers, from hobbyists to Indie game developers as well as AAA game studios. A number of large studios, including From Software, Gameloft, and Sega, have announced their support for PlayStation Mobile. To date, a number of titles have already shipped and are available in the online store.

A tour of the PlayStation Mobile SDK

We will now take a quick tour of what is included in the SDK; if you haven’t already, download it from the PlayStation Mobile Developer Portal at https://psm.playstation.net/. The SDK includes the components that we will discuss now.

PSM Studio IDE

The PSM Studio is a complete IDE derived from the popular open source MonoDevelop project. It includes a complete code editor, project management system, and integrated debugger. It contains most features you would expect of a modern IDE such as unit testing, code completion, and refactoring.

Compiler and runtime

PlayStation Mobile is built on top of the Mono compiler and virtual machine. In addition to the PlayStation provided libraries, it includes the following .NET libraries:

  • System

  • System.Core

  • System.Runtime.Serialization

  • System.ServiceModel

  • System.ServiceModel.Web

  • System.Web.Services

  • System.Xml

  • System.Xml.Linq

In addition to those standard .NET libraries, Sony has provided the following libraries:

  • Sce.Pss.Core

  • Sce.Pss.HighLevel.GameEngine2D

  • Sce.Pss.HighLevel.Model

  • Sce.Pss.HighLevel.Physic2D

  • Sce.Pss.HighLevel.UI

You can also make use of any existing C# code that does not require native access. We will look at each of these libraries in more detail throughout the book.

UIComposer

The UIComposer enables you to visually create user interfaces. It includes a comprehensive set of widgets including buttons, text fields, progress bars, flip panels, scrolling areas, and more. Ultimately UIComposer is a code generator that will output a .cs file that makes use of partial classes to keep your application logic separate from system generated code. If you are familiar with WinForms, this will be instantly comfortable for you. It is a drag-and-drop environment, enabling you to build your user interfaces in a visual manner:

Other utilities

The SDK includes a number of utilities for importing your various assets for use in your game. There is a command line based model converter for importing your 3D model into PSM’s native MDX format. There are also tools for importing Flash animations, and graphical shaders, as well as a tool for creating on-screen controllers for Android devices. Finally, there is the PublishingUtility, which is used to prepare your application for deployment to the online store as well as for creating downloadable content. Assuming a default installation, all these tools and more are located in the folder C:\Program Files(x86)\SCE\PSM\tools. We will cover many of these tools in detail later in the book.

PlayStation Mobile certified devices

PlayStation Mobile can target the PlayStation Vita, as well as a growing number of PlayStation certified devices. Currently this includes a number of Xperia mobile phones, Sony Android tablets, and a series of HTC phones. You can see a full list of certified phones at http://www.playstation.com/psm/certified.html.

It is hard to believe the level of technology being packed into these devices. Let us now see the specifications for the PlayStation Vita and HTC One X phones, two supported devices.

PlayStation Vita specifications

The following are the system requirements for PlayStation Vita:

  • ARM A9 Quad Core processor

  • PowerVR SGX543MP4 Quad Core GPU

  • 512 MB RAM and 128 MB Video RAM

  • 5" 960x544 pixel multi-touch display

  • GPS, two cameras, two touch sensors, gyroscope, dual analog sticks

HTC Hero One X specifications

The following are the system requirements for HTC Hero One X:

  • ARM A9 Dual or Quad Core Processor (depending on region)

  • NVidia Tegra3

  • 1024 MB RAM with 16-32 GB of storage

  • 4.7" 1280 x 720 pixel multi-touch display

  • GPS, Gyroscope, G-Sensor, Proximity Sensor, two cameras

As you can see, PlayStation Mobile is running on some remarkably capable hardware. It’s hard to believe how far things have come when you consider the original PSP was running on a single CPU running at 333 MHz with only 32 MB RAM while the Gameboy DS was powered by a pair of CPUs running at 67 and 33.5 MHz, respectively, with a paltry 4 MB of RAM. This generation of handheld devices is sporting hardware comparable to what is found in the PlayStation 3 and Xbox 360!

What this book covers

Chapter 1, Getting Started, covers getting the PlayStation Mobile SDK up and running and deployed to various devices (a task of some complexity). It jumps right in, creating basic graphical applications and covers the details and restraints of working on the devices.

Chapter 2, Controlling Your PlayStation Mobile Device, covers all the various ways in which you can control PSM devices, from the traditional joystick to touch and motion controls. Additionally, since not all devices have the same capabilities, it covers creation and handling of on-screen controllers.

Chapter 3, Graphics with GameEngine 2D, covers the graphical aspects of working with GameEngine2D—a higher level 2D gaming engine similar in design to the popular Cocos2D. It covers all aspects of 2D graphics from scenes and sprites to special effects and performance optimizations with SpriteLists.

Chapter 4, Performing Actions with GameEngine 2D, covers the action side of using GameEngine2D. This involves updating game objects, scheduling events, and executing actions, both in-built actions such as MoveTo and MoveBy and also defining your own.

Chapter 5, Working with Physics2D, covers working with Physics2D, PSM SDK’s in-built 2D physics system for creating physics simulations. Physics2D is not the only option for physics, so it also looks at integrating the popular BEPU and FarSeer XNA physics engines into your PSM application.

Chapter 6, Working with GUIs, covers the UI system built into the PlayStation Mobile. This ranges from creating on-screen buttons and panels, handling clicks and hold events, to advanced touch gestures. Additionally, it covers using UIComposer to visually create and edit UIs.

Chapter 7, Into the Third Dimension, covers working in 3D, from creating a camera and using graphic primitives to using fragment and vertex shaders.

Chapter 8, Working with the Model Library, covers working with 3D objects, including creating and exporting them using a third party application, converting them using the SDK tools, and finally displaying and animating them in 3D.

Chapter 9, Finishing Touches covers the wealth of networking options available to PSM devices. Additionally, we cover the Publishing tool and preparing your application for deployment to the PlayStation Mobile App Store.

Appendix, Publishing Your Application, covers the process of compiling, signing, packaging, and deploying your finished application to the PlayStation App Store.

What you need for this book

In order to get the most out of this book, you need to have a Windows computer capable of running the PlayStation Mobile SDK. You will also need a copy of the PlayStation Suite SDK, which can be downloaded at http://psm.playstation.net/.

Most samples can be run using the included simulator, but to get the most out of the PlayStation Mobile SDK, you should have a hardware device to run on, such as a PlayStation Vita or a PlayStation certified Android device. Currently, it is free to use the simulator, but not to deploy to a device.

The PlayStation Mobile Studio has the following system requirements:

  • One of the following operating systems:

    • Microsoft® Windows® XP Service Pack 3 or later (32 bit version only)

    • Microsoft® Windows® 7 Service Pack 1 (32 bit or 64 bit version) or later

  • 3 GHz processor or greater

  • At least 2 GB of free space on your hard disk

  • At least 4 GB of RAM

  • A graphics card that supports OpenGL 3.0 or higher

  • A sound card compatible with DirectX 9.0

  • 1 or more USB 2.0 compatible ports

Who this book is for

If you’ve got some prior experience with C# and want to create awesome projects for the PlayStation®Vita and PlayStation Certified devices then this book is for you.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

A block of code is set as follows:

  Director.Initialize();
  Scene scene = new Scene();
  scene.Camera.SetViewFromViewport();

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/4186OT_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.