Book Image

Learning ShiVa3D Game Development

By : Wade Tracy
Book Image

Learning ShiVa3D Game Development

By: Wade Tracy

Overview of this book

<p>Mobile games have been the recent craze and with so many ways to monetize the popularity of these games, it is no wonder that game developers are excited to get into the market. However, the mobile platforms that are available and their popularity constantly change meaning that developers have to be able to react quickly to the market. ShiVa3D gives developers the power to quickly develop the game once, but deploy to almost every popular mobile platform, which enables them to have greater distribution and a greater opportunity to sell games.<br /><br />"Learning ShiVa3D Game Development" is a simple, hands-on guide to the key features of the ShiVa3D game engine that will enable you to get up and running with your mobile game ideas. Learning ShiVa3D Game Development will make it possible to easily develop your game once, but publish it to most of the popular mobile platforms.<br /><br />This book specifically targets the key features of ShiVa3D that will enable you to create games quickly. It will take you through designing game components in the editor and provide detailed explanations for every line of scripting used.<br /><br />You&rsquo;ll look at how the modular nature of the editor allows you to do everything from scripting, to complex physics interactions, to special effects with only a few adjustments to pre-configured settings. We will see how to deal with input from the keyboard, mouse, or touchscreen as well as how to add sound effects and music to a game. You will get to actually play your game as you learn to deploy a game to an Android phone. If you are looking for a way to make your game ideas a reality, then this is the book for you.<br /><br />By the end of this book, you would have learnt everything you need to know to create your own mobile game that can then be deployed just about anywhere.</p>
Table of Contents (16 chapters)

Preface

There can be no argument that mobile games and mobile game platforms have proliferated within the last five years. As computing devices become smaller and more powerful, the trend will likely continue; in fact, some claim that gamers will soon give up their consoles in favor of phones and other mobile devices. However, targeting mobile devices is no easy task, especially for indie developers and hobbyists. Each platform has its own development environment and APIs, not to mention the differences in hardware within a given platform. Fortunately, solutions exist, such as ShiVa3D, that allow you to leverage your work on multiple platforms.

Why ShiVa3D?

There are many game creation solutions that are available as easily as plugging in a few terms in your favorite search engine. The problem can be that there are too many options and it is difficult to determine which game engine to use. Some focus on creating games as simply as possible, while others have high-end features required by AAA studios. Costs also vary from free to thousands of dollars and a cut of your game sales. Even software that is free often restricts your deployment options or feature set. A single game engine cannot solve all the world's gaming problems, but ShiVa3D does a great job of balancing cost, features, and complexity while still being able to be deployed to a huge number of devices.

Cost

ShiVa3D makes it affordable for indie game developers and hobbyists by making the ShiVa Editor and Authoring Tool completely free. This means that you have access to all of the features you would need to create a great, professional game. Ah, but you say there must be a catch! Well, yes, there is a catch. The free edition is called ShiVa Editor Web and although you can deploy your game to all of the available platforms, all but the web browser deployment are for testing purposes only and will be watermarked. Still, you have the ability to completely develop your game for free and when you are absolutely sure that ShiVa3D will work for you and you are ready to publish your game, you simply purchase a basic license.

Features

ShiVa3D splits its feature set into basic and advanced depending on the license that you are using. The basic features are available in all licenses and form the bulk of the functionality of ShiVa3D. We will be dealing strictly with the basic feature set in this book. The advanced features provide enhanced asset management, SVN integration, and other features that are helpful for large studios and those looking to optimize performance.

Basic rendering features include the following:

  • Per pixel lighting

  • Normal mapping

  • Render to texture

  • Terrain

  • Vegetation

  • Particle effects

  • Motion trails

Basic environment features include:

  • Physics engine

  • Lua and C++ scripting

  • Sound effects

  • Multiple input methods such as touch and accelerometer

There are also various post rendering features such as bloom and depth of field. Many of the features such as particle effects, motion trails, and terrain have modules directly in the editor for creating and customizing these assets.

Complexity

Many of the parameters and settings within ShiVa3D are available through the GUI and game assets can be configured graphically. Once you learn the basics of getting assets into the game and setting basic behaviors, you can make surprisingly full-featured games with minimal "programming" effort. With ShiVa3D, you can start very simple and make a game with very little programming knowledge, but at the same time, ShiVa3D has enough depth to allow you to make AAA quality games as you learn to use all of the capabilities of the software. As you gain more experience you can add greater complexity in the form of complicated scripting and states. You can even write C++ extensions to add new capabilities.

Supported platforms

ShiVa3D allows you to easily make games, but is making games enough these days? Markets are becoming increasingly crowded and it is harder to gain the recognition needed to actually sell games. One way to overcome this is by taking advantage of every opportunity to market your game. Word of mouth is still the best way to get your game noticed and so it is critical that your game is in as many places as possible. Have you ever had the experience of someone telling you about a really great game but there is no version for your phone or computer? Every time someone is unable to get access to your game, you are not only losing their sale, but all those sales that may have resulted if they had recommended it to others.

ShiVa3D gives you the ability to create your game once and then release it on every major platform on the market. With ShiVa3D, you can publish games to Android, iPhone, Blackberry, web browsers, PCs, Macs, Linux, and you can also publish to Marmalade, which gives you access to all of the platforms that Marmalade can publish to, such as Bada and Symbian. Now when friends recommend your game, chances are their friends will also be able to play your game regardless of their platform.

Note

Marmalade is a separate company that licenses their SDK for developing mobile applications on multiple platforms. Check out their site at http://www.madewithmarmalade.com for more information.

Licensing

Stonetrip offers licensing for every price range. The strength of their licensing is that each version provides access to a majority of the features available in ShiVa3D and will allow you to deploy at least a test version of your game to any of the supported platforms.

Shiva Editor Web is a free license that allows you create full games using all of the standard features in ShiVa3D. You can deploy full versions of your game to most web browsers, but deploying to other platforms is for testing purposes only and will have watermarks. Support is limited to the forums. The Web edition is a perfect way to develop a game without spending a dime. When the game is done and ready to be published, simply purchase Shiva Editor Basic and you can publish on any of the supported platforms.

Shiva Editor Basic also allows you to make games using all the standard ShiVa3D features, but you can deploy to any of the supported platforms at any time without a watermark. You also get access to e-mail support in addition to the forums.

Shiva Editor Advanced gives you access to all of the standard features, but adds options for more advanced texture capabilities, SVN integration, optimization features, and more. Advanced licenses also have access to phone support.

Shiva Editor Educational is the same as the Advanced license, but at a lower price and commercial production is not allowed.

Note

Everything we cover in this book is available in the Shiva Editor Web license.

What this book covers

You're here to learn how to make games using ShiVa3D, so we should probably make a game together. This book is structured to take you through creating a basic game. The first time you read through, you may want to progress sequentially and actually enter the code as we cover it. However, please experiment as much as you can! We can only cover so much in this book, but we can teach you the fundamentals so that you can build on those as you learn.

Chapter 1, Getting Started, shows you how to install the tools that you will need and get basic objects into the game. We'll also briefly touch on a few topics, such as input and lighting that will be covered later, so that we can get a very rudimentary game up and running in the first chapter!

Chapter 2, Editor Fundamentals, goes over the modules found in the ShiVa3D editor and how to customize the editor to help maximize your efficiency. We will add materials to the game objects and play some sounds.

Chapter 3, Behaviors and Scripting, demonstrates using AI modules to control the behavior of the game and how the game objects interact. We'll have a brief overview of the Lua style scripting and add some interaction to our game such as enemies and obstacles.

Chapter 4, Physics and the Environment, introduces the ShiVa3D physics engine that is as easy to use as simply setting objects as dynamic and letting them interact. We'll look at the basic settings that can be adjusted and also find out what sensors do. Armed with this knowledge, we will set up collisions and other environmental effects.

Chapter 5, Lighting and Special Effects, covers lighting and special effects. We'll see what lighting is available and light the game. We'll also add some special effects such as polytrails, particle effects, and explosions!

Chapter 6, Menus and Overlays, shows us the 2D aspects in ShiVa3D in the form of HUD objects. We'll use these to add menus and display things such as the score.

Chapter 7, Deploying to a Device, wraps things up by teaching you how to deploy a game to a device. One of the strengths of ShiVa3D is the ability to deploy games to multiple devices. We will set up our environment to deploy to Android and then deploy our game.

Appendix A, Editor Hotkeys, lists the hotkeys that are available to help you work a bit quicker.

Appendix B, Additional Resources, lists websites that provide game assets, learning resources, and software that can be helpful as you develop games.

What you need for this book

To run the examples in this book, the following software will be required:

  • Windows XP, Vista or 7

  • ShiVa3D Web Edition or greater

  • ShiVa3D Authoring Tool—included in Web Edition

In addition, the following software is required to deploy the example content to an Android device:

Android SDK:

  • Android SDK version 11 or greater

Android NDK:

  • Android NDK Revision 8 or greater

Cygwin:

  • Cygwin 1.7.16-1 or greater

Ant:

  • Apache Ant 1.8.4

Java SE Development Kit:

  • Java SE 6 Update 20 or greater JDK

Eclipse:

  • Eclipse Classic 3.5 or greater

Who this book is for

If you are reading this book, I hope there is at least one prerequisite that applies to you—you are interested in creating video games. Are there things that will make it easier for you? Sure. It would be nice if you have previous experience making video games, or experience with Lua, or even have played around with ShiVa3D before, but none of that is absolutely essential. Although this book will be fast paced, none of the material is very difficult and there is always help available on the Stonetrip forums if you don't quite understand how something works.

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.

Code words in text are shown as follows: "We declare variables using the local keyword."

A block of code is set as follows:

local nX = 0
local nY, nZ = 0, 0
local hObject = application.getCurrentUserSceneTaggedObject ( "Ship" )

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 via 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.

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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

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.