|
@@ -725,14 +725,10 @@ function love.update(dt) |
|
|
|
|
|
|
|
|
if globalState == "nettest" then |
|
|
if globalState == "nettest" then |
|
|
print("Confcode: " .. confirmation) |
|
|
print("Confcode: " .. confirmation) |
|
|
ts = ts + dt |
|
|
|
|
|
if confirmation == "N" then |
|
|
if confirmation == "N" then |
|
|
basegame(dt) |
|
|
basegame(dt) |
|
|
end |
|
|
end |
|
|
if ts > updaterate then |
|
|
|
|
|
nettest(dt) |
|
|
nettest(dt) |
|
|
ts = ts - updaterate |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
end |
|
|
if globalState == "clienttest" then |
|
|
if globalState == "clienttest" then |
|
@@ -740,11 +736,8 @@ function love.update(dt) |
|
|
if confirmation == "N" then |
|
|
if confirmation == "N" then |
|
|
lastSentKeyP1 = lastSentKeyClient |
|
|
lastSentKeyP1 = lastSentKeyClient |
|
|
clientsBaseGame(dt) |
|
|
clientsBaseGame(dt) |
|
|
end |
|
|
|
|
|
if ts > updaterate then |
|
|
|
|
|
clienttest(dt) |
|
|
|
|
|
ts = ts - updaterate |
|
|
|
|
|
end |
|
|
end |
|
|
|
|
|
clienttest(dt) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -767,7 +760,9 @@ function nettest(dt) |
|
|
serverinit = true |
|
|
serverinit = true |
|
|
end |
|
|
end |
|
|
for i = 1, maxBalls do |
|
|
for i = 1, maxBalls do |
|
|
print (tostring(ball[i].dy)) |
|
|
|
|
|
|
|
|
ts = ts + dt |
|
|
|
|
|
if ts > updaterate then |
|
|
|
|
|
--print (tostring(ball[i].dy)) |
|
|
udp:send(tostring(lastSentKey) .. |
|
|
udp:send(tostring(lastSentKey) .. |
|
|
'|' .. tostring(ball[i].dy) .. |
|
|
'|' .. tostring(ball[i].dy) .. |
|
|
'|' .. tostring(player2.y) .. |
|
|
'|' .. tostring(player2.y) .. |
|
@@ -782,6 +777,8 @@ function nettest(dt) |
|
|
'|' .. tostring(ball[i].dx) .. |
|
|
'|' .. tostring(ball[i].dx) .. |
|
|
"|HOST") |
|
|
"|HOST") |
|
|
print("SENT: " .. lastSentKey) |
|
|
print("SENT: " .. lastSentKey) |
|
|
|
|
|
ts = 0 |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
local data |
|
|
local data |
|
@@ -820,6 +817,11 @@ function clienttest(dt) |
|
|
udp:send(tostring(lastSentKey) .. '|' .. tostring(player2.y) .. "|CLIENT") |
|
|
udp:send(tostring(lastSentKey) .. '|' .. tostring(player2.y) .. "|CLIENT") |
|
|
clientinit = true |
|
|
clientinit = true |
|
|
end |
|
|
end |
|
|
|
|
|
ts = ts + dt |
|
|
|
|
|
if ts > updaterate then |
|
|
|
|
|
udp:send(tostring(lastSentKey) .. '|' .. tostring(player2.y) .. "|CLIENT") |
|
|
|
|
|
ts = 0 |
|
|
|
|
|
end |
|
|
local data |
|
|
local data |
|
|
local datanumtest = 0 |
|
|
local datanumtest = 0 |
|
|
repeat |
|
|
repeat |
|
@@ -829,7 +831,7 @@ function clienttest(dt) |
|
|
|
|
|
|
|
|
if data then |
|
|
if data then |
|
|
print(data) |
|
|
print(data) |
|
|
udp:send(tostring(lastSentKey) .. '|' .. tostring(player2.y) .. "|CLIENT") |
|
|
|
|
|
|
|
|
|
|
|
print("SENT TO SERVER:" .. lastSentKey) |
|
|
print("SENT TO SERVER:" .. lastSentKey) |
|
|
confirmation = "N" |
|
|
confirmation = "N" |
|
|
local p = split(data, '|') |
|
|
local p = split(data, '|') |
|
|