We take a closer look at the Battledash, the ingame version of Battlelog and how Javascript has it's place inside a modern game. We also look at the tools used during day to day developement.
→ Minimizes changes needed to be sent to browser → Reduced layout trashing / reflows → There is no template language (WTF?) → Structures everything as components → Talks a lot about 60 FPS on non-JIT devices → Easy to optimize
game engine → Allows for event listening → Dash opened / closed → New multiplayer round started → Job complete (video, audio etc) → Provides async API → Play video → Fetch stats → Join game
per language → Great support in Webpack → Translated when compiled/packaged → Reduces size → Less overhead → Dynamic translations → Increases bundle size
→ Chrome dev tools → Webpack for packing and bundling → Grunt for tasks → Development done using fixtures → Ensure each developer uses same data → Easy on-boarding and easy test running
commit → Developer is notified if build fails → Style checks → JSHint for JavaScript best practices → JSCS for code style (no debate, tool decides) → Unit tests → Tests small contained behaviour of functions → Can also test rendered React components → Runs headless inside PhantomJs with jsdom → End-to-end tests → Test user behavior from a high level perspective → Navigate between tabs and checks for broken images and console errors → Runs in real desktop Chrome browser
Two examples → Switch between tabs as fast as possible → Scroll in lists as fast as possible → Stores result for each build → See what build that caused a performance degradation → Possible to see trend over time → Manual tests to trigger performance issues with WebKit inside game
→ Feature flags → Switch features on and off → Rollout → Test a new build on a subset of user base → Target an entire platform → Send debug builds to certain people