Server side game creation

While you generally will offer the option to the player on creating or joining games, you can also automate it on the server-side like so:

[lua]–== Server-side

local function onClientConnect( client )
    p( ‘–== Client Connected ==–’ )

    local game_count = gs:getGameCount( { game_state = ‘open’ } )
    if game_count == 0 then
        --== We need a new game
        gs:createGame( client, 2 )
    else
        --== Add to game queue
        gs:addToGameQueue( client, 2 )
    end
    
end

gs:on( “ClientConnect”, onClientConnect )[/lua]

Cheers.