Lua Game Development Cookbook
eBook - ePub

Lua Game Development Cookbook

  1. 360 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Lua Game Development Cookbook

Book details
Book preview
Table of contents
Citations

About This Book

This book is for all programmers and game enthusiasts who want to stop dreaming about creating a game, and actually create one from scratch. The reader should know the basics of programming and using the Lua language. Knowledge of the C/C++ programming language is not necessary, but it's strongly recommended in order to write custom Lua modules extending game engine capabilities or to rewrite parts of the Lua code into a more efficient form.

Algebra and matrix operations are required in order to understand advanced topics in Chapter 4, Graphics ā€“ Legacy Method with OpenGL 1.x-2.1 and Chapter 5, Graphics ā€“ Modern Method with OpenGL 3.0+.

Sample demonstrations are coupled with binary libraries for Windows and Linux operating systems for convenience.

Frequently asked questions

Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Lua Game Development Cookbook by Mario Kasuba in PDF and/or ePUB format, as well as other popular books in Informatique & Programmation. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781849515504
Edition
1

Lua Game Development Cookbook


Table of Contents

Lua Game Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Basics of the Game Engine
Introduction
Preparing a basic file structure for the game engine
Getting ready
How to do itā€¦
How it worksā€¦
Making a stack
Getting ready
How to do itā€¦
How it worksā€¦
Making a queue
Getting ready
How to do itā€¦
How it worksā€¦
Making a prioritized queue
Getting ready
How to do itā€¦
How it worksā€¦
Extending ipairs for use in sparse arrays
Getting ready
How to do itā€¦
How it worksā€¦
Creating Lua modules
Getting ready
How to do itā€¦
A module that returns a table as an interface
A module in the form of an object
A module in the form of a singleton object
How it worksā€¦
Handling errors with pcall, xpcall, and assert
Getting ready
How to do itā€¦
How it worksā€¦
Using Lua with existing projects written in C/C++
Getting ready
How to do itā€¦
Initializing the Lua state
Creating a Lua module in C/C++
Passing variables from C/C++ into the Lua environment
Passing variables from the Lua environment to C/C++
Making the C++ class accessible from Lua with Lutok2
How it worksā€¦
Getting LuaSDL for libSDL 1.2
Getting ready
How to do itā€¦
There's moreā€¦
Designing the main application loop with LuaSDL
Getting ready
How to do itā€¦
How it worksā€¦
2. Events
Introduction
Processing input events with LuaSDL
Getting ready
How to do itā€¦
Event handling with the if-then-else chain
Event handling with an associative array
How it worksā€¦
See also
Using the keyboard input
Getting ready
How to do itā€¦
Normal keys
Modifier keys
How it worksā€¦
See also
Using the relative mouse position
Getting ready
How to do itā€¦
There's moreā€¦
Using the absolute mouse position
How to do itā€¦
Using timers
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
3. Graphics ā€“ Common Methods
Introduction
Creating a window in libSDL
Getting ready
How to do itā€¦
How it worksā€¦
Creating surfaces
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Surfaces manipulation
Getting ready
How to do itā€¦
How it worksā€¦
Using colors
Getting ready
How to do itā€¦
How it worksā€¦
Cursor manipulation
Getting ready
How to do itā€¦
How it worksā€¦
See also
Initializing the graphics mode with OpenGL
Getting ready
How to do itā€¦
How it worksā€¦
Getting OpenGL information
Getting ready
How to do itā€¦
Getting the OpenGL version
Getting the graphic card vendor
Getting the graphic card name
Getting the extensions list
How it worksā€¦
Using OpenGL extensions with GLEW and Lua
Getting ready
How to do itā€¦
How it worksā€¦
Loading images with SDL_image
Getting ready
How to do itā€¦
How it worksā€¦
Creating textures
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
Loading and using bitmap fonts
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Loading and using TrueType fonts
Getting ready
How to do itā€¦
How it worksā€¦
See also
Displaying the text
Getting ready
How to do itā€¦
How it worksā€¦
See also
Creating texture atlas with the rover-design pattern
Getting ready
How to do itā€¦
How it worksā€¦
Using tiles and tilesets in the game
Getting ready
How to do itā€¦
How it worksā€¦
See also
4. Graphics ā€“ Legacy Method with OpenGL 1.xā€“2.1
Introduction
Drawing primitives in immediate mode
Getting ready
How to do itā€¦
Drawing points
Drawing lines
Drawing line strips
Drawing line loops
Drawing triangles
Drawing triangle strips
Drawing triangle fans
Drawing quads
Drawing quad strips
Drawing polygons
How it worksā€¦
See also
Setting up blending
Getting ready
How to do itā€¦
Additive blending
Subtractive blending
Alpha blending
How it worksā€¦
Moving, rotating, and scaling objects
Getting ready
How to do itā€¦
How it worksā€¦
The identity matrix
The translation matrix
The scale matrix
The rotation matrix
There's moreā€¦
See also
Setting up the orthogonal and perspective cameras
Getting ready
How to do itā€¦
The orthogonal mode
The perspective mode
How it worksā€¦
There's moreā€¦
See also
Setting up materials
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Setting up lighting
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Using display lists
Getting ready
How to do itā€¦
How it worksā€¦
See also
Setting up the vertex buffer
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
5. Graphics ā€“ Modern Method with OpenGL 3.0+
Introduction
Loading and using GLSL shaders
Getting ready
How to do itā€¦
How it worksā€¦
See also
Using uniform variables with shaders
Getting ready
How to do itā€¦
Writing into uniform variables
Reading from uniform variables
How it worksā€¦
Writing a vertex shader
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Writing a fragment (pixel) shader
Getting ready
How to do itā€¦
How it worksā€¦
There's moreā€¦
See also
Drawing primitives using vertex buffers
Getting ready
How to do itā€¦
Vertex positions
Vertex colors
Vertex texture coordinates
How it worksā€¦
There's moreā€¦
See also
Rendering to texture
Getting ready
How to do itā€¦
The render buffer with the color attachment
The render buffer with the depth attachment
How it worksā€¦
See also
Applying highlights and shadows to the scene
Getting ready
How to do itā€¦
Vertex shader
Fragment shader
How it worksā€¦
See also
Bumpmapping
Getting ready
How to do itā€¦
Vertex shader
Fragment shader
Ho...

Table of contents

  1. Lua Game Development Cookbook