
My code is identical to the example posted above (or close enough to it).
(Also, the steam link in the OP is broken)
Code: Select all
Net:send( server_data, "ready", Nil, "192.168.1.69")
I'm looking into this error now, I'll let you know ASAP. I am at a friends house but I'll work on it in a few hours. Sorry for the long wait.InsertNameHere wrote:OK, so I got an example to work when the client sends data to the server, but when I tried to implement the server sending to the client in a game i've been programming, it gives me an error.
Code: Select all
for CLIENTSID,table in pairs( net.users ) do
Net:send( server_data, "ready", Nil, CLIENTSID)
end
Code: Select all
for CLIENTSID,table in pairs( net.users ) do
i, k = string.find( CLIENTSID, "192.168.1.69" )
if i or k then
Net:send( server_data, "ready", Nil, CLIENTSID )
end
end
-- Alternate
for CLIENTSID,table in pairs( net.users ) do
if table.name == "Nicholas Scott" then
Net:send( server_data, "ready", Nil, CLIENTSID )
end
end
Looking into this now, do you think you could dropbox the folder of all of your server code, if you don't mind. I would like to see how you run it for debugging, Please and thank youlumaio wrote:I'm having a strange issue where the player will connect but will be immediately timed out and will attempt to reconnect.
(Also, the steam link in the OP is broken)
I'll look into that feature, sounds like a good one. I might receive packets 1, 2, 3 and server/client will drop packet 1, store packet 2 as LAST RECEIVED and keep packet 3 as the latest one. But as of now the end of the net code receives a command and runs it with a table that is also passed, not really any packet/storage, really just a run as it receives kind of thing. May work on this briefly, although I am kind of busy right now, I'll see thoughcalusari wrote:Great library! Been messing around with it and it seems very promising! I love the run remote command feature.
Would like to see a feature to drop packets that are out of order
Code: Select all
Net = require "Net"
function love.load()
Net:init( "client" )
Net:connect( "212.187.101.32", 80 ) --Is it safe putting my IP on the web like that..? Sure!
timer = 0
client_data = {}
client_data.xPos = 300
client_data.yPos = 300
end
function love.update(dt)
Net:update(dt)
timer = timer + dt
if timer > 0.001 then
timer = 0
Net:send(client_data, "update", nil)
end
if love.keyboard.isDown("d") then
client_data.xPos = client_data.xPos + 100*dt
elseif love.keyboard.isDown("a") then
client_data.xPos = client_data.xPos - 100*dt
end
end
function love.draw()
love.graphics.rectangle("fill", client_data.xPos, client_data.yPos, 64, 64)
end
Code: Select all
Net = require("Net")
box = {
xPos = 0,
yPos = 0,
}
function love.load()
Net:init("server")
Net:connect(nil, 80)
Net:setMaxPing(1000)
Net:registerCMD( "update", function( client_data, param, id, deltatime )
box.xPos, box.yPos = client_data.xPos, client_data.yPos
print(box.xPos.. " " ..box.yPos)
end)
end
function love.update(dt)
Net:update(dt)
for id,data in pairs( Net:connectedUsers() ) do
print(id)
end
end
function love.draw()
love.graphics.rectangle("fill", box.xPos, box.yPos, 64, 64)
end
Code: Select all
for id,data in pairs( Net:connectedUsers() ) do
data.players.x[id] = net:recieve(...)
data.players.y[id] = net:recieve(...)
end
Code: Select all
for id,data in pairs( Net:connectedUsers() ) do
net:recieve(127.0.0.1, recievedData)
data.players[id] = recievedData
end
Glad to hear. Is it still active?Nicholas Scott wrote: ↑Tue Aug 16, 2016 3:55 pm Reviving this project, check original post for details!
Users browsing this forum: Ahrefs [Bot], Perceptron and 1 guest