Current location - Quotes Website - Personality signature - Translators are proficient in Android game development.
Translators are proficient in Android game development.
First of all, this is a book about programming. Maybe you will say, "programming books are everywhere!" " )

To be exact, this is a book about game programming. Maybe you will say, "What's so rare about game programming books?" )

More precisely, this is a book about Android game programming. (Maybe you will say: "There are many Android game programming books now!" )

Most importantly, this is a programming book that can help you easily transplant huge and exquisite 3D games from PC to Android platform. Maybe you'll say, "... Oh? Then you can try! ”)

Yes, this is the most striking part of this book. Different from the general Android game programming book, it does not introduce all aspects of developing games on this platform in detail, but finds a unique focus, so that you can really understand how to complete the development of Android games with half the effort.

Maybe you never thought that Wolfenstein 3D, Doom and other games can run smoothly on Android, but this seemingly arduous task has been easily completed by the author, and he will teach you this unique skill carefully. This book in your hand is the legendary sunflower collection.

This book has another feature: talk less and do more. It always comes straight to the point, points out the method, and then explains how to apply it completely through examples, and emphasizes how to solve the problems existing in the application process. This should be very popular with front-line programmers.

You should be eager to try, so start now, to understand the mystery of the book, master the secret skills taught by the author, and enjoy the fun of Android game development!

The book was mainly translated by Wang Heng and Su Jinguo, and assisted by Wang Xiaozhen, Li Huang, Liu Liang, Wang Shaoxuan and Xie Lianbao. If the translation is improper, please criticize and correct me.

order

This book will help you create the best games for the Android platform. There are many books discussing this topic now, but this book will show how to easily transplant local PC games to Android platform from a unique perspective. To this end, this book uses real examples that we are familiar with, and each chapter provides a lot of source code. Remember, before studying this book in depth, you must first have a solid foundation in Java and ANSI C. I will try my best to explain these most complicated concepts in a clear and simple way, combining graphics and sample code. The source code provided in each chapter can help you understand the concept in depth. As a mobile game developer, you can also make full use of these source codes to save development time.

What software do you need?

In order to make full use of this book, you need the following tools.

Windows or Linux PC with Java SDK installed correctly.

I think this is obvious, because most Android development is done in Java. Note that I said Java SDK, not JRE. Because JNI header files and command-line tools will be used in later chapters, SDK is essential.

Eclipse IDE and Android SDK

Eclipse is the de facto standard IDE in Android development field. I used Eclipse Galileo to create the workspaces of all the examples in this book. Of course, I can use Eclipse Ganymede. The uniqueness of this book

I think it is important for readers to understand that the writing goal of this book is different. Although Java is the main development language of Android, Google realizes that Android, as a game platform, needs Java/C mixed development very much, which is why they released NDK. Google gradually realized that there are too many local games written for other mobile platforms (such as iPhone), and Android needs to support C development to catch up. PC games have been developed for decades (mainly written in C), and thousands of PC games can be transplanted to Android platform with a simple ARM C compiler. It is this that makes this book unique. Since we can simply combine these two languages in an elegant way, thus saving a lot of time and money, why bother to convert 654.38+ 10,000 lines of complex C code into Java code? Through this book, you will master how to combine these two languages effectively. This is my goal, and it is this that makes this book stand out among many related books. On the other hand, this book also contains chapters on pure Java games. By reasonably and evenly distributing each part of the content, I hope to meet the needs of both Java followers and C lovers.

Android SDK compatibility

As a developer, you may want to know the SDK compatibility of the code in this book. This is an important issue because the version of Android SDK is updated frequently. At the time of writing this book, Google just released version 2.0 of Android SDK 2.0. The code in this book has been tested by the following Android SDK versions:

SDK 2.0

SDK 1.6

SDK 1.5

SDK 1.0

In a word, the code in this book can run smoothly in all SDK versions from 1.0 to 2.0, which is my goal all the time. In this book, the contents of pure Java games and mixed games are reasonably divided as follows:

Chapter 1

As the first step, this chapter first establishes a Linux system to complete the compilation of mixed games, including obtaining Android source files, extracting device system libraries, establishing customized compilation tool chains and customizing compilation scripts. Because Eclipse IDE will be used later in this book, this chapter will also introduce the details of setting up this development environment. .

chapter two

In this chapter, you will learn how to combine Java and C code gracefully by building a simple Java application on a local library. You will learn some exciting concepts about Java Native Interface (JNI), as well as the API used when Java and C are combined, including how to load local libraries, how to use local keywords, how to generate JNI header files, method signatures, Java arrays and C arrays, calling Java methods, and product compilation and packaging.

chapter three

Starting from this chapter, let's study pure Java games, starting with a real game called Space Blaster. The goal of this game is to make a spaceship fly over the stars with your finger or keyboard. Starting from this chapter, you will learn how to build a customized linear layout based on XML, how to use abstract classes and timer tasks to simulate a simple game cycle, how to invalidate views in a non-UI thread, and how to load sprite and sounds from project resources. In addition, you will learn some drawing techniques, such as elf animation, simple object drawing and using Paint objects to set styles and colors.

chapter four

Chapter 4 takes the classic arcade game asteroid as an example, and continues to discuss pure Java games. You will learn to draw polygon elves on Android canvas. This technology is a bit difficult because the Android API lacks support for polygons. This chapter relies on the high portability of Java language to transplant polygon code from J2SE API to Android API, and finally create an asteroid. You may have noticed that this is a polygon-based game. In addition, this chapter also talks about other interesting topics, including the steps in the game life cycle (that is, initializing, drawing and updating physical features), responding to key and touch events, and testing on the device simulator.

chapter five

This chapter discusses the use of OpenGL to draw 3D graphics. Here I will show a wonderful skill that I got by chance, with which I can mix OpenGL API calls in Java and C. Google provides a 3D cube example to show how to use OpenGL in pure Java and mixed mode, and we will illustrate this concept through this cube example. This technology will open up a new field for the 3D development of Android, so that a large number of 3D PC games can be transplanted to this platform, which will greatly save the development cost and time.

Chapter vi

Chapters 6 and 7 can be regarded as a series, which is my personal favorite part of this book. This chapter will introduce Wolfenstein 3D into Android platform-this game can be called the "godfather" of all 3D shooting games on PC. Who would have thought that such a complicated PC game could be easily transplanted to Android mobile devices! This chapter will introduce how Java and C get along harmoniously, and other topics, such as basic game architecture (showing how Java and C components are combined), resource handlers for sound, music, keys and touch events, how to cascade graphic information, video buffers and sound/music requests back to Java using JNI, and how to compile and test them.

Chapter VII

As the next step, Chapter 7 uses the iconic game Doom on PC to further demonstrate related concepts. It is absolutely indisputable that Doomsday is the greatest 3D game of all time. It opens up a new field for 3D graphics games. The ultimate goal of this chapter is not to describe the game itself, but I hope you can understand how easy it is to transplant a complicated PC game like Doom to the Android platform. Don't you believe it? I can give you a proof: Doom contains more than 654.38+ million lines of C code, but you only need to add less than 200 lines of JNI API calls and Java code needed to build a mobile UI, so you can introduce Android! This chapter will show that there is absolutely no need to convert all 654.38+ million lines of C code into Java code, but only to mix these two powerful languages perfectly in an "elegant" application in a clever way. Think about how much development time and cost this will save! Please read this chapter carefully.