LibGDX Game Development Essentials. Make the most of game development features powered by LibGDX and create a side-scrolling PDF下载地址( MB ). Make the most of game development features powered by LibGDX and create a side-scrolling action game, Thrust Copter. stemkoski libgdx game development essentials - dependent upon how you're mastering libgdx game development pdf - getfreetutorial - download your free.
|Language:||English, Spanish, Arabic|
|Genre:||Fiction & Literature|
|ePub File Size:||25.49 MB|
|PDF File Size:||19.16 MB|
|Distribution:||Free* [*Sign up for free]|
Game Designing · Game Development. Free Books Download PDF / Free Books Online / Free eBook Download PDF / Free eBook Download PDF. Beginning Java Game Development with LibGDX Beginner's Guide, R Graph Essentials, R Object-oriented Programming, Mastering Scientific. libgdx game development essentials libgdx game development essentials pdf. eBook Details: Paperback: pages Publisher: WOW! eBook; 3rd edition.
Then, we will take a first look at the basics of what a game needs to come alive. Chapter 2, Cross-platform Development — Build Once, Deploy Anywhere, explains the supported target platforms and how to deploy and run our application on each platform using a demo application. Then, the application cycle will be introduced, and we will take a look at how to debug and manipulate our code at runtime. Chapter 3, Configuring the Game, takes us from our demo application to a real game by setting up a new project called Canyon Bunny. We will work on this project throughout the rest of the book and extend it from chapter to chapter with new features. Chapter 4, Gathering Resources, describes how to gather all the resources assets needed for Canyon Bunny, including graphics, audio files, level data, and so on. We will also find out how to load, track, and organize assets efficiently.
Chapter 12, Animations, explains how to polish the game by adding animations. In this chapter, we will cover two different approaches to animate the game menu and the game world.
Finally, we will implement a state machine to allow event-based animations for the player character. You will learn how to use the 3D API to create basic models such as sphere, cube, cylinder, and so on, and load models exported from modeling software such as Blender.
You will also learn about ray picking, an important concept used to develop first person shooter games. Chapter 14, Bullet Physics, will walk you through the basics of 3D physics using Bullet. Finally, we will create a simple application to simulate physics using Bullet. What you need for this book LibGDX is a cross-platform game development framework. Download the version 0.
To develop games for the Android platform, you will need an Android device running Android 2. Who this book is for This book is written for software developers who are new to game development and to LibGDX in particular.
It is assumed that you have some experience in Java to be able to follow the discussed code in this book. 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, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The starter class for iOS application is RobovmLauncher.
LwjglApplication; import com. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "You can quickly check this by going to the Project menu. 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 feedback packtpub. 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.
The color images will help you better understand the changes in the output. 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. 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.
The required information will appear under the Errata section. 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 copyright packtpub. We appreciate your help in protecting our authors, and our ability to bring you valuable content. Questions You can contact us at questions packtpub. Actually, you have chosen just the right time to read about game development as the game industry is in a remarkable state of change.
With the advent of increasingly powerful smartphones and tablets as well as the ever-growing application stores for desktop computers and mobile platforms serving millions of users a day, it has never been easier for Independent Game Developers also known as Indies to enter the market with virtually no risks and very low budgets.
In this chapter, you will learn about what LibGDX is and the advantages that it provides when developing your own games. You will also get a brief overview of the feature set that LibGDX provides. Before you can start developing games with LibGDX, you have to install and set up your development environment accordingly.
It will feature a runnable example application for every currently supported target platform. You are going to explore what a game needs by looking at it from a technical standpoint, and why it is so important to plan a game project before the development starts.
At the end of this chapter, you will be introduced to the game project that is going to be developed and enhanced throughout this book. Diving into LibGDX LibGDX is an open source, cross-platform development framework, which is designed mainly, but not exclusively, to create games using the Java programming language.
Besides Java, LibGDX also makes heavy use of the C programming language for performance-critical tasks to incorporate other C-based libraries and to enable cross-platform capabilities. Moreover, the framework abstracts the complex nature of all its supported target platforms by combining them into one common Application Programming Interface API. One of the highlights of LibGDX is the ability to run and debug your code on the desktop as a native application. This enables you to use very comfortable functions of the Java Virtual Machine JVM , such as Code Hot Swapping, which in turn lets you immediately see the effect of your changed code at runtime.
Therefore, it will significantly reduce your time to iterate through different ideas or even to find and fix nasty bugs more quickly. Another critical point is to understand that LibGDX is a framework and not a game engine that usually comes with lots of tools, such as a full-blown level editor and a completely predefined workflow.
This might sound like a disadvantage at first, but actually it turns out to be an advantage that enables you to freely define your own workflow for each project.
However, most of the time it should be sufficient enough to stay high-level and use the already built-in functionalities of LibGDX to realize your ideas.
Matrix and vector operations are accelerated via native C code where possible. It is so awesome that other engines use it as well.
There is a great chance someone else has already asked your question and has even found a solution with the help of the community. Otherwise, do not hesitate to ask your question on the forums. Install all platforms via the SDK Manager. To install it, follow these steps: 1. You will have to accept the license agreement and choose the version that is appropriate for your platform.
For example, if you are using a bit version of Windows, choose the download labeled as Windows x Here, we are using the bit version that is labeled window-i [ 16 ] 3. To install the JDK, simply run the downloaded installer file for example, jdk-8u5-windows-i Then, keep all the features selected to be installed, and click on Next again to continue, as shown in the following screenshot: 6.
Once the installation is complete, click on the Close button to exit the installer. At the time of writing this book, the latest stable version of LibGDX is 1. It is recommended to use the same version while working with this book.
The following screenshot shows a list of all the available files: In the meantime, create a new folder inside the root folder of your C drive with the name libgdx. In case you are using an OS other than Windows, you will have to scroll down a bit further, click on Download for other platforms and choose the appropriate platform.
You will see the following screen when you try to install the Android SDK. This is because the installer cannot find the JDK although you have already installed it. You will see a folder starting with jdk. Take the full name of this folder here, it is jdk1. Now you have to set the environment variable.
Click on the Windows Start button and right-click on Computer. Then click on Properties to open the control panel system window, as shown in the following screenshot: [ 23 ] www. Click on Advanced system settings on the left-hand side of the window, as shown here: 7.
The System Properties window will appear. Click on the Environment Variables button: [ 24 ] Chapter 1 8. The Environment Variables window will appear.
Click on the New button at the top that corresponds to User variables for the username in this case is andreas , as shown here: 9. A window with the title New User Variable will appear.
Now, fill in the two text fields. Now your system is prepared for the Android SDK installer. Make sure to exit the Android SDK installer if it is still running to let the change take effect.
You will be presented with the next screen after the installer has restarted. The following screenshot will ask you to choose the users for which the Android SDK should be installed. Usually, the suggested Install for anyone using this computer selection is perfectly fine, so just click on Next to continue. Now, choose the installation location on your computer. You can safely keep the suggested location and click on Next to continue: After this, you will be asked to choose a start menu folder.
After the installation is complete, click on Next to continue: Now, choose at least Android 2. The reason why we want to use at least API level 8 is that the earlier versions before Android 2. Using a certain API level also allows you to control the range of devices that you will be able to see and install on your application via the Google Play Store.
You are almost done setting everything up. Eclipse will ask you to select a so-called workspace. This is the folder where all your projects will be saved. To proceed, confirm the dialog box by clicking on the OK button. The first time Eclipse is started with a new workspace, it will greet you with a welcome screen.
Simply click on the small cross x of the Welcome tab to close it: You should now see the standard view of Eclipse, which is also called the Java Perspective.
On the left-hand side, you can see the Package Explorer section, as shown in the following screenshot. This is where you will see and manage your different projects. This is all you need to know about Eclipse for the moment. However, be rest assured that all the steps will be discussed in detail as required to make it easy for you to follow. To install new plugins, go to the menu bar, and click on Help, and then click on Install New Software.
This will open the Install window, where you can type the special repository URLs to browse for new plugins. You have to choose the correct URL that corresponds with your Eclipse installation. At the time of writing this book, Eclipse 4. Select everything in the list that is shown in Developer Tools to add support for Android applications. Then, select everything in Google Plugin for Eclipse required to install the required Eclipse plugin.
You have to do this before you can click on Finish to continue, as shown in the following screenshot: [ 33 ] www. When downloading is finished, Eclipse will show a security warning that you are about to install unsigned content and wants to know whether it should continue or abort.
There is always a potential risk of installing malicious software. However, in this case, the download is provided by Google, a wellknown company, which is trustworthy enough. Click on the OK button to accept the warning and continue the installation, as shown in the following screenshot: After the installation is finished, a final restart of Eclipse is required.
Click on the Yes button to confirm the restart: Now, let's install the Gradle plugin for Eclipse so that we can import the project into Eclipse via Gradle. For this, let's perform the previous steps again. Go to the Install New Software option in the Help menu.
Continue as you did while installing Eclipse plugins to finish the process.
However, you can construct the project in Windows and later copy it to Mac for execution. To download and install the latest RoboVM plugin, we will perform the same steps that we did to install Eclipse plugins earlier. You have just finished the installation of everything that you will need to develop and build your own games with LibGDX.
Furthermore, the projects would also have to be configured and linked together in a certain way. This is quite a time-consuming task and more or less an error-prone process for inexperienced users. Luckily, LibGDX provides tools to generate preconfigured projects for a new application that can be directly imported into Eclipse. There are two tools to create a LibGDX project, the latest one is using Gradle, and the old project setup tool written by Aurelien Ribon. First, we will learn about the old setup tool and then about the Gradle setup tool.
Using the old setup tool The old project setup tool is an executable JAR file called gdx-setup-ui. Here, you can configure what the tool will generate. Enter demo in the Name field, which defines a common project name for your application.
Each launcher project will add its own suffix to it, such as -desktop, -android, or -html. The Package field defines the name of your Java package. This needs to be a unique identifier written in lowercase, which is usually derived from a reversed domain name.
You do not have to own a domain name nor does it have to really exist, but it helps in choosing nonconflicting namespaces for Java applications. This is especially important on Android, as identical package names for two separate applications would mean that the already installed application is going to be overwritten by the second one while trying to install it.
For this demo application, use com. The Game class field defines the name of the main class in the shared game code project. Enter MyDemo as the game class name. If there is any item listed in red, it needs to be fixed before any project can be generated. Click on the blue folder icon next to it: Step 4 Then, choose the downloaded archive file libgdx Click on the Open the generation screen button to continue: Step 6 Next, click on the Launch!
You can now go to Eclipse and start importing the generated projects into your workspace. To do this, simply navigate to the Import option in the File menu.
This is the directory where all your generated projects were created.
You need to confirm your text input by pressing the return key once. Eclipse will start to scan the directory for your projects and list them. Leave all checkboxes selected and click on the Finish button, as shown in the following screenshot: [ 42 ] Chapter 1 Step 10 Eclipse will automatically try to build compile all the four newly imported projects in your workspace and probably fail.
There are two issues that need to be resolved manually after the import. The first one is reported directly to the Console window in Eclipse. It complains about being unable to resolve the target android, as shown in the following screenshot: You have to open the project properties of the demo-android project. First, select it in the Package Explorer box on the left-hand side.
Then, go to the menu bar and navigate to Properties option in the Project menu: [ 43 ] www. If this is not the case, close the window and make sure you have selected the correct project and try again.
Next, select Android from the list on the left-hand side. You will see a list of targets that are available on your system. Select Android 2. The second issue requires you to click on the Problems tab in Eclipse. Though the steps to create a project using gdx-setup-ui might seem difficult, actually it's very easy. In our book, we will generate the project setup for our first game using this setup tool, and later in Chapter 14, Bullet Physics, we will use the Gradle-based tool to generate the project, thereby mastering the two technologies.
Using the Gradle-based setup For the first game, we will use the projects generated using the old setup tool; however, read this section and understand how it works, so that we can use it later in Chapter 14, Bullet Physics.
You can download the gdx-setup. To run the tool, double-click on gdx-setup to get the following screenshot: The Name, Package, Game Class, and Destination fields are the same that we learned for the old project setup tool. The Android SDK field defines the path to where you have installed your android sdk. Click on the Browse button and set it to the android sdk folder.
We will now select Release 1. Next under the Sub Projects tab, you can select the hardware platforms that you want to support. Here, we select all four, namely, Desktop, Android, Ios, and Html. Some might not work on all the platforms for which you'll get a warning. For the demo, we don't need any extensions, hence ignore this part.
Once chosen and created, you will have to add new hardware platforms or extensions manually. Now, click on the Advanced button, enable Eclipse, and then click on Save, as shown in the following screenshot: Now that we have set everything, click on Generate.
The gdx-setup option will prompt you to download and install the latest SDK platform and build tools. Just ignore this. While writing the book, the SDK platform was 19 and build tools were It will take a while to download and generate the projects. Make sure that you are connected to the Internet. His team has created more than games to date, and many of the job management games are listed at the top of leading portals worldwide.
The first book he had written, Starling Game Development Essentials, Packt Publishing, is based on another exceptional cross-platform game development framework called Starling. Juwal is a voracious reader and likes to travel. His future plans also include writing fiction. Yunkun Huang is a senior software engineer with more than 7 years of experience in Java development. His research interests include game development, swarm intelligence, automated trading, and enterprise application development.
He works for ThoughtWorks as a Java developer now. He worked in web development for 8 years and then decided to move on to game development mobile and desktop. He has learned Unreal Engine and Unity Game development and is currently working on a LibGDX-based point n click adventure game for which he is writing the story.
I would like to thank the author for this great book.