So we’re at the stage in development where we are testing the game services. But we noticed that after we had signed in using Google Play Services, we had a pretty bad FPS drop. We’ve been looking at the code and so far everything matches up to what has been suggested in the tutorials. The code is being placed in the main.lua class. Our game and optimized fairly well. Running at 1.67 Physical, and 57.1 Texture. The client runs smooth as butter when game services is not implemented in the code. I have seen others have this problem in other posts, but I’ve also seen games run great using Google. Does anyone have an idea of whats going on? I’ll post the code we have so far below. This is located in our main.
local gameNetwork = require( "gameNetwork" ) local playerName local function loadLocalPlayerCallback( event ) playerName = event.data.alias --saveSettings() --save player data locally using your own "saveSettings()" function end local function gameNetworkLoginCallback( event ) gameNetwork.request( "loadLocalPlayer", { listener=loadLocalPlayerCallback } ) return true end local function gpgsInitCallback( event ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) end local function gameNetworkSetup() if ( system.getInfo("platformName") == "Android" ) then gameNetwork.init( "google", gpgsInitCallback ) --print("logged!!!") else gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end ------HANDLE SYSTEM EVENTS------ local function systemEvents( event ) print("systemEvent " .. event.type) if ( event.type == "applicationSuspend" ) then print( "suspending..........................." ) elseif ( event.type == "applicationResume" ) then print( "resuming............................." ) elseif ( event.type == "applicationExit" ) then print( "exiting.............................." ) elseif ( event.type == "applicationStart" ) then gameNetworkSetup() --login to the network here end return true end Runtime:addEventListener( "system", systemEvents )
The lag occurs when the sign-in for Google is implemented. So if you cancel the sign in, it occurs. When you sign in, it occurs. I’ve also tried putting it into another class other than the main, and still lags. The code does work though. We are able to use our game services like achievements and leader board. Just there is a huge FPS problem that is breaking the game.
Thanks for reading.