Gideros Mobile Game Development - Arturs Sosins - E-Book

Gideros Mobile Game Development E-Book

Arturs Sosins

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Have you ever had an interesting idea for a mobile game? Have you ever wanted to jump on the mobile app bandwagon? Developing a mobile game has never been so fun and easy, and with the vast amount of smartphone users, it may also become a profitable thing to do. Gideros is a Lua-based framework that facilitates effortless native iOS and Android application development along with hardware acceleration. Gideros also comes with a built-in box2D physics engine and extended memory management features to make mobile game development a breeze.

Gideros Mobile Game Development shows you how to develop an original and exciting game in Gideros, helping you create your very first project and guiding you through the configuration of settings and assets to help you target devices with different resolutions.

This book teaches you everything you need to know about Gideros, from installing Gideros on your operating system to creating and efficiently managing your Gideros projects and creating your very first game, all with the help of well explained examples.

You will learn how to quickly create game prototypes in Gideros, how to test and set up projects to automatically target devices with different resolutions, and how to polish your prototype with animations, sounds, tweens, and even physics to create your very first cross-platform game.

By the end of this book, you will have learned everything you need to create visually stunning physics and exciting cross-platform games using Gideros.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 196

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Gideros Mobile Game Development
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Setting Up the Environment
About Gideros
Installing Gideros
Requirements
Installing Gideros on Windows
Installing Gideros on Mac OS X
Installing Gideros on Linux
Creating your first project
Trying out Gideros Studio
Using the Gideros desktop player
Displaying graphical objects in Gideros Player
Displaying text
Displaying images
Drawing shapes
Using the Sprite class for groups and layers
Managing project settings
Automatic scaling
Automatic image resolution
Input settings
iOS-specific settings
Installing the device player
Installing the Android player
Installing the iOS player
Running the project on a device player
Exporting Gideros project
Summary
2. Managing Scenes and Gideros OOP
Setting up our project
Handling scaled graphics with AutoScaling
Handling whitespaces
Ignoring automatic scaling for positioning
Creating scenes
Gideros OOP
Creating our first class
Gideros scene manager
Creating a global configuration file
Creating the start scene
Creating the about scene
Creating the options scene
Creating the settings class
Summary
3. Implementing Game Logic
Implementing the main game scene
Using texture packs
Packing our textures
Using texture packs inside project
Using physics in Gideros
Creating physical bodies
Running the world
Setting up world boundaries
Interaction with physical bodies
Handling Box2D collisions
Managing packs and levels
Defining packs
Creating LevelSelectScene
Generating a grid of levels
Switching between packs
Creating the GameManager class
Implementing unlocked levels logic
Reading level definitions
Completing the level
Summary
4. Polishing the Game
Adding sounds
Adding background music
Adding sound effects
Adding high scores
Retrieving high scores
Updating high score on the screen
Creating animated game elements
Frame animations using MovieClip
Tweening elements with GTween
Improving gameplay
Changing level packs by using the swipe gesture
Starting with MouseDown
Continue with MouseMove
Ending with MouseUp
Adding event listeners
Modifying code for selecting levels
Implementing Mashballs magnet
Summary
Index

Gideros Mobile Game Development

Gideros Mobile Game Development

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2013

Production Reference: 1061113

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-84969-670-8

www.packtpub.com

Cover Image by Arturs Sosins (<[email protected]>)

Credits

Author

Arturs Sosins

Reviewers

John Andria

Anthony Ball

Acquisition Editors

Usha Iyer

Ashwin Nair

Commissioning Editor

Neil Alexander

Technical Editors

Tanvi Bhatt

Nikhil Potdukhe

Copy Editors

Alisha Aranha

Roshni Banerjee

Sayanee Mukherjee

Laxmi Subramanian

Project Coordinators

Aboli Ambardekar

Romal Karani

Proofreader

Lesley Harrison

Indexer

Mehreen Deshmukh

Production Coordinator

Alwin Roy

Cover Work

Alwin Roy

Foreword

Your 5-year old kid is solving puzzles and your 80-year old grandparent is playing Sudoku on a tablet. We would not have seen this 10 years ago; a lot has changed in a good way. Now we are in need of good content for our tablets and smart phones, such as games, educational applications and entertainment apps. This has also changed the life of independent developers.

The App Store, introduced by Apple, has created new opportunities for independent developers to develop their applications and sell them to users directly via the App Store. Now, Android phones and tablets are also big competition and there are many Android Markets available. Both are important targets. Many games and apps are planned to work on as many devices and operating systems as possible from the start.

We remember our excitement when we first came up with the idea: creating the best cross-platform tool to give the developer the joy of programming and giving them the way out of the native platforms. Gideros lets you function across platforms so that the development time is reduced, the overall code quality is improved, and support costs are reduced. What is more important is that Gideros reduces the entry barrier to big companies in the app market for the hobbyist.

This book is designed as a first step to help you start creating games with Gideros. Thanks to Arturs, the book takes your hand and guides you step-by-step into the art and technique of creating a beautiful game. You will find the development tips and tricks handy.

There are so many games yet to be created. I want to borrow the quote of the great Turkish poet Nazım Hikmet. He said, "The most beautiful days we haven't seen yet". I want to say: the best games aren't written yet. I hope many people decide to cross that bridge and start coding and creating...

Cheers!

Deniz Asli Soykurum Çetin,

CEO, Gideros Mobile

About the Author

Arturs Sosins is a developer living with his wife Anna and son Tomass. He has a Master's degree in Computer Science and even though he is working as a developer full time, he still loves coding and shares his knowledge with others in his spare time.

In his last years at the university, he started chasing the dream of creating his own mobile games for fun and personal satisfaction in his spare time. After trying out lots of different cross-platform frameworks for mobile game development, he found Gideros SDK in January 2012 and liked it so much that he decided to stick with it when developing his games.

In the summer of 2012, he founded a group of like-minded developers/designers who go under the indie label Jenots.com (http://jenots.com/). They released Mashballs (http://jenots.com/mashballs), their first game, in September 2012 and are currently working on a couple of bigger game projects.

As there was a lack of learning materials and tutorials for Gideros and writing was one of the his favorite hobbies, he started creating different tutorials on how to accomplish simple things in Gideros. This led him to create his new blog http://appcodingeasy.com. Due to popularity of his tutorials and the support he provided on the Gideros community forum, he became the most active community member.

In February 2013, the Gideros team offered him the position in the Gideros developers' team, where he has been working since then, while continuing to work on games in his spare time.

I would like to thank my family, my wife Anna and my son Tomass, for helping me by giving me the time to work on this book. I would also like to thank Atilim and Deniz Cetins for giving me the great opportunity to work with them and get all the inside information on Gideros and the awesomely supportive Gideros community.

About the Reviewers

John Andria is an author, designer, and entrepreneur.

He writes about lifestyle design, personal development, and career building. In his eyes app development is just one piece of a bigger picture. You can find his artworks and app development writings at http://thewindforest.com.

His life projects involve psychology, persuasion, and behavioral change researches. He currently helps social gaming companies to enter the Japanese market—and he understands what drives and engages the people there. His works, writings and children's books, have been translated and featured all over the world.

As a storyteller, he saw an opportunity in the mobile devices revolution and decided to experiment with this media as an indie developer first; but he is now getting even more involved as a publisher.

You can check the progress on the apps he is publishing at http://thewindforest.com.

I would like to thank all the people who are changing the world one step at a time, those who build and ship, and those who share their knowledge.

Anthony Ball describes himself as a coder. He has worked in the computer industry since the 1980s. During this time he has witten games published by Capcom, Rare/Zippo Games, US Gold, Tiertex, MB Games, and Psygnosis.

He reverse engineered both the Sony PSX and the Sega Dreamcast, creating various Arcade emulators, programming systems, and development kits for them.

He created ReportComplete, the market leading end-of-term school reports system, used by around 1,400 schools and 12,000 teachers.

With the advent of Gideros, he returned to developing video games to create Bacteria™ Arcade Edition—his first game in over twenty years. It's available on iOS, Android, and Ouya.

On reading Gideros Mobile Game Development. Anthony said, "Nothing like this book or development kit was available when I started writing video games, I wish it had been though! It takes you from installing Gideros to coding a complete game that is actually commercially available. Recommended!"

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.packtpub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packtpub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.packtpub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.packtpub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

With the popularity of mobile app/game markets, there are also a lot of new development tools, especially cross-platform ones, that allow you to re-use the same code on multiple platforms. Gideros is a great example of such a tool.

Based on the Lua language, Gideros provides an easy way to create 2D games for both iOS and Android. With the one click on device testing and completely free of charge development, it should be one of the first choices to try out for all mobile developers.

This book provides an easy way to start developing with Gideros, explaining all its basics and how you can apply them in creating your own cross-platform game.

What this book covers

Chapter 1, Setting Up the Environment, provides information on how to prepare everything to start developing using Gideros.

Chapter 2, Managing Scenes and Gideros OOP, provides an introduction to Gideros OOP and scene management using your own classes.

Chapter 3, Implementing Game Logic, describes the main game implementation, from the game elements to level and progression logic.

Chapter 4, Polishing the Game, helps you spice up your game to make it more appealing and alive by learning different Gideros features.

What you need for this book

You will need to download and install Gideros SDK, which supports Windows, Mac OS X, and Linux (through WINE) operating systems. Installation and setup is covered in the first chapter.

Additionally, you will need some external Lua libraries for Gideros, which you will be able to obtain easily from links provided in relevant chapters.

Who this book is for

This book is for developers who are new to mobile game development or who have tried the native development of mobile games and were not satisfied with the complexity, speed, or huge fragmentation of supported platforms and devices.

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 <[email protected]>, 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/submit-errata, selecting your book, clicking on the erratasubmissionform 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 <[email protected]> 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 <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Setting Up the Environment

The first thing we will do before building our application using Gideros is, setting up the environment and trying it out. We will need to download the latest version of Gideros designed specifically for your operating system, install it, create a project with some test code, and run it on both a computer and your mobile device.

As Gideros operates separately from Android or iOS SDKs and does not need them (context: Android or iOS SDKs) for testing or exporting apps, it is assumed that the user already has those SDKs installed; thus, it will not be covered in this chapter.

This chapter will guide you step by step on how to install Gideros on your operating system and prepare everything so you will be ready to develop your mobile game. This chapter will also introduce you to some of the basics of using Gideros Studio, managing your project, and running simple code.

Note

Here is a list of links that might help you resolve any problems you might encounter with Gideros:

Gideros Developer Guide: http://giderosmobile.com/guideGideros API Reference: http://docs.giderosmobile.com/reference/Gideros Documentation: http://docs.giderosmobile.com/Gideros Developer Wiki: http://www.giderosmobile.com/DevCenter/Gideros Knowledgebase (FAQ): http://members.giderosmobile.com/knowledgebase.phpGideros Community Forum: http://giderosmobile.com/forum/

The following topics will be covered in this chapter:

Explaining what is Gideros and why you should use itInstalling Gideros on Windows/Mac OS X/LinuxInstalling Gideros Player for on-device testing (Android, iOS)Creating a new project and running it on both, the desktop and deviceProviding the basics of coding in GiderosManaging the project filesManaging the project settingsExporting a Gideros project to Android or Xcode projects

About Gideros

Gideros is a set of software packages created and managed by a company named Gideros Mobile. It provides developers with the ability to create 2D games for multiple platforms by reusing the same code. Games created with Gideros run as native applications, thus having all the benefits of high performance and the utilization of the hardware power of a mobile device.

Gideros uses Lua as its programming language, which is a lightweight scripting language with an easy learning curve and it is quite popular in the context of game development.

A few of the greatest Gideros features are as follows:

Its rapid prototyping and fast development time by providing a single-click on-device testing that enables you to compile and run your game from your computer to device in an instantA clean object-oriented approach that enables you to write clean and reusable codeAdditionally, Gideros is not limited to its provided API and can be extended to offer virtually any native platform features through its plugin systemYou can use all of these to create and even publish your game for free, if you don't mind a small Gideros splash screen being shown before your game starts

Installing Gideros

Currently, Gideros has no registration requirements for downloading its SDK, so you can easily navigate to their download page (http://giderosmobile.com/download) and download the version that is suitable for your operating system. As Gideros can be used on Linux only using the WINE emulator, it means that even for Linux you have to download the Windows version of Gideros.

So, to sum it up:

Download the Windows version for Windows and Linux OSDownload the Mac version for OS X

Gideros consists of multiple programs providing you with a basic package needed to develop your own mobile games.

This software package includes the following features:

Gideros Studio: It is a lightweight IDE to manage Gideros projectsGideros Player: It is a fast and lightweight desktop; iOS and Android players can run their apps with one click when testingGideros Texture Packer: It is used to pack multiple textures in one texture for faster texture renderingGideros Font Creator: It is used to create Bitmap fonts from different font formats for faster font renderingGideros License Manager: It is used to license your downloaded copy of Gideros before exporting a project (required even for free accounts)An offline copy of the Gideros documentation and Reference API to get you started

Requirements

The minimum system requirements to run Gideros are as follows:

1 GHz processor1 GB RAM210 MB disk space for MS Windows340 MB disk space for Mac OS X64-bit Snow Leopard version or later for Mac OS X

Gideros does not require the Android or iOS SDK's to develop, run, and export your app projects, thus you could build your app on Windows for both iOS and Android platforms. But you will require those SDKs after exporting, when you will want to build and submit your apps to the proper market.

Although installing and setting up those SDKs is not part of this chapter, let's examine what you need for each platform to build an exported project and submit them to the markets.

To build your app for an iOS platform you will need the following:

iOS SDKXcodeApple Developer License

To build your app for the Android platform you will need the following:

Java JDK compatible with AndroidAndroid SDK 2.2 or higherAndroid compatible IDE (as Eclipse + ADT or Android Studio)

Installing Gideros on Windows

To install Gideros on your Windows operating system, download the Windows version of Gideros from http://giderosmobile.com/download. Then double-click on the downloaded .exe file to launch the installation wizard.

The first dialog will allow you to select the components we are going to install. You can leave all the components as selected by default and proceed by clicking on the Next button.

The next dialog will allow you to choose the directory where you want to install Gideros. You may provide any directory you want by clicking on the Browse button and navigating to your desired directory, or leave the default value and proceed by clicking on the Install button.

After that, the Gideros installation will start copying all the needed files and you will see the progress bar filling. When it completes, there will be a Completed message displayed and you may click on the Close button to finish the installation.

After that, you may launch Gideros Studio from your provided install location or from the Start menu, if you had chosen the default option to create shortcut there.

Installing Gideros on Mac OS X

To install Gideros on your Mac OS X, download the Mac version of Gideros from http://giderosmobile.com/download. Then double-click on the downloaded .dmg file to mount it.

After that, all you have to do is to drag-and-drop the Gideros folder into your Applications directory. It will create a Gideros folder inside your Applications folder, where you will be able to access all Gideros-related files and programs.

Installing Gideros on Linux

There is no Linux-specific version of Gideros, but it is possible to use a WINE emulator to run the Windows version of Gideros on Linux. If you don't have WINE already, you can install it using the apt-get install wine command or if you are using the Software Center, you can simply do the following:

Open Software CenterType wineInstall WINE

After that, you can download the Windows version of Gideros from http://giderosmobile.com/download.

Then, in the command line, navigate to the folder where you downloaded Windows installer and type wine installer_name.exe:

wine gideros_2013.06.1.exe

Then, to launch a specific Gideros application, for example, Gideros Studio, you need to navigate to the directory where Gideros was installed (typically, /home/USER/.wine/drive_c/Program Files/Gideros/) and type the following command:

wine GiderosStudio.exe