Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Lua Game Development Cookbook
  • Table Of Contents Toc
Lua Game Development Cookbook

Lua Game Development Cookbook

By : Mário Kašuba
4.3 (6)
close
close
Lua Game Development Cookbook

Lua Game Development Cookbook

4.3 (6)
By: Mário Kašuba

Overview of 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.
Table of Contents (11 chapters)
close
close
10
Index

Sending messages to many hosts at once


There might be a case when you'd like to send a single message to multiple hosts at the same time. A typical example of such a situation can be a chat application. The ZeroMQ library solves this problem with the Publisher-Subscriber model, which is similar to a well-known multicast. Multiple types of messages can be divided into topics identified by a simple string value.

Do note that with the Publisher-Subscriber model, you can send messages only from the publisher to the subscriber, not the other way round.

Getting ready

For this recipe, you'll be using one publisher part and at least one subscriber. You can run more subscriber instances to see the effect of this network model.

How to do it…

This recipe will be divided into two parts, one for the publisher and the other for the subscriber.

The publisher part

Let's take a look at the publisher recipe:

  1. First you'll need to prepare the ZeroMQ socket for the publisher:

    local zmq = require 'zmq'
    local context...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Lua Game Development Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon