GithubHelp home page GithubHelp logo

pebsie / love-network Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3 KB

Extremely simple Lua UDP networking based on the LOVE Wiki guide. Made this for myself to save time later but thought I'd keep it so as to possibly help others.

Lua 100.00%

love-network's Introduction

love-network

Extremely simple Lua UDP networking based on the LOVE Wiki guide. Made this for myself to save time later but thought I'd keep it so as to possibly help others. You'll need a basic understanding of Lua to use this, obviously. I've just removed all of the stuff that everyone has to fill out to use socket.

Usage

Client

Include require "client" at the top of your code. In love.load() put put netConnect(address, port, updaterate) with your server's address, port and your updaterate of choice. 0.1 is usually a good shout. In love.update(dt) put netUpdate(dt). Whenever you want to send a message use netSend(cmd,var1,var2). CMD is the command you want to execute (which must be set up on the server), var1 is what the data is that you want to send and var2 is more data to send (this parameter is optional).
You'll want to modify the netUpdate function in client.lua to do stuff with the data it receives from the server.

Server

Add your game's variables and what not. Add responses to commands where it says. Change the second parameter at udp:setsockname("*", 26656) to the port you're using. Add game behaviour where it says.

love-network's People

Stargazers

 avatar

Watchers

James Cloos avatar Thomas Lock avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.