aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/client/data/init.lua68
-rw-r--r--bin/server/data/.gitignore1
-rw-r--r--bin/server/data/init.lua16
3 files changed, 31 insertions, 54 deletions
diff --git a/bin/client/data/init.lua b/bin/client/data/init.lua
index 8829e01..e893fa4 100644
--- a/bin/client/data/init.lua
+++ b/bin/client/data/init.lua
@@ -1,57 +1,19 @@
+print([[
+Welcome to Brok[en]gine!
-dofile("../data/mahjong.lua")
+This file is located at bin/client/data/init.lua,
+it is the first file run after brokengine starts.
+Modify it to make your game.
-do return end
-print("Phys was:",phys)
-for k,v in pairs(phys) do
- print(k,":",v)
-end
-local cam = scene.newcamera()
---local cam_m = getmetatable(cam)
---print("cam's meta table is ",cam_m)
+Before brokengine starts, there's another file
+located at bin/client/data/deviceinit.lua, which
+is a settings file for the window, and does not
+have access to a lot of the functions that
+brokengine provides. If your game is crashing
+right away, check for errors in that file.
---for k,v in pairs(cam_m["__index"]) do
--- print(k,":",v)
---end
+For more information about the functions
+avaliable in brokengine, run `ldoc .`, and look
+at index.html in the doc/ folder.
+]])
---print("attempting to create the first physbox")
-local cambox = phys.newcphysbox({1,1,1},{0,0,0},1)
---print("function is",phys.newphysbox);
---print("attempting to create the second physbox")
-local floor = phys.newcphysbox({10,1,10},{0,-10,0},0)
-local floor_light = scene.newlight(1000,{0,-5,0})
---print("created cam box")
-print("cambox_m is:")
-local cambox_m = getmetatable(cambox);
-for k,v in pairs(cambox_m["__index"]) do
- print(k,":",v)
-end
-print("cambox is:")
-for k,v in pairs(cambox) do
- print(k,":",v)
-end
-floor:setcpos({0,5,0})
-
-print("floor is:")
-local floor_m = getmetatable(floor);
-for k,v in pairs(floor_m["__index"]) do
- print(k,":",v)
-end
---print("gui is:")
---for k,v in pairs(gui) do
- --print(k,":",v)
---end
---local checkbox = gui.newcheckbox({0,0},{100,100},0,"test");
---floor_light:getpos()
---GAME.tick = function()
- --print("In game tick")
- --cam:setpos(cambox:getpos())
---end
-GAME.onKeyDown = function(key,down,ctrl,shft)
- if(down and key == 65) then -- a
- print("Setting box's position")
- cambox:setcpos({0,5,0})
- print("After setpos was called")
- end
- print("Got key input:",key,down,ctrl,shft)
-end
diff --git a/bin/server/data/.gitignore b/bin/server/data/.gitignore
index e69de29..d907c43 100644
--- a/bin/server/data/.gitignore
+++ b/bin/server/data/.gitignore
@@ -0,0 +1 @@
+*.lua
diff --git a/bin/server/data/init.lua b/bin/server/data/init.lua
index b6ab2f6..20b15e9 100644
--- a/bin/server/data/init.lua
+++ b/bin/server/data/init.lua
@@ -1 +1,15 @@
-print("Brok[en]gine server lua file init.lua")
+print("Hello from server!")
+
+
+xpcall(function()
+ local socket = net.newsocket(net.REP)
+ socket:bind("tcp://127.0.0.1:5555")
+ socket:receive(function(stream)
+ print("Server got message:", stream:readstring())
+ end)
+end,function(err)
+ print("Error:",err)
+ print(debug.traceback())
+end)
+
+print("Socket is bound")