Using analytics in your game
As noted previously, Leadwerks 4.2 now support built-in analytics. To enable this in your game you need to create an account at www.gameanalytics.com and create a new product. You can find your keys on the Game Settings page.
At the beginning of the main lua script, some code has been added to initialize analytics. By default this is commented out:
if DEBUG==false then Analytics:SetKeys("GAME_KEY_xxxxxxxxx", "SECRET_KEY_xxxxxxxxx") Analytics:Enable() end
Uncomment this and insert your game's game key into the first argument. Insert your secret key into the second argument.
The main Lua script has already been set up to record a progress event when the player starts your level, and another when they complete it. Below the initial map loading code, a progress event is sent indicating the player has started the level:
--Load a map local mapfile = System:GetProperty("map","Maps/start.map") if Map:Load(mapfile)==false then return end prevmapname = FileSystem:StripAll(changemapname) --Send analytics event Analytics:SendProgressEvent("Start",prevmapname)
When a new map is loaded in the game loop, another event is sent to indicate that the previous level was completed, and the new level is beginning:
--Send analytics event Analytics:SendProgressEvent("Complete",prevmapname) --Load the next map if Map:Load("Maps/"..changemapname..".map")==false then return end prevmapname = changemapname --Send analytics event Analytics:SendProgressEvent("Start",prevmapname))
The FPSPlayer script has a new line of code in the OnDead() function that sends an event indicating the player failed to complete the level:
if type(prevmapname)=="string" then Analytics:SendProgressEvent("Fail",prevmapname) end
Viewing Data
Once your game has accumulated enough data, you can look at your results in the Explore section and clicking on Look up metric. Your progress events will be shown here.
You can even set up a custom funnel in the gameanalytics.com web interface, which will give you a better visualization of player progress through your game.
Interpreting Data
If you see a lot of people starting a level, but few are finishing it, it may indicate your game is too hard, or the objective is not clear. If there is a large number of failed attempts, consider reducing the difficulty. If there is just a lot of starts and no completes, maybe the player is just bored. If you see some trouble spots in your game, try making changes, collect new data, and see if your changes improve the user experience.
Most importantly, you need a good amount of players in order for any analytics data to be useful. A sample size of 20 is statistically significant, and gives you enough information to make decisions. Analytics will give you objective data and help reveal problems you might not otherwise realize, but you need to have a fun game people like playing in order to collect the data in the first place.
MartyJ was a huge help in figuring the implementation of this out.
- 7
14 Comments
Recommended Comments