Lua Game Development Cookbook

Over 70 recipes that will help you master the elements and best practices required to build a modern game engine using Lua
Preview in Mapt

Lua Game Development Cookbook

Mário Kašuba

4 customer reviews
Over 70 recipes that will help you master the elements and best practices required to build a modern game engine using Lua
Mapt Subscription
FREE
$29.99/m after trial
eBook
$20.00
RRP $39.99
Save 49%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$20.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Lua Game Development Cookbook Book Cover
Lua Game Development Cookbook
$ 39.99
$ 20.00
CryENGINE Game Programming with C++, C#, and Lua Book Cover
CryENGINE Game Programming with C++, C#, and Lua
$ 26.99
$ 13.50
Buy 2 for $31.00
Save $35.98
Add to Cart

Book Details

ISBN 139781849515504
Paperback360 pages

Book Description

The Lua language allows developers to create everything from simple to advanced applications and to create the games they want. Creating a good game is an art, and using the right tools and knowledge is essential in making game development easier.

This book will guide you through each part of building your game engine and will help you understand how computer games are built. The book starts with simple game concepts used mainly in 2D side-scroller games, and moves on to advanced 3D games. Plus, the scripting capabilities of the Lua language give you full control over game.

By the end of this book, you will have learned all about the components that go into a game, created a game, and solved the problems that may arise along the way.

Table of Contents

Chapter 1: Basics of the Game Engine
Introduction
Preparing a basic file structure for the game engine
Making a stack
Making a queue
Making a prioritized queue
Extending ipairs for use in sparse arrays
Creating Lua modules
Handling errors with pcall, xpcall, and assert
Using Lua with existing projects written in C/C++
Getting LuaSDL for libSDL 1.2
Designing the main application loop with LuaSDL
Chapter 2: Events
Introduction
Processing input events with LuaSDL
Using the keyboard input
Using the relative mouse position
Using the absolute mouse position
Using timers
Chapter 3: Graphics – Common Methods
Introduction
Creating a window in libSDL
Creating surfaces
Surfaces manipulation
Using colors
Cursor manipulation
Initializing the graphics mode with OpenGL
Getting OpenGL information
Using OpenGL extensions with GLEW and Lua
Loading images with SDL_image
Creating textures
Loading and using bitmap fonts
Loading and using TrueType fonts
Displaying the text
Creating texture atlas with the rover-design pattern
Using tiles and tilesets in the game
Chapter 4: Graphics – Legacy Method with OpenGL 1.x–2.1
Introduction
Drawing primitives in immediate mode
Setting up blending
Moving, rotating, and scaling objects
Setting up the orthogonal and perspective cameras
Setting up materials
Setting up lighting
Using display lists
Setting up the vertex buffer
Chapter 5: Graphics – Modern Method with OpenGL 3.0+
Introduction
Loading and using GLSL shaders
Using uniform variables with shaders
Writing a vertex shader
Writing a fragment (pixel) shader
Drawing primitives using vertex buffers
Rendering to texture
Applying highlights and shadows to the scene
Bumpmapping
Chapter 6: The User Interface
Introduction
Drawing a simple window
Moving the window
Using the window hierarchy
Showing the part of the window with the stencil test and window content scrolling
Window controls and interaction
Chapter 7: Physics and Game Mechanics
Introduction
Using Box2D with Lua
Using vector math
Choosing the correct vector scaling for the physics engine
Creating static and dynamic objects
Setting up object properties
Moving objects
Setting up bullets
Running the physics simulation
Detecting object collision
Setting up object collision filtering
Setting up object joints
Chapter 8: Artificial Intelligence
Introduction
A simple pathfinding algorithm for a maze
Pathfinding for tile-based environments with obstacles
Using a fuzzy logic for decision making
Chapter 9: Sounds and Networking
Introduction
Initializing the audio subsystem
Playing sound samples
Playing background music
Network communication with ZeroMQ
Creating a basic client-server architecture
Sending messages to many hosts at once
Communication between threads

What You Will Learn

  • Set up OpenGL graphics along with GLSL shaders
  • Use lighting and graphical effects
  • Create animated game characters using Box2D library
  • Load and use textures, fonts, and 3D models
  • Design and implement a graphical user interface
  • Integrate simple Artificial Intelligence for pathfinding
  • Implement networking support
  • Use data structures in programming

Authors

Table of Contents

Chapter 1: Basics of the Game Engine
Introduction
Preparing a basic file structure for the game engine
Making a stack
Making a queue
Making a prioritized queue
Extending ipairs for use in sparse arrays
Creating Lua modules
Handling errors with pcall, xpcall, and assert
Using Lua with existing projects written in C/C++
Getting LuaSDL for libSDL 1.2
Designing the main application loop with LuaSDL
Chapter 2: Events
Introduction
Processing input events with LuaSDL
Using the keyboard input
Using the relative mouse position
Using the absolute mouse position
Using timers
Chapter 3: Graphics – Common Methods
Introduction
Creating a window in libSDL
Creating surfaces
Surfaces manipulation
Using colors
Cursor manipulation
Initializing the graphics mode with OpenGL
Getting OpenGL information
Using OpenGL extensions with GLEW and Lua
Loading images with SDL_image
Creating textures
Loading and using bitmap fonts
Loading and using TrueType fonts
Displaying the text
Creating texture atlas with the rover-design pattern
Using tiles and tilesets in the game
Chapter 4: Graphics – Legacy Method with OpenGL 1.x–2.1
Introduction
Drawing primitives in immediate mode
Setting up blending
Moving, rotating, and scaling objects
Setting up the orthogonal and perspective cameras
Setting up materials
Setting up lighting
Using display lists
Setting up the vertex buffer
Chapter 5: Graphics – Modern Method with OpenGL 3.0+
Introduction
Loading and using GLSL shaders
Using uniform variables with shaders
Writing a vertex shader
Writing a fragment (pixel) shader
Drawing primitives using vertex buffers
Rendering to texture
Applying highlights and shadows to the scene
Bumpmapping
Chapter 6: The User Interface
Introduction
Drawing a simple window
Moving the window
Using the window hierarchy
Showing the part of the window with the stencil test and window content scrolling
Window controls and interaction
Chapter 7: Physics and Game Mechanics
Introduction
Using Box2D with Lua
Using vector math
Choosing the correct vector scaling for the physics engine
Creating static and dynamic objects
Setting up object properties
Moving objects
Setting up bullets
Running the physics simulation
Detecting object collision
Setting up object collision filtering
Setting up object joints
Chapter 8: Artificial Intelligence
Introduction
A simple pathfinding algorithm for a maze
Pathfinding for tile-based environments with obstacles
Using a fuzzy logic for decision making
Chapter 9: Sounds and Networking
Introduction
Initializing the audio subsystem
Playing sound samples
Playing background music
Network communication with ZeroMQ
Creating a basic client-server architecture
Sending messages to many hosts at once
Communication between threads

Book Details

ISBN 139781849515504
Paperback360 pages
Read More
From 4 reviews

Read More Reviews

Recommended for You

CryENGINE Game Programming with C++, C#, and Lua Book Cover
CryENGINE Game Programming with C++, C#, and Lua
$ 26.99
$ 13.50
Corona SDK HOTSHOT Book Cover
Corona SDK HOTSHOT
$ 29.99
$ 15.00
Unity Character Animation with Mecanim Book Cover
Unity Character Animation with Mecanim
$ 39.99
$ 20.00
Gideros Mobile Game Development Book Cover
Gideros Mobile Game Development
$ 20.99
$ 10.50
HTML5 Game Development with GameMaker Book Cover
HTML5 Game Development with GameMaker
$ 26.99
$ 13.50
Raspberry Pi Mechatronics Projects HOTSHOT Book Cover
Raspberry Pi Mechatronics Projects HOTSHOT
$ 26.99
$ 13.50