Hi !
It seems to be multiple questions in such innocent section, i'll try to provide answers, as i'm working such things too.
Before everything, we have to agree on authentification purposes. IMHO, it has no sense to provide authentification in solo gaming other than a save-file name, so i'm assuming your plans for your game are multiplayer persistants states (such as MMO, if i'm quitting at 127, 255, i'm loggin at 127, 255) which implies data protection.
As pointed out by
I~=Spam and links, every Lua code given to the client can be read so, it's not a option to put your authentification code in the client-side application. You don't want anyone to be able to access common database and having a client modifying data of another, that's how we come to speak about server-side application. Technically, your server can be HTTP or some custom build, it depends on data you have to move around and how often. Here's my process to get a client to send movement to a server, LÖVE compliant both sides but unworking.
A first introduction to socket would be
Google and more specifically because it's ship with LÖVE,
LuaSocket.
Code: Select all
-- Client.lua
function init()
udp = socket.udp()
udp:setpeername(arg[2], arg[3])
end
function move(direction)
local tmp;
if direction == 'up' then
tmp = "0 -1"
elseif direction == 'down' then
tmp = "0 1"
elseif direction == 'left' then
tmp = "-1 0"
elseif direction == 'right' then
tmp = "1 0"
end
self.udp:send(tmp)
end
By having
Code: Select all
-- Conf.lua
t.modules.window = false
it's possible to launch love without window.
Code: Select all
-- Server.lua
function init()
udp = socket.udp()
udp:setsockname(arg[2], arg[3])
udp:settimeout(0)
end
function update(dt)
local data, msg_or_ip, port_or_nil = udp:receivefrom()
if not data then return end
parse(data, msg_or_ip, port_or_nil)
end
It's hard to elaborate on such large thematic. One of the finest read i had is from
GafferonGames.