Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Building a 3D Game with LibGDX
Building a 3D Game with LibGDX

Building a 3D Game with LibGDX: Learn how to build an exciting 3D game with LibGDX from scratch

Arrow left icon
Profile Icon Sebastián Di Giuseppe Profile Icon Andreas Krühlmann Profile Icon Elmar van Rijnswou
Arrow right icon
NZ$34.99 NZ$38.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7 (3 Ratings)
eBook Aug 2016 234 pages 1st Edition
eBook
NZ$34.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
Arrow left icon
Profile Icon Sebastián Di Giuseppe Profile Icon Andreas Krühlmann Profile Icon Elmar van Rijnswou
Arrow right icon
NZ$34.99 NZ$38.99
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7 (3 Ratings)
eBook Aug 2016 234 pages 1st Edition
eBook
NZ$34.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
eBook
NZ$34.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Building a 3D Game with LibGDX

Chapter 1. Setting Up Your Development Environment

LibGDX's development is very powerful, and that is why we will set up a nice and stable structure to work with before jumping into the code and project structure. We will use IntelliJ IDEA to do most of our development for the simply because it's productive (and of course, there are few neat tricks to combine with LibGDX), though it's very common to use Eclipse for development too. There are other ways to set up a 3D game with LibGDX, but to start off this book; we will build the game with basic assets created by code. In this chapter, we will explain how to download and set up all the required tools to get you started with setting up an environment to build 3D games with LibGDX, and to work on desktop and Android platforms. Although LibGDX also builds for HTML (WebGL) and iOS, we won't cover these builds because they do not fit with our game, but they are as easy as the following documentation guidelines on the official site (http://libgdx.badlogicgames.com/). You will learn more about this in this chapter.

Assuming you know LibGDX, you already have the Java Development Kit (JDK) installed and the Android software development kit (SDK) updated (you need API 22 with the LibGDX version [1.6.4]); otherwise, a simple Google search will do. The steps are OS-free and we will use Windows to implement them.

We will cover the following topics in this chapter:

  • Downloading and installing IntelliJ IDEA
  • Setting up the LibGDX project and importing it to IntelliJ IDEA
  • Running and debugging the game

LibGDX 3D API overview

LibGDX is a Java cross-platform game development framework that released its first version in 2009. It lets you go as low-level as you want to and gives you direct access to all kinds of areas of development. It also comes with an OpenGL ES 2.0 and 3.0 wrapper interface, which is the one that lets us perform 3D development.

3D development with LibGDX already has a nice array of games under its belt already. The following screenshot shows a very popular game called Grandpa's Table, which is available on Android, iOS, and Amazon:

LibGDX 3D API overview

The following is a screenshot of an Android game named Apparatus:

LibGDX 3D API overview

The following screenshot is of the game Ingress, which is available on Android and iOS:

LibGDX 3D API overview

These are just a few of the most popular games out there.

We will not only cover as much as we can from this 3D API—to get the most of it and show a general structure for how to keep things organized and optimal—but also the use of other LibGDX tools to get the most of the framework too.

Downloading IntelliJ IDEA Community Edition

Download the latest version of IntelliJ IDEA Community Edition for Java developers from https://www.jetbrains.com/idea/download/; it will suggest the download versions compatible with your current operating system. Select the version that best suits your operating system platform, which will either be 32-bit or 64-bit.

At the time of writing this book, IntelliJ IDEA Community Edition (14.1.4) is the latest version.

LibGDX project setup

At the time of writing this book, LibGDX was in version 1.6.4 and we will use that version. Download the setup app from http://libgdx.badlogicgames.com/download.html and open it:

LibGDX project setup

Set up your project name (ours will be called Space Gladiators) and package name (ours is com.deeep.spaceglad). Enter the game's main class name (ours is Core), set the destination path to your preferred directory, and point out the Android SDK directory location.

We will check the Desktop, Android, and iOS project, but leave out Html since we will use the Bullet physics API, which doesn't work on HTML because of the Google Web Toolkit (GWT) backend (for more information, check out http://www.badlogicgames.com/wordpress/?p=2308).

From Extensions, we'll select Bullet (Bullet physics API), Tools (Bitmap Font Generator [Hiero], 3D Particle Editor, and TexturePacker), Controllers (Controller Input API), and Ashley (Entity System API).

LibGDX comes, as you can see, with a lot of very useful tools that you should use for some time and explore them. We'll cover these selected APIs in some depth over the course of this book.

Click on Generate and wait. After it is done, open IntelliJ IDEA and click on Import Project. Go to your newly created project and look for a file called build.gradle, and IntelliJ will do everything else.

Basic use of IntelliJ IDEA with LibGDX

Running and debugging the app with IntelliJ IDEA is as simple as a click, but sometimes, we need to perform extra configurations on the IDE to avoid exceptions.

Running the Android app

Once IntelliJ is done with all the processes, the default app to run will be Android. To run it, click on the Bug or Play buttons to the right of the navigation bar:

Running the Android app

Gradle will build and the Choose Device dialog will pop up, from which you'll choose the Android device on which you'll run the app (either an emulator or a physical device), for which you just have to plug in your device.

Running the desktop app

To run the desktop app we have to change the default configuration and add the desktop launcher:

Running the desktop app

  1. Click on android and select Edit Configurations; the Run/Debug Configurations dialog should pop up.
  2. Click on the + icon at the top left of it and select Application.
  3. Name it desktop. In the Main class field, select DesktopLauncher. For Working directory, go to your Android project and double-click the assets folder.
  4. Click on the Use Classpath of module field, select desktop, and then click on the OK button at the bottom.

Now instead of android at the top, you'll see desktop. You can run or debug with the two buttons to the right of it.

Running the desktop app

Summary

In this chapter, we introduced IntelliJ IDEA and its basic use; we also explained how to download and install it, and set up LibGDX Project for 3D work. We configured our work environment and launched the Android application into an actual device and the desktop application.

In the next chapter, we'll take the plunge to it and learn about LibGDX's 3D rendering API, perspective camera, 3D workflow, and more.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Implement an exhaustive list of features that LibGDX unleashes to build your 3D game.
  • Write, test, and debug your application on your desktop and deploy them on multiple platforms.
  • Gain a clear understanding of the physics behind LibGDX and libraries like OpenGL and WebGL that make up LibGDX.

Description

LibGDX is a hugely popular open source, cross-platform, Java-based game development framework built for the demands of cross-platform game development. This book will teach readers how the LibGDX framework uses its 3D rendering API with the OpenGL wrapper, in combination with Bullet Physics, 3D Particles, and Shaders to develop and deploy a game application to different platforms You will start off with the basic Intellij environment, workflow and set up a LibGDX project with necessary APIs for 3D development. You will then go through LibGDX’s 3D rendering API main features and talk about the camera used for 3D. Our next step is to put everything together to build a basic 3D game with Shapes, including basic gameplay mechanics and basic UI. Next you will go through modeling, rigging, and animation in Blender. We will then talk about refining mechanics, new input implementations, implementing enemy 3D models, mechanics, and gameplay balancing. The later part of this title will help you to manage secondary resources like audio, music and add 3D particles in the game to make the game more realistic. You will finally test and deploy the app on a multitude of different platforms, ready to start developing your own titles how you want!

Who is this book for?

If you are a game developer or enthusiasts who want to build 3D games with LibGDX, then this book is for you. A basic knowledge of LibGDX and Java programming is appreciated.

What you will learn

  • Learn the potential of LibGDX in game development
  • Understand the LibGDX architecture and explore platform limitation and variations
  • Explore the various approaches for game development using LibGDX
  • Learn about the common mistakes and possible solutions of development
  • Discover the 3D workflow with Blender and how it works with LibGDX
  • Implement 3D models along with textures and animations into your games
  • Familiarize yourself with Scene2D and its potential to boost your game's design

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 29, 2016
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280290
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 29, 2016
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280290
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 210.97
Mastering LibGDX Game Development
NZ$80.99
Learning LibGDX Game Development- Second Edition
NZ$80.99
Building a 3D Game with LibGDX
NZ$48.99
Total NZ$ 210.97 Stars icon

Table of Contents

7 Chapters
1. Setting Up Your Development Environment Chevron down icon Chevron up icon
2. An Extra Dimension Chevron down icon Chevron up icon
3. Working toward a Prototype Chevron down icon Chevron up icon
4. Preparing Visuals Chevron down icon Chevron up icon
5. Starting to Look Like an Actual Game Chevron down icon Chevron up icon
6. Spicing Up the Game Chevron down icon Chevron up icon
7. Final Words Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 33.3%
1 star 33.3%
Will Iverson Feb 06, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great introduction to building games with 3d. Nice to have a single, coherent body of work describing how to get started. Particularly interesting if you have only been exposed to 2D development with libGDX.
Amazon Verified review Amazon
Amazon Customer Oct 04, 2016
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This book guides the reader through the process of building a fairly barebones 3D First Person shooter with LibGDX. I expected a lot more from this title but found myself fairly disappointed with it. The book firstly doesn't offer very much explanation of the code throughout. It more so presents it to you and says "this section does X." It is 220ish pages in length and 50 are set aside for teaching modeling, rigging, and animating in Blender. While this is a useful skill for creating the 3D artwork within the game, I feel as though more of the books content could be used to describing the functionality of the classes we used that come in LibGDX, the classes created within the example projects, and covering more advanced projects within the scope of 3D game creation. This book will get you up and running a 3D game created with LibGDX but I think more explanation throughout would have been halpful and rather than scratching the surface and spending so much on 3D asset creation instead delve into more advanced topics that could be implemented within the example project.
Amazon Verified review Amazon
Melrindeau Sep 01, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Si comme moi, vous voulez agrémenter votre site avec des jeux de votre composition, passez votre chemin : le contenu de ce bouquin ne tourne pas sous HTML. De plus, le jeu décrit est plutôt rudimentaire, et il y a pas mal de taf pour en faire autre chose qu'un machin basique.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.