Game ProgrammingDevelopment Tools
Nick Prühs
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
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
Automated Builds
4 / 43
Jenkins CI – Slash Games
Automated Builds
5 / 43
Jenkins CI – Project Page
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
Automated Builds
7 / 43
Jenkins CI – Project Configuration
Automated Builds
8 / 43
Jenkins CI – Build Result
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
Javadoc
10 / 43
Javadoc Comments
Javadoc
11 / 43
Javadoc – Invoked From Command Line
javadoc -d api -sourcepath src -subpackages com.example.project
Javadoc
12 / 43
Javadoc API Documentation
Sandcastle
13 / 43
XML Documentation Comments
Sandcastle
14 / 43
Sandcastle Help File Builder GUI
Sandcastle
15 / 43
MSDN-Style API Documentation
Doxygen
16 / 43
Doxygen Comment Blocks
Doxygen
17 / 43
Doxygen GUI Frontend
Doxygen
18 / 43
Doxygen API Documentation
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
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
Analytics in Games
21 / 43
Game Analytics Website
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);}
Analytics in Games
23 / 43
Game Analytics Metrics
Analytics in Games
24 / 43
Game Analytics Funnel
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
Consistent Code Style
StyleCop Settings Dialog in Visual Studio 2012 26 / 43
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
Consistent Code Style
StyleCop Warnings in Visual Studio 2012 28 / 43
Static Code Analysis
• ReSharper provides static code analysis
• Many, many shortcuts and quick fixes
• Improved refactoring
• Improved search features
• Code templates
29 / 43
Static Code Analysis
R# Static Code Analysis in Visual Studio 2012
30 / 43
Static Code Analysis
R# Suggestions in Visual Studio 2012
31 / 43
Static Code Analysis
R# Suggestions in Visual Studio 2012
32 / 43
Static Code Analysis
R# Suggestions in Visual Studio 2012
33 / 43
Eclipse
Eclipse Java Code Style Clean Up Settings
34 / 43
Eclipse
Eclipse Java Code Style Clean Up Settings
35 / 43
Hint
Setting up tools will always take the same time.
Thus, the earlier you set up your tools, the greater your benefit!
36 / 43
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
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.
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.
Crash Dump Analaysis
40 / 43
Deferencing a nullptr that will cause a crash
Crash Dump Analaysis
41 / 43
Minidump File Summary in Visual Studio
Crash Dump Analaysis
42 / 43
Debugging a Minidump in Visual Studio
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
Thank you for your attention!
Contact
Blog
http://www.npruehs.de
@npruehs
Github
https://github.com/npruehs
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?
Top Related