Gideros Unite

About Gideros Unite

Type: Framework
License: BSD License
Supported platforms:

       

Categories:
  • Networking

Gideros Unite framework provides a way to implement Multiplayer games using Gideros Mobile. It uses LuaSocket to establish socket connections and even create server/client instances.

It provides the means of device discovery in Local Area Network, and allows to call methods of other devices through network

About protocols, it is possible to use tcp, udp or both (by binding some method to tcp, if reliability is needed, and others to udp for faster data processing)

Package contains Unite.lua and example Gideros application project - DrawTogether app.

Code example:

--we can get all devices that are connected to our network
local devices = {}
serverlink:addEventListener('device', function(e)
    print(e.data.id, e.data.ip, e.data.host)
    devices[e.data.id] = {}
    devices[e.data.id].ip = e.data.ip
    devices[e.data.id].name = e.data.host
end)
     
serverlink:getDevices()
     
     
--add some methods, that could be called by other clients or server through network
--draw something
serverlink:addMethod('draw', self.drawLine, self)
--end drawing
serverlink:addMethod('end', self.stopDrawing, self)
--clear drawing
serverlink:addMethod('clear', self.reset, self)
 
 
--then you can call this methods when needed
serverlink:callMethod('clear')
serverlink:callMethod('draw', someX, someY)
 
 
--or call method of specific device using it's id
serverlink:callMethodOf('clear', 112233)
serverlink:callMethodOf('draw', someX, someY, 112233)
 
 
--and when game is finished
serverlink:close()
 
 
--and that's all
				

Gideros Unite video