Lua Game Development Practice Guide

Source: Internet
Author: User


Book address: http://book.douban.com/subject/20392269/

One-sentence comment on the book: those who want to use Lua for game Script Development are worth reading!

(1) features of this book

There are few Chinese books dedicated to Lua on the market. On the one hand, Lua may be relatively simple and there are not many things to talk about in depth. On the other hand, it shows the number of Lua developers (especially in China) it is still a relatively small group, and publishers have no choice. Going back to this book, it is different from general books that only talk about the Lua language itself, such as Lua program design. Instead, it focuses on the application of Lua in the game field, from the examples listed in the book, we can see that the author has a wealth of experience in the gaming industry. The following are some highlights of the book and I will share them with Zhu Jun :)


(2) Key Points

(1) application scenarios of Lua in Game Development

1) edit the game user interface

In my understanding, basic functions such as GUI drawing must be implemented by the host language, such as C/C ++. Lua can be responsible for GUI layout and other logic processing;


2) Define, store, and manage basic game data

My understanding: If the configuration data of Game objects is relatively simple, you can use Lua code to directly describe the configuration data, instead of text files, and save the parsing cost. To be more complex, you can combine Excel (saved as a CVS file) and use Lua's powerful text parsing function.


3) manage real-time game events

My understanding: the interaction between players and the game is completed through the mouse, keyboard, and other peripherals. In game design, the common practice is to use the event mechanism to drive the process. In Lua, you can define the luagrue function to interact with host languages such as C/C ++ to form a complete set of event systems. In specific implementation, the host language implements the underlying interfaces for capturing mouse and keyboard events, and what to do after an event is triggered, as well as the possible dependencies between events and other logic, this is done by Lua;


4) Create and maintain a developer-friendly game storage and loading system

My understanding: data such as game archives in standalone games can also be easily described using Lua;


5) Compile the AI system of the game

My understanding: the author mentioned the application of Lua in AI. I think the application scenario should be in some small standalone games, while in large Multiplayer Online online games, i'm afraid it still needs a higher performance C/C ++. Of course, the author also said that a flexible approach is to use Lua to quickly implement the prototype, encounter performance bottlenecks, and then replace it with C/C ++.


"Programmers are responsible for integrating Lua into the game development environment. game designers (Planning) are the main users of scripting languages, because they deal directly with game design and data on the upper layer, artists often use Lua to perform work such as layout of interfaces, design, and placement of various models in 3D scenarios." When we see this, we can't help but lament the level gap between us and our foreign game development counterparts: People think that game planning and art personnel writing scripts are a matter of course, and here we are, but do they think that these are not the jobs that programmers should do? The level of development philosophy directly leads to a huge difference in development results!


(3) limitations of this book

(1) The Lua version mentioned in the book is 5.0, and the latest version is 5.2.1. The API for communicating with C language has also changed;

(2) There is no important feature of Lua: coroutine, which is widely used in asynchronous programming. It not only simplifies the coding of traditional asynchronous programming, but also effectively improves the performance;




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.