Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite analytics recording #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mildmojo
Copy link
Contributor

@mildmojo mildmojo commented Mar 3, 2015

This change adds stats recording to a local SQLite database.

Status

This is the version currently installed on the Lexitron for the Louisville Arcade Expo, Lexington Comic and Toy Convention, and the Danville Arts Center gallery installation.

I haven't merged this into master yet because it currently blows up if you don't have the SQLite binary in your PATH or alongside the moonshot binary. Looking for a solution there.

Data Recorded

DB Event Name Description
boot Launcher process began
moonshot_start ROM Check screen completed
game_start Game launched with LEX button
game_end Game process exited
game_error Error launching game (nonzero exit statuses not yet detected)
attract_start Launcher became idle, rotating through game cards
attract_end Player touched the controls, disabling attract mode
coin Coin inserted with no game active

Implementation

The stats module uses SQLite via the command-line executable because I couldn't find a good native JS library for Windows. They either needed to compile a binary against SQLite libs (using MSVC++ or somesuch) or operated entirely in memory, requiring periodic dumps to disk (yuck). The command-line sqlite3 executable needs to be available on the system PATH or copied to the same directory as the moonshot executable.

DB Schema

Table name: stats

Column Type Description
id Integer Autonumber primary key
event_at DATETIME Event timestamp
event TEXT Event name as listed in table above
game TEXT Game slug if applicable (e.g. 'compromised')
notes TEXT Other annotations (e.g. error message for game_error or elapsed time for game_end)

Notes

This updates the Moonshot version number from 0.1.0 to 1.0.0 because swagger.

This also updates the project for NW.js, which is based on node v0.11-0.12. The project now uses some child_process APIs that are specific to v0.11+. Sorry to combine all the font changes in here; they're needed for the new NW.js.

This doesn't include any UI or tools for getting data back out of the DB. That would be a good first secret code, no? 💃

Logs boot, shutdown, game starts, game stops, attract mode start/stop,
and coin drops while at the launcher. Stores it all in an SQLite DB
for later analysis.
Not sure why slides were appearing off center after my other changes,
but scaling them down a bit seems to fix the problem.
Attract mode wasn't engaging at boot. Adds a `setAttractMode` call
when the ROM Check screen finishes to start the attract mode inactivity
timer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant