Hi,
The game timeout is actually a Corona based timer that is reset each time the player state is synced between both clients. So it’s not technically being triggered from the server side.
You could emulate this by setting a timeout of some sort on the state object. I don’t know what your intended use case is, but if you are just wanting to limit the amount of time a player must make a move by you could do something like this:
Server-side
function game.myFunction( params, gameCtx ) --send p1 a 30 sec timeout and p2 no timeout gameCtx:setStateProps("mytimeout", 30000, 0) --swap turn if needed gameCtx:swapTurn() --sync player state gameCtx:gameSync() end function game.onMyTimeout( params, gameCtx ) -- do whatever needs to be done on a timeout end
Client-side
local myTimer local function onGameState() local mytimeout = ace.getStateProp("mytimeout") if mytimeout == 0 then if myTimer then timer.cancel(myTimer) end else myTimer = timer.performWithDelay(mytimeout, function() --call server side timeout ace.game.onMyTimeout() --you probably want to force a player lock here ace.lockPlayer() end) end end --game handler here
This code is just off the top of my head and untested. I will put together a test project and post it a little later today.
Hope that helps.
-dev