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 Android Games with Cocos2d-x
Building Android Games with Cocos2d-x

Building Android Games with Cocos2d-x: Learn to create engaging and spectacular games for Android using Cocos2d-x

eBook
Can$24.99 Can$27.99
Paperback
Can$34.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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

Shipping Address

Billing Address

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

Building Android Games with Cocos2d-x

Chapter 1. Setting Up Your Development Environment

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 for building games for the Android platform. Although there are huge similarities between the Mac OS and the Windows development environment, we will cover all the details regarding the installation in both of these operating systems.

The following topics will be covered in this chapter:

  • Cocos2d-x overview
  • Setting up Java
  • Setting up the Android SDK
  • Setting up the Android Native Development Kit (NDK)
  • Setting up Apache Ant
  • Setting up Python
  • Setting up Cocos2d-x
  • Setting up the Eclipse IDE
  • Template code walk-through

Cocos2d-x overview

Cocos2d-x is a C++ cross-platform port of the popular iOS gaming framework Cocos2d. It was first released in November 2010, and bought in 2011 by Chukong Technologies, a Beijing-based mobile gaming company. Nevertheless, it is still maintained by an active community of more than 400,000 developers worldwide, including Ricardo Quesada, the creator of the original Cocos2d iPhone engine.

This framework encapsulates all the game details, such as sound, music, physics, user inputs, sprites, scenes, and transitions, so the developer will only have to focus on the game logic rather than re-inventing the wheel.

Setting up Java

The Android platform technology stack is based on the Java technology; that is why the first item to be downloaded will be the Java Development Kit (JDK). Although Java JDK 8 is the latest version at the time of writing this book, it is not officially supported by all Android versions, so we will download JDK 6, all the template Java codes generated by Cocos2d-x can be successfully compiled with this version.

Note

Java Runtime Environment (JRE) is not enough for building the Android applications, since it only contains the files required for running the Java applications, but it does not contain the tools required for building the Java applications.

You can download the JDK 6 from Oracle at http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html regardless of your development environment.

If Windows is your current environment, then after installing JDK you are required to add the path of the binaries folder to the PATH environment variable. This path will look like this: C:\Program Files\Java\jdk1.6.0_45\bin.

Open a new system console and type javac –version, if Java compiler's version number is displayed, then you have successfully installed JDK in your system.

Note

JDK 7 is required for building the applications for Android 5.0 and higher. You should download this version if you are targeting the latest Android versions. But, if you want your game to be compatible with the Android versions that are older than 4.4, then you should pick JDK 6.

Setting up the Android SDK

The Android SDK contains all the required command line tools for building an Android application. It has versions for Windows, Mac, and GNU/Linux operating systems.

Android Studio is now the only officially supported IDE; nevertheless, Cocos2d-x 3.4 provides only out-of-the-box support for Eclipse, which was the former official IDE for Android development. It is no longer available for downloading, since it is not in active development any more, but you may download Eclipse manually and install the Android Development Tools (ADT) by following the steps below.

Downloading the Android SDK

You can download Android SDK from the link: http://developer.android.com/sdk. At the bottom of the page, under Other Download Options, you will find the option for downloading the SDK tools. Choose the version that matches your operating system.

At the time of writing this book, the latest version of SDK was 24.0.2.

Run the Android SDK Installer and install the Android SDK on your computer.

When the Android SDK finishes installing, it is not yet ready to build the Android apps. So, at the final screen of the installation wizard, mark the checkbox for Start SDK Manager so you can download the required components for building your games, as shown in the following screenshot:

Downloading the Android SDK

Once the Android SDK Manager starts, select Android SDK Platform-tools and Android SDK Build-tools from the Tools folders. Then select SDK Platform from your desired API level, as shown in the following screenshot:

Downloading the Android SDK

Downloading Eclipse

Download the latest version of the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads. It will suggest the download versions compatible with your current operating system, select the version that better suits your operating system platform which will either be 32-bit or 64-bit.

At the time of writing this book, Eclipse Luna (4.4.1) was the latest version.

Setting up the Eclipse ADT plugin

Open Eclipse and navigate to Help | Install new Software and add the Eclipse ADT download location, which is https://dl-ssl.google.com/android/eclipse/, as shown in the following screenshot:

Setting up the Eclipse ADT plugin

Click on OK, then select the Developer Tools checkbox, and click on Next in order to finish the ADT installation wizard.

Setting up the Android Native Development Kit

We have already downloaded the Android SDK that allows you to create Android applications using the Java Technology; nevertheless, the Cocos2d-x framework is written in C++, so you will need the Android Native Development Kit (NDK) in order to build the C++ code for the Android platform.

Note

Android's official documentation clearly states that you should use this native kit for specific circumstances, but you should not use it just because you are familiar with the C++ language, or because you want your application to perform faster. The manufacturer makes this suggestion because the Android core API is only available for Java.

Download the latest NDK revision. At the time this book was written, it was 10d. This version of NDK will allow you to build for all the Android platforms, including the latest.

You can download the latest version of the Android NDK for all the platforms from the following link:

https://developer.android.com/tools/sdk/ndk

After downloading it, run the executable file. It will decompress the Android NDK directory on the current path; you need to be aware of this path since you will need it later.

Setting up Apache Ant

Apache Ant is a build management tool widely used for automating the Java projects build process. It has been introduced in Cocos2d-x 3.0 for building the framework for the Android platform. It has made the Android build process simpler and enhanced the cross-platform build. Back in Cocos2d-x 2.x, building the Android apps within the Windows operating system required simulating the UNIX environment by using Cygwin. This required minor hacks for successfully building the code, many of them still remain undocumented on the official Cocos2d-x site.

This tool can be downloaded from the link: https://www.apache.org/dist/ant/binaries/

At the time of writing this book, version 1.9.4 was the latest. This tool is a cross-platform tool so a single download will work on any operating system that provides support for the Java technology.

In order to install this tool, just unzip the file. Remember the path since you will need it during the Cocos2d-x setup process.

Setting up Python

All the Cocos2d-x configuration files are written in Python. If you are using Mac OS or any Linux distribution, it will already be installed on your OS. So, you can skip this section.

If you are using Windows, you need to download Python 2 from the following link: https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi.

Take in to consideration that Python, as Cocos2d-x, keeps simultaneous support for versions 2 and 3. Cocos2d-x only supports Python 2. At the time of writing this book the latest version of the 2 branch was 2.7.8.

After the installer finishes with the setup, you should manually add the Python installation path to the PATH environment variable. The default installation path is C:\Python27.

Open a new system console and type python, if the Python console is shown, as seen in the following screenshot, then it means that Python has been installed correctly:

Setting up Python

Note

For setting an environment variable on Windows, click on the Start button and type: edit the system environment variables, click on it and hit the Environment Variables button, and then the environment variables configuration dialog will be displayed.

Setting up Cocos2d-x

Now that you have all the Cocos2d-x pre-requisites for building your first game for the Android platform, you are going to download the Cocos2d-x 3.4 framework and set it up with the help of the following steps:

  1. You can download the source code from http://www.cocos2d-x.org/download. Be aware that this page also has the link for downloading the Cocos2d-x branch 2, which is not covered in this book, and the manufacturer has officially announced that the new features will only be available in branch 3.
  2. After downloading the compressed Cocos2d-x source code, uncompress it to your desired location.
  3. In order to configure Cocos2d-x, open your system terminal and point to the path where you have uncompressed it, and type setup.py. It will require you to specify ANDROID_NDK_PATH, here you will specify the root directory of the NDK that you have previously uncompressed in the previous sections. Secondly, it will require you to specify ANDROID_SDK_ROOT, here you will specify the directory path from where you have chosen to install the Android SDK during the installation process. Then, it will require you to set ANT_ROOT, where you will specify the root directory of your ant installation. Finally, close the terminal, and open a new one so that the changes can take effect.

Creating your first project

Now, Cocos2d-x is set up, and it is ready for creating your first project. You can do so by typing the following command:

 cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR

This script has created an Android template code for your game that will run in all the Android devices containing the Android API 9 or higher, that is Android 2.3 (Gingerbread) and later.

Take in to consideration that the package name should contain exactly two dots, as the example shows, if it has less or more, then the project creation script will not work. The –l cpp parameter means that the new project is going to use C++ as the programming language, which is the only one that is covered in this book.

Cocos2d-x 3.x, as opposed to branch 2.x, allows you to create your project outside of the framework directory structure. Therefore, you can create your project at any location, and not just inside the projects directory, as it was in the previous versions.

It will take a while, since it will copy all the framework files to your new project's path. After it finishes, plug your Android device to your computer, then you can easily run the template HelloWorld code by typing the following command within your new project's path:

cocos run -p android

Alternatively, you could run the following command regardless of your current path on the terminal:

cocos run -p android /path/to/project

Note

For building and running Cocos2d-x 3.4 for Windows, you will need Microsoft Visual Studio 2012 or 2013.

Now, you should be able to see the Cocos2d-x logo and a text that says Hello World, as we can see in the following image:

Creating your first project

Setting up the Eclipse IDE

Cocos2d-x branch 3 has improved the Android building process significantly.

Back in branch 2, it was necessary to manually configure many environment variables within IDE, import many core projects, and handle dependencies. Even after completing all the steps, the Cygwin Windows UNIX port integration with Eclipse was never polished to work flawlessly, so minor hacks were required.

Building Cocos2d-x 3.4 within Eclipse is as simple as importing the project and clicking on the Run button. In order to achieve this, within the ADT, navigate to File | Import | General | Existing Projects into Workspace, select the path, where Cocos2d-x has created the new project from the previous sections. Then click on Finish.

Tip

Cocos2d-x Android template project is created using the API Level 10 as target platform. If you don't have this version installed on your system, you should change it by right-clicking on the project from the package explorer, click on Properties, and select your preferred installed Android API version from the Project Build Target box.

Now, right-click on the project name in the package explorer, click on run as, and finally, click on Android Application. The following pop up will be displayed, and it will require you to specify the Android device on which you want to launch the Cocos2d-x game:

Setting up the Eclipse IDE

After picking your Android device, you will see the HelloWorld game scene as it was shown when we ran the Run command in the previous section.

Template code walk-through

In this section, we will explain the main parts of the Cocos2d-x template code generated in the previous sections by the project creation script.

Java classes

We now have one Java class in our project named AppActivity that has no members and extends the Cocos2dxActivity class from the core library. We can also see that 22 Java classes from the core library have been referenced in the project. This code is aimed to make our C++ code work, and we don't have to modify it at all.

Android application configuration

The generated AndroidManifest.xml, which is the android configuration file, requires the permission android.permission.INTERNET, which allows your Android application to use the Internet connection on your device; nevertheless, this is not needed by our simple game code since there is no Internet interaction. So, you may delete this line from the AndroidManifest.xml file if you wish. Your game will be shown in landscape by default, but if you wish to create a game that runs in portrait mode, then you should change the android:screenOrientation value from landscape to portrait.

In order to change the Android application name, you may modify the app_name value located on the strings.xml file; it will affect the launcher icon's text and the application identifier within the Android OS.

When you are creating your own games, you will have to create your own classes, and those will often be more than the two classes that were created by the script. Every time you create a new class, you need to add its name to the LOCAL_SRC_FILES property of the Android.mk make file located inside the jni folder of your new project directory structure. So, when your cpp code is built by the C++ build tools, it knows which files it should compile.

C++ classes

Two C++ classes have been created: AppDelegate and HelloWorldScene. The first one is in charge of launching the Cocos2d-x framework and passing the control to the developer. The framework loading process happens within this class. If the Cocos2d-x core framework is successfully launched on the target device, it will run the applicationDidFinishLaunching method, which is the first game-specific function to be run.

The code is very straightforward and it is documented such that you will be able to grasp its logic easily. Our first minor change to the code will be to hide the debug information that shows by default on this sample game. You could simply guess that in order to achieve this you should only send false as a parameter for the setDisplayStats method call in the director singleton instance, as we can see in the following code listing:

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("My Game");
        director->setOpenGLView(glview);
    }
    // turn on display FPS
    director->setDisplayStats(false);
    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);
    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();
    // run
    director->runWithScene(scene);
    return true;
}

Tip

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.

Scenes

As we will cover in the chapters later in this book, Cocos2d-x handles the scene concept just like movies; movies are composed by scenes, so are the Cocos2d-x games. We can visualize the different screens, such as loading, main menu, world selection, gameplay levels, ending credits, and so on, as the different scenes. Each scene has a class that defines its behavior. The template code has only one scene named HelloWorld scene that is initialized and launched from within the AppDelegate class. The scene flow is managed by the game director as we have seen in the previous code. The Director class has all the basic features to drive the game, just like a director does during a movie. There is a single shared instance of the director class that is used within the whole application scope.

HelloWorldScene contains the layer that represents all the visible areas that show up when we run our HelloWorld application, that is, the hello world label, the Cocos2d-x logo, and the menu showing the exit option.

Within the init method, we do the instantiation of the visual elements, and then we add it to the scene using the addChild method inherited from the Node core class.

Summary

In this chapter, we have introduced the Cocos2d-x 3.4 gaming framework, and explained how to download and install it. We have also explained all of its pre-requisites. We have configured our work environment, launched our first Android application into an actual device, and gone through a quick code overview of the main aspects of the template code generated by the script.

In the next chapter, we will cover how to create and manipulate all of our game graphics, such as the main character, enemies, obstacles, backgrounds, and so on.

Left arrow icon Right arrow icon

Description

If you have a basic understanding of the C++ programming language and want to create videogames for the Android platform, then this technology and book is ideal for you.

Who is this book for?

If you have a basic understanding of the C++ programming language and want to create videogames for the Android platform, then this technology and book is ideal for you.
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 30, 2015
Length: 160 pages
Edition : 1st
Language : English
ISBN-13 : 9781785283833
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Publication date : Mar 30, 2015
Length: 160 pages
Edition : 1st
Language : English
ISBN-13 : 9781785283833
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 Can$6 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 Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 158.97
Cocos2d-x by example (update)
Can$61.99
Building Android Games with Cocos2d-x
Can$34.99
Cocos2d-x cookbook
Can$61.99
Total Can$ 158.97 Stars icon

Table of Contents

9 Chapters
1. Setting Up Your Development Environment Chevron down icon Chevron up icon
2. Graphics Chevron down icon Chevron up icon
3. Understanding Game Physics Chevron down icon Chevron up icon
4. User Input Chevron down icon Chevron up icon
5. Handling Text and Fonts Chevron down icon Chevron up icon
6. Audio Chevron down icon Chevron up icon
7. Creating Particle Systems Chevron down icon Chevron up icon
8. Adding Native Java Code Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(8 Ratings)
5 star 25%
4 star 75%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Francis May 20, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I found this book very helpful in getting the latest Cocos2d-x 3.x running on my Android devices. The book provides very clear instructions on setting up the Android development environment such as the Android SDK, NDK and Eclipse tools. After the first chapter you will be able use the Cocos2d-x Android build process to deploy a simple application to your Android device.The book covers all the basics of Cocos2d-x in the next few chapters, covering graphics, game physics, user input, text display, audio and particle systems. This is done by walking the reader through the development of a simple game. Additional information for the Android platform is also included such as handling the Android key press events.The last chapter is the best part for Android developers as it demonstrates how to add native java code to your project and goes over the Java NativeInterface (JNI) capabilities that allows you to interface with popular banner providers such as Google AdMob.Overall this book is best for anyone wanting to use Cocos2d-x to deploy an application to Android devices and provides a good overview of Cocos2d-x. It seems to be targeted at the beginner and will give the read a good start in getting games deployed on Android devices using Cocos2d-x.
Amazon Verified review Amazon
Jaime Sierra May 20, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Few books in the world that is written in English to talk about Cocos2D-x, which is a powerful tool for writing code once and to have it on different platforms, in this book you can build an Android game, which has the difficulty of being used in multiple devices with different screen sizes, so it is especially important in the design for optimal user experience. One can also say "everything is on the Internet", but "step by step" training book "Building Android Games with Cocos2d-x" can learn "without gaps" and have a basis to create the app easier to you want to achieve.Recommended the book.
Amazon Verified review Amazon
CdrJameson Oct 11, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A short book, but did exactly what I wanted and got my Cocos2d-x project off the ground in no time at all.Doesn't contain a great deal of further detail but saved me a good week or so of figuring out what was going on.
Amazon Verified review Amazon
Piotr Kuszyk May 22, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book is written for the Cocos2dx version 3.4. I am using 3.5 and I had no problems with the listings and the source code. The first chapter about setting up the environment is rely useful. I didn’t have problems on (Win 8.1). People with absolutely no experience might have problems with importing project into Eclipse. REMEMBER to import only project from proj.android directory. After that import cocos2d and select “libcocos2dx” only.The book guides you through creating a single simple game from scratch. Each chapter covers one issue and adds new functionality to the game. For a person with no experience in game development and Cocos2d it might be difficult to get familiar with the idea of Scenes or Layers. There is very little about it in second chapter.After understanding the idea of layers and scenes, the rest of the topics is more clear. At the beginning you learn how to move objects in the game and animate them. There is also described how to create a menu and animate between scenes.Game Physics seems to be described enough. You learn how to make things fall down. You apply force, velocity and torque to the object. You learn how to detect a collision.Events are also described quite well. You can learn how to deal with touch events and multi-touch events. You learn how to use accelerometer and how to handle the back button.The chapters about text and fonts, sound effects and particles are very entertaining. You learn how to apply plenty of effects to make the game look more professional.Last chapter about native java code shows how to add commercials to the game.Quick summarize:C++11 basics and Cocos2d basic concepts are required to fully understand the book. Good for beginners.PROS:1) Create fully functional game step by step2) Adding native Java code3) Cocos2d-x in version 3.4CONS:1) Only one physics engine described2) Macros and Director described too little3) Not explained how to remove sprites that are outside the screen (unused elements)4) Too little about particles
Amazon Verified review Amazon
Raul Roa Jul 01, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Cocos2d-X is a suite of open-source, cross-platform, game-development tools used by thousands of developers all over the world. It was branched out from the Cocos2d project in November 2010.It is a widely adopted framework among mobile developers and it is fair to say that an attempt to make a book about how to use it for Android development is a natural step.I must admit that after a weak foreword I was a bit skeptical about the quality of its content; after going through every chapter I changed my mind. The book is a good reference resource and if you are happen to be starting out, as a game developer trying to make your way at Google’s Playstore this might be a good place to start.The author makes an effort of breaking down the massive engine and it's most common features into digestible bits for anyone from novice to experts. It makes a pretty good job in going from installing a development environment from scratch to a working tech demo at the end of each chapter.Personally, I liked the way the author went into detail on describing how things work under the hood. However, I would have loved to see more depth into actual physics examples and a separated chapter that went into different collision detection strategies instead of cramping those up together.ConclusionBuilding Android Games with Cocos2d-x is a great introductory book for game developers who are looking to start on game development for Android mobile devices. It is also a great starting point for people who are looking into game development as a casual endeavor.I encourage you grab a copy right now!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela