Book Image

Lua Game Development Cookbook

By : Mario Kasuba, Mário Kašuba
Book Image

Lua Game Development Cookbook

By: Mario Kasuba, Mário Kašuba

Overview of this book

Table of Contents (16 chapters)
Lua Game Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Introduction


In this chapter, you'll learn how to use the sound subsystem in LuaSDL and to communicate over the network or between the threads with the ZeroMQ library.

Sounds and music in games can enhance the overall atmosphere or make them even more memorable to players. The LibSDL library itself contains only the basic function to send raw data to your audio card. Fortunately, the LuaSDL library bundles the LibSDL library with the SDL_Mixer add-on, which extends a number of audio file decoders and adds simple audio effects, such as volume control, fade-in, and fade-out. You can load sound samples by using one of these file formats: WAV, MID, MOD, OGG, or MP3.

Whether or not you plan to use multiplayer, the ZeroMQ library can solve many common problems with network communication or multithreading.

This library provides a robust yet simple communication system. It supersedes classic socket connections with reliable message transport and automatic reconnection. Optionally, connections can be...