Top Banner
Game Programming Development Tools Nick Prühs
45

Game Programming 05 - Development Tools

Jun 24, 2015

Download

Technology

Nick Prühs

Chapter 5 of the lecture Game Programming taught at HAW Hamburg.

Introduction to continuous integration, API documentation generation, analytics, static code analysis and crash dump analysis.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Game Programming 05 - Development Tools

Game ProgrammingDevelopment Tools

Nick Prühs

Page 2: Game Programming 05 - Development Tools

Objectives

• To understand the importance of improved workflows

• To get an idea of which kinds of useful tools are out there

• To learn how to integrate tools into your daily workflow

2 / 43

Page 3: Game Programming 05 - Development Tools

Automated Builds

• Allow you to create nightly releases of your current game version

• Automate any pre- and post-build steps required for creating new builds

• Track build successes and failures and their reasons

• Provide access to previous builds (history)

• Can parameterize build input and output

3 / 43

Page 4: Game Programming 05 - Development Tools

Automated Builds

4 / 43

Jenkins CI – Slash Games

Page 5: Game Programming 05 - Development Tools

Automated Builds

5 / 43

Jenkins CI – Project Page

Page 6: Game Programming 05 - Development Tools

Typical Build Steps

• Accessing source control• Syncing working copy

• Creating tags

• Writing version numbers

• Performing the actual build

• Packaging the build result

• Publishing the game on a build page

• Running unit tests

• Sending email notifications

6 / 43

Page 7: Game Programming 05 - Development Tools

Automated Builds

7 / 43

Jenkins CI – Project Configuration

Page 8: Game Programming 05 - Development Tools

Automated Builds

8 / 43

Jenkins CI – Build Result

Page 9: Game Programming 05 - Development Tools

API Documentation

• Can be automatically generated from properly formatted source code comments

• Output format may vary (usually HTML)

• Tools are available for all major object-oriented languages (Javadoc, Sandcastle, Doxygen)

9 / 43

Page 10: Game Programming 05 - Development Tools

Javadoc

10 / 43

Javadoc Comments

Page 11: Game Programming 05 - Development Tools

Javadoc

11 / 43

Javadoc – Invoked From Command Line

javadoc -d api -sourcepath src -subpackages com.example.project

Page 12: Game Programming 05 - Development Tools

Javadoc

12 / 43

Javadoc API Documentation

Page 13: Game Programming 05 - Development Tools

Sandcastle

13 / 43

XML Documentation Comments

Page 14: Game Programming 05 - Development Tools

Sandcastle

14 / 43

Sandcastle Help File Builder GUI

Page 15: Game Programming 05 - Development Tools

Sandcastle

15 / 43

MSDN-Style API Documentation

Page 16: Game Programming 05 - Development Tools

Doxygen

16 / 43

Doxygen Comment Blocks

Page 17: Game Programming 05 - Development Tools

Doxygen

17 / 43

Doxygen GUI Frontend

Page 18: Game Programming 05 - Development Tools

Doxygen

18 / 43

Doxygen API Documentation

Page 19: Game Programming 05 - Development Tools

Analytics in Games

• Track the origin, device and operation system of your players

• Track user engagement• Retention

• A/B testing

• Track monetization success

• Track performance• Framerate

• Crashes

19 / 43

Page 20: Game Programming 05 - Development Tools

Analytics in Games

• Involve many key questions• What to track

• How to track (who, what, where, when)

• How to analyze data

• Enough material for a whole different course

20 / 43

Page 21: Game Programming 05 - Development Tools

Analytics in Games

21 / 43

Game Analytics Website

Page 22: Game Programming 05 - Development Tools

Analytics in Games

22 / 43

Game Analytics API Call

private void OnVictory(Event e){var victoryData = (VictoryEventData)e.EventData;var eventKey = string.Format("Level:Victory:{0}:{1}", this.currentLevel, victoryData.Type);

GA.API.Design.NewEvent(eventKey);}

Page 23: Game Programming 05 - Development Tools

Analytics in Games

23 / 43

Game Analytics Metrics

Page 24: Game Programming 05 - Development Tools

Analytics in Games

24 / 43

Game Analytics Funnel

Page 25: Game Programming 05 - Development Tools

Consistent Code Style

• StyleCop analyzes C# source code to enforce a set of style and consistency rules

• Helps developers avoid common pitfalls and mistakes

• Settings file can be checked in to version control

25 / 43

Page 26: Game Programming 05 - Development Tools

Consistent Code Style

StyleCop Settings Dialog in Visual Studio 2012 26 / 43

Page 27: Game Programming 05 - Development Tools

Consistent Code Style

Part of a StyleCop Settings File

<StyleCopSettings Version="105"><GlobalSettings>

<StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty><CollectionProperty Name="RecognizedWords">

<Value>Bresenham</Value><Value>Dijkstra</Value><Value>Endre</Value>

<Value>Fredman</Value><Value>multigraph</Value>

<Value>Stee</Value><Value>Tarjan</Value><Value>Tarjan's</Value>

<Value>unweighted</Value></CollectionProperty></GlobalSettings><Analyzers>

<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"><Rules><Rule Name="DocumentationTextMustContainWhitespace">

<RuleSettings><BooleanProperty Name="Enabled">False</BooleanProperty>

</RuleSettings></Rule><Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">

<RuleSettings><BooleanProperty Name="Enabled">False</BooleanProperty>

</RuleSettings></Rule>

27 / 43

Page 28: Game Programming 05 - Development Tools

Consistent Code Style

StyleCop Warnings in Visual Studio 2012 28 / 43

Page 29: Game Programming 05 - Development Tools

Static Code Analysis

• ReSharper provides static code analysis

• Many, many shortcuts and quick fixes

• Improved refactoring

• Improved search features

• Code templates

29 / 43

Page 30: Game Programming 05 - Development Tools

Static Code Analysis

R# Static Code Analysis in Visual Studio 2012

30 / 43

Page 31: Game Programming 05 - Development Tools

Static Code Analysis

R# Suggestions in Visual Studio 2012

31 / 43

Page 32: Game Programming 05 - Development Tools

Static Code Analysis

R# Suggestions in Visual Studio 2012

32 / 43

Page 33: Game Programming 05 - Development Tools

Static Code Analysis

R# Suggestions in Visual Studio 2012

33 / 43

Page 34: Game Programming 05 - Development Tools

Eclipse

Eclipse Java Code Style Clean Up Settings

34 / 43

Page 35: Game Programming 05 - Development Tools

Eclipse

Eclipse Java Code Style Clean Up Settings

35 / 43

Page 36: Game Programming 05 - Development Tools

Hint

Setting up tools will always take the same time.

Thus, the earlier you set up your tools, the greater your benefit!

36 / 43

Page 37: Game Programming 05 - Development Tools

Crash Dump Analaysis

• Sadly, even released games and tools will sometimes crash

• Windows can automatically generate a minidumpwhenever a program throws an unhandled exception• Loaded modules

• Thread information

• Current call stack

• These can be loaded and debugged in Visual Studio

37 / 43

Page 38: Game Programming 05 - Development Tools

Crash Dump Analaysis

38 / 43

C:\Program Files\Procdump>procdump.exe -ma -i D:\Temp\Dumps

ProcDump v7.0 - Writes process dump files

Copyright (C) 2009-2014 Mark Russinovich

Sysinternals - www.sysinternals.com

With contributions from Andrew Richards

Set to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug

(REG_SZ) Auto = 1

(REG_SZ) Debugger = "C:\Program Files\Procdump\procdump.exe" -accepteula -ma

-j "D:\Temp\Dumps" %ld %ld %p

Set to:

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug

(REG_SZ) Auto = 1

(REG_SZ) Debugger = "C:\Program Files\Procdump\procdump.exe" -accepteula -ma

-j "D:\Temp\Dumps" %ld %ld %p

ProcDump is now set as the Just-in-time (AeDebug) debugger.

Page 39: Game Programming 05 - Development Tools

Crash Dump Analaysis

39 / 43

C:\Program Files\Procdump>procdump.exe -u

ProcDump v7.0 - Writes process dump files

Copyright (C) 2009-2014 Mark Russinovich

Sysinternals - www.sysinternals.com

With contributions from Andrew Richards

Reset to:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug

(REG_SZ) Auto = <deleted>

(REG_SZ) Debugger = "C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld

Reset to:

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug

(REG_SZ) Auto = <deleted>

(REG_SZ) Debugger = "C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld

ProcDump is no longer the Just-in-time (AeDebug) debugger.

Page 40: Game Programming 05 - Development Tools

Crash Dump Analaysis

40 / 43

Deferencing a nullptr that will cause a crash

Page 41: Game Programming 05 - Development Tools

Crash Dump Analaysis

41 / 43

Minidump File Summary in Visual Studio

Page 42: Game Programming 05 - Development Tools

Crash Dump Analaysis

42 / 43

Debugging a Minidump in Visual Studio

Page 43: Game Programming 05 - Development Tools

References

• Croy, Bayer, Kawaguchi. Jenkins CI. http://jenkins-ci.org/, April 2015.

• Oracle. Javadoc. http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html., April 2015.

• Woodruff. Sandcastle Help File Builder. http://shfb.codeplex.com/, April 2015.

• Dimitri. Doxygen. http://www.stack.nl/~dimitri/doxygen/, April 2015.

• Drachen, Canossa, El-Nasr. Intro to User Analytics. http://www.gamasutra.com/view/feature/193241/intro_to_user_analytics.php, May 30, 2013.

• GameAnalytics. GameAnalytics. http://www.gameanalytics.com/, April 2015.

• Microsoft. StyleCop. https://stylecop.codeplex.com/, April 2015.

• JetBrains. Resharper. http://www.jetbrains.com/resharper/, April 2015.

• The Eclipse Foundation. Eclipse. https://www.eclipse.org/, April 2015.

• MSDN. Crash Dump Analysis. http://msdn.microsoft.com/en-us/library/windows/desktop/ee416349(v=vs.85).aspx, November 16, 2013.

• MSDN. Collecting User-Mode Dumps. http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx, April 2015.

• Russinovich. ProcDump. http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx, September 11, 2014.

43 / 43

Page 44: Game Programming 05 - Development Tools

Thank you for your attention!

Contact

Mail

[email protected]

Blog

http://www.npruehs.de

Twitter

@npruehs

Github

https://github.com/npruehs

Page 45: Game Programming 05 - Development Tools

5 Minute Review Session

• Which steps can be automated using a build server?

• How can API documentation be generated automatically?

• Which data can be tracked by analytics?

• How can you enforce a consistent code style within your team?

• Which tools can help you to detect code quality issues?

• How can you debug applications that crashed outside of Visual Studio?