瀏覽代碼

Testing speed capabilites

tags/online
madiwka3 4 年之前
父節點
當前提交
11f0c07b8f
共有 2 個文件被更改,包括 20 次插入17 次删除
  1. +17
    -8
      main.lua
  2. +3
    -9
      src/baseGame.lua

+ 17
- 8
main.lua 查看文件

@@ -24,7 +24,7 @@ wall1width = 30
nuclearanimation = 3
easternum = 0
ball_DIR = 0
updaterate = 0.05
updaterate = 0.03
RED = 255
hitNum = {}
hitNum[1] = 0
@@ -775,6 +775,7 @@ function nettest(dt)
'|' .. tostring(ball[i].y) ..
'|' .. gameState ..
'|' .. tostring(ball[i].dx) ..
'|' .. tostring(ballSpeed)
"|HOST")
print("SENT: " .. lastSentKey)
ts = 0
@@ -783,12 +784,13 @@ function nettest(dt)

local data
local datanumtest = 0
local datawaspassed = false
repeat
datanumtest = datanumtest + 1
print("LATENCY: " .. tostring(datanumtest))
data = udp:receive()
if data then
datawaspassed = true
print("ReceivedINFO: " .. data)
confirmation = "N"
local p = split(data, '|')
@@ -802,7 +804,10 @@ function nettest(dt)
player2.y = tonumber(p[2])
end
until not data
until not data
if not datawaspassed then
confirmation = "D"
end
end
function clienttest(dt)
if clientinit == false then
@@ -822,6 +827,7 @@ function clienttest(dt)
end
local data
local datanumtest = 0
local datawaspassed = false
repeat
datanumtest = datanumtest + 1
print("LATENCY: " .. tostring(datanumtest))
@@ -829,25 +835,28 @@ function clienttest(dt)
if data then
print("RECEIVED DATA: " .. data)
datawaspassed = true
print("SENT TO SERVER:" .. lastSentKey)
confirmation = "N"
local p = split(data, '|')
if p[13] then
if p[13] ~= "HOST" then
if p[14] then
if p[14] ~= "HOST" then
confirmation = "U"
end
if tonumber(p[14]) > 90 then
if tonumber(p[15]) > 90 then
confirmation = "L"
end
for i = 1, maxBalls do
local die = tonumber(p[2])
lastSentKeyClient, ball[i].dy, player1.y, player1score, player2score, player1nukescore, player2nukescore, ball[i].x, ball[i].y, gameState, ball[i].dx = p[1], die, tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), tonumber(p[9]), tonumber(p[10]), p[11], tonumber(p[12])
lastSentKeyClient, ball[i].dy, player1.y, player1score, player2score, player1nukescore, player2nukescore, ball[i].x, ball[i].y, gameState, ball[i].dx, ballSpeed = p[1], die, tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), tonumber(p[9]), tonumber(p[10]), p[11], tonumber(p[12]), tonumber(p[13])
end
end
end
print("GOT: " .. lastSentKeyClient)
until not data
if not datawaspassed then
confirmation = "D"
end
end
function wallbreaker(x, y)
if (gameState == "editor") then


+ 3
- 9
src/baseGame.lua 查看文件

@@ -456,20 +456,20 @@ end
function powerAvailability()
if (player1nukescore >= 20 and player1nukescore < 140) then
potentialstrike1 = 1
if (((globalState ~= "clienttest" and love.keyboard.isDown(p1control.super)) or (confirmation == "confirmed" and lastSentKeyP1 == p1control.super)) ) then
if (((globalState ~= "clienttest" and love.keyboard.isDown(p1control.super)) or (globalState == "clienttest" and lastSentKeyP1 == p1control.super)) ) then
player1striken = 1
player1reverbav = 0
end
end
if (player1nukescore >= 140) and timeIsSlow2 == false and timeIsSlow == false then
player1reverbav = 1
if ((confirmation == "confirmed" and lastSentKeyP1 == p1control.counter) or (globalState ~= "clienttest" and love.keyboard.isDown(p1control.counter))) then
if ((globalState == "clienttest" and lastSentKeyP1 == p1control.counter) or (globalState ~= "clienttest" and love.keyboard.isDown(p1control.counter))) then
powerControl(1, "special")
end
end
if (player1nukescore >= 200) then
potentialnuke1 = 1
if ((confirmation == "confirmed" and lastSentKeyP1 == p1control.super)or (globalState ~= "clienttest" and love.keyboard.isDown(p1control.super))) then
if ((globalState == "clienttest" and lastSentKeyP1 == p1control.super)or (globalState ~= "clienttest" and love.keyboard.isDown(p1control.super))) then
sounds["nuke"]:play()
if areanuclear == 1 then
maxspeed = maxspeed + 50
@@ -965,12 +965,6 @@ function rules(query, i)
end
end
function clientsBaseGame(dt)
if confirmation == "confirmed" then
player2.RED = 0
print("KEYS ARE: " .. confirmation .. " " .. lastSentKeyP1)
else
TEXT = "DISCONNECTED"
end
if gameMode == "reverse" then
reversegame(dt)
end


Loading…
取消
儲存