Compare commits

..

No commits in common. "7308086139182e58d8553bd3321f2a130c81bafe" and "ea5b39ebb75e3b7efd4dd0c55b6dade621f16a19" have entirely different histories.

24 changed files with 168 additions and 313 deletions

View File

@ -1,6 +0,0 @@
call build.bat
pushd "%~dp0\build\"
start server.bat
start client.bat
start metaserver.bat
popd

View File

@ -1,3 +0,0 @@
@echo on
robocopy src build /E
pause

33
build.sh Normal file
View File

@ -0,0 +1,33 @@
#get locations of scripts, libraries, engine
SRC_DIR="src"
LIB_DIR="lib"
LOVE_DIR="../../love"
BUILD_DIR="build"
#build LuaJIT for target platform
#build LuaSocket shared library for target platform
#get appropriate copy of love
#zip client scripts into .love file
cp -r $SRC_DIR/ $BUILD_DIR/
cd $BUILD_DIR/
zip -9 -r vision.love
#zip .love file with LOVE and dependencies (and license!)
#zip server scripts with LuaJIT and dependencies
#zip metaserver with LuaJIT and dependencies
#WINDOWS: make fused client executable
cat ../../love/love.exe vision.love > vision.exe
#LINUX: get official LOVE AppImage

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,58 +1,31 @@
local config
local lfs = assert( love ).filesystem
local cfg = lfs.newFile "cfg.lua"
local mt = { __tostring = function( t )
local arr = { "tblOption{\n ",}
for k, v in pairs( t ) do
arr[#arr + 1] = k
arr[#arr + 1] = " = "
arr[#arr + 1] = tostring( v )
arr[#arr + 1] = ",\n "
end
arr[#arr + 1] = "}"
return table.concat( arr )
end }
local function tblOption(t)
return setmetatable( t, mt )
end
local config = {}
local defaultConfig = {
plName = "Player Name",
plPronoun = tblOption{
subject = "they",
object = "them",
possessive = "their",
},
plColour = tblOption{ 0.5, 0.6, 0.7, 0.5 },
plPronoun = "they/them/their",
plR = 0.8,
plG = 0.4,
plB = 0.4,
gamma = 0.5,
keybinds = tblOption{
Forward = "w",
Back = "s",
Left = "a",
Right = "d",
Chat = "t",
Love = "q",
Hate = "e",
},
keyForward = "w",
keyBack = "s",
keyLeft = "a",
keyRight = "d",
keyChat = "t",
keyLove = "q",
keyHate = "e",
serverIP = "192.168.2.15",
serverPort = 51312,
logFile = "log.txt",
logFile = "../logs/log.txt",
}
local function readConfigFile()
local ok, cfgTbl, err = pcall( lfs.load, 'cfg.lua' )
if ok and cfgTbl then
local ok, err = pcall( cfgTbl )
if err then print( "Failed to load settings file: ", err ) end
return
end
return defaultConfig
return dofile( "./cfg.lua" ) or defaultConfig
end
local function dumpConfigFile()
print( "Saving Settings." )
assert( cfg:open 'w' )
local cfg = assert(io.open( "./cfg.lua", "w" ))
cfg:write( "return {\n " )
for k, v in pairs( config ) do
cfg:write( k )
@ -63,6 +36,4 @@ local function dumpConfigFile()
cfg:write( "}" )
end
config = readConfigFile()
return config

View File

@ -1,8 +1,8 @@
local scene = assert( require 'scene' )
local scene = assert( require 'client.scene' )
local lg = assert( love.graphics )
local server = assert( require 'udp' )
local button = assert( require 'ui.button' )
local strings = assert( require 'strings' )
local server = assert( require 'client.udp' )
local button = assert( require 'client.ui.button' )
local strings = assert( require 'client.strings' )
local connecting = {}
local time, ip, port, attempts = 0, 0, 0, 0

View File

@ -1,7 +1,7 @@
local crepuscular = {}
local lg = assert( love.graphics )
local shader = assert( lg.newShader( 'assets/glsl/crepuscular' ))
local scene = assert( require( 'scene' ) )
local shader = assert( lg.newShader( 'client/assets/glsl/crepuscular' ))
local scene = assert( require( 'client.scene' ) )
local rectanglePosition = { }
function crepuscular.draw()

View File

@ -1,9 +1,9 @@
local lg = assert( love.graphics )
local scene = assert( require 'scene' )
local shared = assert( require 'shared.shared' )
local server = assert( require 'udp' )
local scene = assert( require 'client.scene' )
local shared = assert( require 'shared' )
local server = assert( require 'client.udp' )
local packet = shared.packet
local crepuscular = assert( require 'crepuscular' )
local crepuscular = assert( require 'client.crepuscular' )
local game = {}
local t = 0

View File

@ -1,28 +0,0 @@
package.cpath = "..\\?.dll;..\\clib\\?.dll;"..package.cpath
package.path = "..\\?.lua;..\\lualib\\?.lua;"..package.path
local shared = assert( require 'shared.shared' )
local love = assert( love )
function love.load()
print( "Client Started." )
assert( require 'config' )
--Crash if running luajit 2.1 and coconut missing
--[[loadstring( love.data.decode( "string", "base64","G0xKAgrbAQAACgALABY2AAAAOQABADkAAgAnAgMAJwMEADYEAAA5BAEEOQQFBCcGBgA2BwAAOQcHBzkHCAcnCQkAQgcCAEEEAQBBAAICBgAKAFgAAoArAAEAWAEBgCsAAgBMAAIALWQ4MmY3M2RkNjQ1MDcxNDZiNTkwNTMwYjg0NDcwMWZlMmJmYjdjZTkeY2xpZW50L2Fzc2V0cy9jb2NvbnV0LnBuZxFuZXdJbWFnZURhdGEKaW1hZ2UJc2hhMQloYXNoCGhleAtzdHJpbmcLZW5jb2RlCWRhdGEJbG92ZV0BAAUABQAONgAAADMCAQBCAAICDgAAAFgBB4A2AAIANAIAADUDAwA2BAAAPQQEA0IAAwJCAAECMgAAgEwAAgALX19jYWxsAQAAEXNldG1ldGF0YWJsZQAKcGNhbGwA" ))()]]
love.window.setIcon( assert( love.image.newImageData( "assets/client-icon.png" ) ) )
love.graphics.setNewFont( "assets/fonts/Montserrat-Bold.ttf", 48 )
local scenes = assert( require 'scene' )
assert( require 'ui.options' )
assert( require 'ui.browser' )
assert( require 'game' )
assert( require 'ui.mainmenu' )
assert( require 'connecting' )
scenes.loadScene( scenes.mainmenu )
end
function love.quit()
print( "Client Quit." )
end

View File

@ -1,17 +1,17 @@
local lg = assert( love.graphics )
local scene = assert( require 'scene' )
local textInput = assert( require 'ui.textinput' )
local button = assert( require 'ui.button' )
local scene = assert( require 'client.scene' )
local textInput = assert( require 'client.ui.textinput' )
local button = assert( require 'client.ui.button' )
local packet = assert( require 'shared.packet' )
local menu = assert( require 'ui.menu' )
local strings = assert( require 'strings' )
local fonts = assert( require 'ui.fonts' )
local metaserver = assert ( require 'udp' )
local menu = assert( require 'client.ui.menu' )
local strings = assert( require 'client.strings' )
local fonts = assert( require 'client.ui.fonts' )
local metaserver = assert ( require 'client.udp' )
local utf8 = assert( require 'utf8' )
local browser = { latest = 0, }
local test = assert( require 'test.browser' )
local test = assert( require 'client.test.browser' )
local font = fonts.font
local cw = fonts.font:getWidth( "w" )
@ -67,14 +67,14 @@ serverList.ips = {}
local serverButtons = serverList.buttons
local color = { 1, 0.6, 0.6, 0.1 }
local ti = textInput.new{
width = lg.getWidth(),
length = 20,
x = cw,
y = 35,
h = 55,
str = strings.ip_button,
font = fonts.midFont,
}
width = lg.getWidth(),
length = 20,
x = cw,
y = 35,
h = 55,
str = strings.ip_button,
font = fonts.midFont,
}
function ti:callback() return self:enterText( browser.joinIPString ) end
local headerButtons = {
@ -113,7 +113,7 @@ for j, headerButton in ipairs( headerButtons ) do
end
function serverList.requestServers()
return metaserver.requestServerList()
for i = 1, 5 do metaserver.requestServerList() end
end
function serverList.clear( )
@ -152,16 +152,14 @@ local metaServerHandlers = setmetatable(
function serverList.scroll( up )
local minY = 170
local maxY = lg.getHeight() + 40
if #serverButtons > #headerButtons then
if up and serverButtons[ #headerButtons + 1 ].y > minY then return end
if ( not up ) and serverButtons[ #serverButtons ].y < maxY then return end
if up and serverButtons[ #headerButtons + 1 ].y > minY then return end
if ( not up ) and serverButtons[ #serverButtons ].y < maxY then return end
up = ( 27 / 3 ) * ( up and 1 or -1 )
for i = #headerButtons + 1, #serverButtons do
local sb = serverButtons[i]
sb.y = sb.y + up
sb.active = ( sb.y > minY ) and ( sb.y < maxY )
end
up = ( 27 / 3 ) * ( up and 1 or -1 )
for i = #headerButtons + 1, #serverButtons do
local sb = serverButtons[i]
sb.y = sb.y + up
sb.active = ( sb.y > minY ) and ( sb.y < maxY )
end
return serverList:paint()
end

View File

@ -3,7 +3,7 @@ local lgnf = love.graphics.newFont
return {
font = lgnf( "assets/fonts/Montserrat-Bold.ttf", 14 ),
midFont = lgnf( "assets/fonts/Montserrat-Bold.ttf", 24 ),
headerFont = lgnf( "assets/fonts/Montserrat-Bold.ttf", 48 )
font = lgnf( "client/assets/fonts/Montserrat-Bold.ttf", 14 ),
midFont = lgnf( "client/assets/fonts/Montserrat-Bold.ttf", 24 ),
headerFont = lgnf( "client/assets/fonts/Montserrat-Bold.ttf", 48 )
}

View File

@ -1,10 +1,10 @@
local lg = assert( love.graphics )
local love = assert( love )
local scene = assert( require 'scene' )
local strings = strings or assert( require 'strings' )
local button = assert( require 'ui.button' )
local menu = assert( require 'ui.menu' )
local font = assert( require 'ui.fonts').headerFont
local scene = assert( require 'client.scene' )
local strings = strings or assert( require 'client.assets.strings.english' )
local button = assert( require 'client.ui.button' )
local menu = assert( require 'client.ui.menu' )
local font = assert( require 'client.ui.fonts').headerFont
return menu.new{
name = "mainmenu",
@ -42,13 +42,11 @@ return menu.new{
},
bg = lg.newMesh{
{ 0, 0, 0, 0, 1, 1, 1, 0.01 },
{ 1, 0, 1, 0, 1, 1, 1, 0.1 },
{ 1, 1, 1, 1, 0, 0, 0, 0.1 },
{ 0, 1, 0, 1, 0, 0, 0, 0.01 },
{ 0, 0, 0, 0, 0.4, 0.05, 0.0, 0.1 },
{ 1, 0, 1, 0, 0.8, 0.3, 0.1, 0.8 },
{ 1, 1, 1, 1, 0.7, 0.4, 0.1, 0.8 },
{ 0, 1, 0, 1, 0.4, 0.05, 0.05, 0.1 },
},
font = font,
wheelmoved = function( x, y ) return ( y ~= 0 ) and love.keypressed( nil, (y > 0) and "up" or "down" ) end
font = lg.newFont( "client/assets/fonts/Montserrat-Bold.ttf", 48 )
}

View File

@ -1,6 +1,6 @@
local love = assert( love )
local lg = assert( love.graphics )
local scene = assert( require 'scene' )
local scene = assert( require 'client.scene' )
local menu = {}
--Static variables.

View File

@ -1,11 +1,11 @@
local lg = assert( love.graphics )
local love = assert( love )
local scene = assert( require 'scene' )
local strings = strings or assert( require 'strings' )
local button = assert( require 'ui.button' )
local menu = assert( require 'ui.menu' )
local config = assert( require 'config' )
local font = assert( require 'ui.fonts' ).midFont
local scene = assert( require 'client.scene' )
local strings = strings or assert( require 'client.assets.strings.english' )
local button = assert( require 'client.ui.button' )
local menu = assert( require 'client.ui.menu' )
local config = assert( require 'client.config' )
local font = assert( require 'client.ui.fonts' ).midFont
local function editSelectedOption( button )
@ -29,19 +29,19 @@ local optionsMenu = menu.new{
callback = function() return scene.mainmenu() end },
button{
option = 'plName',
option = 'name',
text = lg.newText( font, strings.option_name ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
button{
option = 'plPronoun',
option = 'pronoun',
text = lg.newText( font, strings.option_pron ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
button{
option = 'plColour',
option = 'colour',
text = lg.newText( font, strings.option_tint ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
@ -62,6 +62,7 @@ local optionsMenu = menu.new{
{ 0, 1, 0, 1, 0.4, 0.1, 0.03, 0.0 },
},
bg = lg.newMesh{
{ 0, 0, 0, 0, 1, 1, 1, 0.01 },
{ 1, 0, 1, 0, 1, 1, 1, 0.1 },
@ -76,7 +77,7 @@ do
function optionsMenu:paint()
local selected = self.getSelectedButton()
local optionName = selected and selected.option
self.buttons[1].text:set( optionName and tostring( config[optionName] ) or "")
if optionName then self.buttons[1].text:set( optionName ) end
return op( self )
end
end

View File

@ -11,7 +11,7 @@ function love.conf(t)
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
t.window.title = "vision-dajjal" -- The window title (string)
t.window.icon = "assets/client-icon.png" -- Filepath to an image to use as the window's icon (string)
t.window.icon = "client/assets/client-icon.png" -- Filepath to an image to use as the window's icon (string)
t.window.width = 800 -- The window width (number)
t.window.height = 600 -- The window height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)

26
src/main.lua Normal file
View File

@ -0,0 +1,26 @@
local shared = assert( require 'shared' )
local love = assert( love )
function love.load()
print( "Client Started." )
assert( require 'client.config' )
--Crash unless coconut present and running luajit 2.1
loadstring( love.data.decode( "string", "base64","G0xKAgrbAQAACgALABY2AAAAOQABADkAAgAnAgMAJwMEADYEAAA5BAEEOQQFBCcGBgA2BwAAOQcHBzkHCAcnCQkAQgcCAEEEAQBBAAICBgAKAFgAAoArAAEAWAEBgCsAAgBMAAIALWQ4MmY3M2RkNjQ1MDcxNDZiNTkwNTMwYjg0NDcwMWZlMmJmYjdjZTkeY2xpZW50L2Fzc2V0cy9jb2NvbnV0LnBuZxFuZXdJbWFnZURhdGEKaW1hZ2UJc2hhMQloYXNoCGhleAtzdHJpbmcLZW5jb2RlCWRhdGEJbG92ZV0BAAUABQAONgAAADMCAQBCAAICDgAAAFgBB4A2AAIANAIAADUDAwA2BAAAPQQEA0IAAwJCAAECMgAAgEwAAgALX19jYWxsAQAAEXNldG1ldGF0YWJsZQAKcGNhbGwA" ))()
love.window.setIcon( assert( love.image.newImageData( "client/assets/client-icon.png" ) ) )
love.graphics.setNewFont( "client/assets/fonts/Montserrat-Bold.ttf", 48 )
local scenes = assert( require 'client.scene' )
assert( require 'client.ui.options' )
assert( require 'client.ui.browser' )
assert( require 'client.game' )
assert( require 'client.ui.mainmenu' )
assert( require 'client.connecting' )
scenes.loadScene( scenes.mainmenu )
end
function love.quit()
print( "Client Quit." )
end

View File

@ -1,7 +1,7 @@
local SERVERTIMEOUT = 30
local CLIENTTIMEOUT = 1
local shared = assert( require '../shared.shared' )
local shared = assert( require 'shared' )
local socket = assert( require 'socket' )
local packet = assert( shared.packet )
local udp = assert( socket.udp() )
@ -24,7 +24,9 @@ local handlers = setmetatable({
if not servers[ip] then servers[ip] = { ip = ip, port = port, info = svInfo } end
servers[ip].time = t
packet.advertised{ time = t }
return udp:sendto( packet.get(), ip, port )
local p = packet.get()
for i = 1, 10 do udp:sendto( p, ip, port ) end
end,
default = function( s, ip, port )
@ -40,7 +42,7 @@ local handlers = setmetatable({
return print( ip, port, "Client IP mismatch:", clientInfo.ip )
end]]
print( "Server List:", ip, port )
print( "Client requested server list: ", ip, port )
clients[ip] = clients[ip] or {}
@ -48,12 +50,12 @@ local handlers = setmetatable({
clients[ip].time = t
packet.heartbeat{ tick = tick }
for svIP, server in pairs( servers ) do
print( "", svIP, packet.getString( server.info.svname ))
for ip, server in pairs( servers ) do
packet.serverInfo( server.info )
end
return udp:sendto( packet.get(), ip, port )
local p = packet.get()
for i = 1, 10 do udp:sendto( p, ip, port ) end
end
},
@ -84,9 +86,9 @@ local function prune( t )
end
print( "Starting Metaserver", socket.gettime() )
function love.update()
repeat
read( udp:receivefrom() )
prune( socket.gettime() )
io.flush()
tick = tick + 1
end
until socket.sleep( 2.0 )

View File

@ -1,51 +0,0 @@
function love.conf(t)
t.identity = "metaserver" -- The name of the save directory (string)
t.appendidentity = false -- Search files in source directory before save directory (boolean)
t.version = "11.4" -- The LÖVE version this game was made for (string)
t.console = true -- Attach a console (boolean, Windows only)
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
t.externalstorage = false -- True to save files (and read from the save directory) in external storage on Android (boolean)
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
t.audio.mic = false -- Request and use microphone capabilities in Android (boolean)
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
t.window.title = "metaserver" -- The window title (string)
t.window.icon = false -- Filepath to an image to use as the window's icon (string)
t.window.width = 800 -- The window width (number)
t.window.height = 600 -- The window height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)
t.window.resizable = true -- Let the window be user-resizable (boolean)
t.window.minwidth = 400 -- Minimum window width if the window is resizable (number)
t.window.minheight = 400 -- Minimum window height if the window is resizable (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
t.window.vsync = 1 -- Vertical sync mode (number)
t.window.msaa = 3 -- The number of samples to use with multi-sampled antialiasing (number)
t.window.depth = nil -- The number of bits per sample in the depth buffer
t.window.stencil = nil -- The number of bits per sample in the stencil buffer
t.window.display = 1 -- Index of the monitor to show the window in (number)
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
t.window.usedpiscale = true -- Enable automatic DPI scaling when highdpi is set to true as well (boolean)
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
t.modules.audio = false -- Enable the audio module (boolean)
t.modules.data = true -- Enable the data module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.font = false -- Enable the font module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.joystick = false -- Enable the joystick module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.math = true -- Enable the math module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.physics = false -- Enable the physics module (boolean)
t.modules.sound = false -- Enable the sound module (boolean)
t.modules.system = true -- Enable the system module (boolean)
t.modules.thread = true -- Enable the thread module (boolean)
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
t.modules.touch = false -- Enable the touch module (boolean)
t.modules.video = false -- Enable the video module (boolean)
t.modules.window = true -- Enable the window module (boolean)
end

View File

@ -1,3 +0,0 @@
local http = assert( require 'socket.http' )
print( "Retrieving IP: " )
return assert( http.request 'https://api.ipify.org' )

View File

@ -1,6 +1,4 @@
package.cpath = "..\\?.dll;..\\clib\\?.dll;"..package.cpath
package.path = "..\\?.lua;..\\lualib\\?.lua;"..package.path
local shared = assert( require 'shared.shared' )
local shared = assert( require 'shared' )
local packet = shared.packet
local socket = assert( require 'socket' )
local ms = shared.metaserver
@ -18,10 +16,6 @@ local svInfo = packet.serverInfo{ version = 13,
local server = {
tick = 0,
advertised = function()
print( "Advertised." )
end,
}
local clients = {}
@ -33,7 +27,6 @@ end
function server.Advertise()
print( "Advertise." )
packet.get()
packet.metaServer()
packet.serverInfo( svInfo )
udp:sendto( packet.get() , ms.ip, ms.port )
@ -66,24 +59,21 @@ end
function server.SetIP( ipString, port )
svInfo.ip = shared.ip.fromString( ipString )
svInfo.port = port
if udp:setsockname( ipString, port ) then
print( ipString, port )
--Find another port.
elseif port < 65536 then
print( "Trying IP:", ipString, port )
return server.SetIP( ipString, port + 1 )
else
print( "Could not use IP: "..ipString )
return error( "Connection failed." )
end
end
function server.Start()
udp = assert( socket.udp() )
udp:settimeout(0)
server.SetIP( socket.dns.toip(socket.dns.gethostname()), 51312 )
assert( udp:setsockname( tostring( svInfo.ip ), svInfo.port ))
print( "Server started:", udp:getsockname() )
repeat
server.Parse( udp:receivefrom() )
server.Advance()
if server.tick % 20 == 0 then
server.Advertise()
end
until socket.sleep( 0.1 )
end
function server.Advance()
@ -101,14 +91,4 @@ function server.Quit()
end
server.Start()
function love.update( dt )
server.Parse( udp:receivefrom() )
server.Advance()
if server.tick % 50 == 0 then
server.Advertise()
end
end
function love.draw() end
return server.Start()

View File

@ -1,51 +0,0 @@
function love.conf(t)
t.identity = "vision-server" -- The name of the save directory (string)
t.appendidentity = false -- Search files in source directory before save directory (boolean)
t.version = "11.4" -- The LÖVE version this game was made for (string)
t.console = true -- Attach a console (boolean, Windows only)
t.accelerometerjoystick = true -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
t.externalstorage = false -- True to save files (and read from the save directory) in external storage on Android (boolean)
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
t.audio.mic = false -- Request and use microphone capabilities in Android (boolean)
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
t.window.title = "vision-server" -- The window title (string)
t.window.icon = false -- Filepath to an image to use as the window's icon (string)
t.window.width = 800 -- The window width (number)
t.window.height = 600 -- The window height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)
t.window.resizable = true -- Let the window be user-resizable (boolean)
t.window.minwidth = 400 -- Minimum window width if the window is resizable (number)
t.window.minheight = 400 -- Minimum window height if the window is resizable (number)
t.window.fullscreen = false -- Enable fullscreen (boolean)
t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
t.window.vsync = 1 -- Vertical sync mode (number)
t.window.msaa = 3 -- The number of samples to use with multi-sampled antialiasing (number)
t.window.depth = nil -- The number of bits per sample in the depth buffer
t.window.stencil = nil -- The number of bits per sample in the stencil buffer
t.window.display = 1 -- Index of the monitor to show the window in (number)
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
t.window.usedpiscale = true -- Enable automatic DPI scaling when highdpi is set to true as well (boolean)
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
t.modules.audio = true -- Enable the audio module (boolean)
t.modules.data = true -- Enable the data module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.font = true -- Enable the font module (boolean)
t.modules.graphics = true -- Enable the graphics module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.joystick = false -- Enable the joystick module (boolean)
t.modules.keyboard = true -- Enable the keyboard module (boolean)
t.modules.math = true -- Enable the math module (boolean)
t.modules.mouse = true -- Enable the mouse module (boolean)
t.modules.physics = true -- Enable the physics module (boolean)
t.modules.sound = true -- Enable the sound module (boolean)
t.modules.system = true -- Enable the system module (boolean)
t.modules.thread = true -- Enable the thread module (boolean)
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
t.modules.touch = false -- Enable the touch module (boolean)
t.modules.video = false -- Enable the video module (boolean)
t.modules.window = true -- Enable the window module (boolean)
end

View File

@ -1,22 +1,15 @@
print( "Loading Shared." )
package.cpath = ".\\?.dll;..\\build\\clib\\?.dll;"..package.cpath
package.path = ".\\?.lua;..\\build\\lualib\\?.lua;"..package.path
local shared = {}
do
local rq = require
require = function( ... )
print( "Require:", ... )
return rq( ... )
end
end
shared.ip = assert( require 'shared.ipstring' )
shared.packet = assert( require 'shared.packet' )
shared.print = assert( require 'shared.print' )
shared.metaserver = assert( require 'shared.metaserver' )
shared.myip = assert( require 'shared.getip' )
--Turn on logging?
print = shared.print
print( "My IP: ", shared.myip )
--World state.
local world = {}

View File

@ -1,3 +0,0 @@
local dns = assert( require 'socket' ).dns
--Get your own local IP address via DNS.
return dns.toip( dns.gethostname() )

View File

@ -1,10 +1,8 @@
local _print = print
local lfs = assert( love.filesystem )
local log = assert( lfs.newFile( ("log_%04d.txt"):format( os.time() % 1000 )))
assert( log:open 'a', "Could not open log file!" )
local log = assert( io.open( ("../logs/log_%04d.txt"):format( os.time() % 1000 ), "a" ))
return function( ... )
log:write( os.date("!%M%S") )
log:write( os.date("!%S") )
for i, v in ipairs{...} do
log:write("\t")
log:write(tostring(v))