You are previewing Game Engine Toolset Development.
O'Reilly logo
Game Engine Toolset Development

Book Description

Toolset development is an extremely broad topic. Game Engine Toolset Development provides you with a core set of skills and a comprehensive insight that will aid you in the development of game engine utilities, significantly reducing the time period associated with the construction phase of a project. The book starts off with topics regarding development methodologies and best practices, and then proceeds into advanced topics like swap chain management and MVC object model automation with CodeDom. An introductory working knowledge of C# and the .NET 2.0 framework is expected, allowing the content of each topic to be directed towards the subject and avoiding trivial and introductory explanations. Readers are not required to have any experience developing game engine tools. Terminology and design fundamentals specific to toolset development are clearly depicted and explained. The companion Web site provides downloads of all source code from the book, as well as several bonus chapters.

Table of Contents

  1. Copyright
    1. Dedication
  2. Foreword
  3. Acknowledgments
  4. About the Author
  5. Introduction
  6. I. Toolset Design Fundamentals
    1. 1. What is a Tool? What is a Toolset?
      1. Stakeholders: Internal Versus External
      2. Who Builds the Tools?
      3. How Large are Tools Teams?
      4. Conclusion
    2. 2. Why Use C#? Why Use .NET?
      1. Overview of .NET
      2. Overview of C#
      3. Legacy Interoperability
        1. Platform Invocation Service (P/Invoke)
        2. COM and Runtime Callable Wrappers
        3. C++/CLI (Managed Extensions for C++)
      4. Benefits
      5. Conclusion
    3. 3. Examples of Commercial Toolsets
      1. Case Study: BioWare Corporation
      2. Case Study: Artificial Studios
      3. Conclusion
    4. 4. Everything Starts with a Plan
      1. Vision
      2. Stakeholders
      3. Reusability
      4. Architecture
      5. Requirements
      6. Design Standards
      7. Coding Standards
      8. Documentation
      9. Testing
      10. Defect Tracking
      11. Life Cycle
      12. Development Environment
      13. Staging Environment
      14. Production Environment
      15. Conclusion
    5. 5. Development Phases of a Tool
      1. Phase: Planning
      2. Phase: Analysis
      3. Phase: Design
      4. Phase: Implementation
      5. Conclusion
    6. 6. Measurement Metrics for Tool Quality
      1. Metric: Maintainability
      2. Metric: Traceability
      3. Metric: Performance
      4. Metric: Usability
      5. Metric: Testability
      6. Metric: Portability
      7. Metric: Reliability
      8. Metric: Efficiency
      9. Conclusion
    7. 7. Fundamentals of User Interface Design
      1. Principle of Consistency
      2. Principle of Transparency
      3. Principle of Feedback
      4. Principle of Refinement
      5. Principle of Exploration
      6. Principle of Modality
      7. Principle of Self-Evidence
      8. Principle of Moderation
      9. Principle of Customization
      10. Conclusion
    8. 8. Distributed Componential Architecture Design
      1. Architecture Overview
      2. Core Components
      3. Specific Tool Logic
      4. Console Entry Point
      5. Windows Entry Point
      6. Other Entry Points
        1. Remoting
        2. Web Access
        3. COM Interface
      7. Architecture Example
        1. Object Definitions
        2. Object Processing
        3. Alert Object Tool Interface
        4. Alert Object Tool
        5. Alert Object Console
        6. Alert Object Windows—Direct
        7. Alert Object Windows—Wrapper
        8. Alert Object Remoting
        9. Alert Object Remoting Example
        10. Unmanaged COM Support
      8. Alternate Architecture Structure
      9. Conclusion
    9. 9. Solutions to Bridge Domain Gaps
      1. Compositional Friction
      2. Cause: Domain Coverage
      3. Cause: Design Intentions
      4. Cause: Framework Gap
      5. Cause: Entity Overlap
      6. Cause: Legacy Components
      7. Cause: Source Code Access
      8. Relevant Design Patterns
        1. Façade Design Pattern
        2. Adapter Design Pattern
      9. Conclusion
    10. 10. Unit Testing with Nunit
      1. Overview of Unit Testing
      2. Introducing NUnit
      3. Creating an NUnit Project
      4. Attribute Overview
      5. Expected Outcome Assertion
      6. A Simple Example
      7. Running Tests
      8. Debugging with Visual Studio
      9. Conclusion
    11. 11. Code Documentation with NDoc and XML
      1. Configuring the Project
      2. Supported XML Markup
      3. Commenting Example
      4. Generating the Documentation
      5. Conclusion
    12. 12. Microsoft Coding Conventions
      1. Styles of Capitalization
      2. Naming Classes
      3. Naming Interfaces
      4. Naming Namespaces
      5. Naming Attributes
      6. Naming Enumerations
      7. Naming Static Fields
      8. Naming Parameters
      9. Naming Methods
      10. Naming Properties
      11. Naming Events
      12. Abbreviations
      13. Conclusion
    13. 13. Enforcing Coding Policies with FxCop
      1. Installing FxCop
      2. Creating an FxCop Project
      3. Configuring Built-In Rules
      4. Analyzing Your Project
      5. Building Custom Rules
      6. Conclusion
    14. 14. Best Practices for Robust Exception Handling
      1. External Data is Evil
      2. Creating Custom Exceptions
      3. Throwing Exceptions
      4. Structured Exception Handlers
      5. Logging Exception Information
      6. Mechanisms for Cleanup
      7. Unhandled and Thread Exception Events
      8. Conclusion
  7. II. Techniques for Arbitrary Tools
    1. 15. Compressing Data to Reduce Memory Footprint
      1. Types of Compression
      2. GZipStream Compression in .NET 2.0
      3. Implementation for Arbitrary Data
      4. Implementation for Serializable Objects
      5. Conclusion
    2. 16. Protecting Sensitive Data with Encryption
      1. Encryption Rudiments
        1. Public-Key Encryption
        2. Private-Key Encryption
        3. Ciphers
        4. Block Padding
        5. Key Strength
        6. Cipher Modes
        7. Initialization Vectors
      2. Selecting a Cipher
      3. ICryptoTransform Interface
      4. Conclusion
    3. 17. Generic Batch File Processing Framework
      1. Goals
      2. Proposed Solution
      3. Implementation
        1. Delegate Definitions
      4. Conclusion
    4. 18. Ensuring a Single Instance of an Application
      1. Early Solutions
      2. Journey to the Dark Side
      3. The Solution
      4. Conclusion
    5. 19. Implementing a Checksum to Protect Data Integrity
      1. Implementation
      2. Usage
      3. Alternative
      4. Conclusion
    6. 20. Using the Property Grid Control with Late Binding
      1. Designing a Bindable Class
      2. Ordering Properties
      3. Using the PropertyGrid
      4. Conclusion
    7. 21. Adding Printing Support for Arbitrary Data
      1. Printing Regular Text
      2. Supporting Printer Selection
      3. Supporting Page Setup
      4. Supporting Print Preview
      5. Conclusion
    8. 22. Flexible Command Line Tokenizer
      1. Formatting Styles
      2. Implementation
      3. Sample Usage
      4. Conclusion
    9. 23. Layering Windows Forms on Console Applications
      1. Implementation
      2. Sample Usage
      3. Conclusion
    10. 24. Overview of Database Access with ADO.NET
      1. Advantages of ADO.NET
      2. ADO.NET Object Model
        1. DataView
        2. DataSet
        3. DataProvider
      3. Working with a DataReader
      4. Working with a DataAdapter
      5. Working with XML
      6. Potion Database Editor
      7. Conclusion
  8. III. Techniques for Graphical Tools
    1. 25. Using Direct3D Swap Chains with MDI Applications
      1. What is a Swap Chain?
      2. Thoughts for SDI and MDI Applicability
      3. Common Pitfalls
      4. The Proposed Solution
      5. Conclusion
    2. 26. Constructing an Aesthetic Texture Browser Control
      1. Swappable Loader Interface
      2. Windows GDI+ Loader
      3. Managed Direct3D Loader
      4. Storing Texture Information
      5. Building the Thumbnail Control
      6. Handling Custom User Events
      7. Building the Viewer Control
      8. Using the Control
      9. Loading Textures from a Directory
      10. Loading Textures from a MemoryStream
      11. Loading Textures from a Bitmap
      12. Texture Browser Demo
      13. Conclusion
    3. 27. Converting from Screen Space to World Space
      1. Transforming Screen Coordinates
      2. Computing the Picking Ray
      3. Bounding Sphere Intersection Tests
      4. Improving Intersection Accuracy
      5. Using Built-In D3DX Functionality
      6. Conclusion
    4. 28. Asynchronous Input Device Polling
      1. Asynchronous Mouse Polling
      2. Asynchronous Keyboard Polling
      3. Sample Usage
      4. Conclusion
  9. IV. Techniques for Network Tools
    1. 29. Downloading Network Files Asynchronously
      1. HttpWebRequest and HttpWebResponse
      2. The Request Object
      3. Maintaining Data State
      4. The Core System
      5. Sample Usage
      6. Conclusion
  10. V. Techniques for Legacy Interoperability
    1. 30. Exchanging Data Between Applications
      1. What Microsoft.NET Provides
        1. Web Services
        2. Remoting
        3. Clipboard
        4. TCP\IP Loopback Communication
      2. What Microsoft.NET Should Provide
        1. Named Pipes
        2. WM_COPYDATA
      3. Building a Wrapper Around WM_COPYDATA
        1. Communicating from Unmanaged Applications
        2. Communicating from Managed Applications
      4. Conclusion
    2. 31. Interacting with the Clipboard
      1. The Clipboard Class and IDataObject
      2. Storing Built-In Types
      3. Storing Custom Data Formats
      4. Querying Available Data Formats
      5. Complete Solution
      6. Conclusion
    3. 32. Using .NET Assemblies as COM Objects
      1. COM Callable Wrappers (CCW)
      2. Applying Interop Attributes
      3. Registering with COM
      4. Accessing from Unmanaged Code
      5. Deployment Considerations
      6. Conclusion
    4. 33. Managing Items in the Recent Documents List
      1. Implementation
      2. Example Usage
      3. Conclusion
  11. VI. Techniques to Improve Performance
    1. 34. Playing Nice with the Garbage Collector
      1. Overview of the Garbage Collector
      2. Collecting the Garbage
      3. Allocation Profile
      4. CLR Profiler and GC Monitoring
        1. Performance Counters
        2. Profiling API and the CLR Profiler
      5. Finalization and the Dispose Pattern
        1. Finalization
        2. The Dispose Pattern
      6. Weak Referencing
      7. Explicit Control
      8. Conclusion
    2. 35. Using Unsafe Code and Pointers
      1. Rudiments of Pointer Notation
      2. Using an Unsafe Context
      3. Pinning Memory with the Fixed Statement
      4. Disabling Arithmetic Overflow Checking
      5. Allocating High Performance Memory
      6. Getting Size of Data Types
      7. Example: Array Iteration and Value Assignment
      8. Example: Data Block Copying
      9. Example: Win32 API Access
      10. Conclusion
    3. 36. Investigating Managed Code Performance
      1. Investigating Performance
      2. Avoid Manual Optimization
      3. String Comparison
      4. String Formatting
      5. String Reversal
      6. Compiling Regular Expressions
      7. Use the Most Specific Type
      8. Avoid Boxing and Unboxing
      9. Use Value Types Sensibly
      10. The Myth About Foreach Loops
      11. Use Asynchronous Calls
      12. Efficient IO Buffer Sizes
      13. Minimize the Working Set
      14. Perform Chunky Calls
      15. Minimize Exception Throwing
      16. Thoughts About NGen
      17. Conclusion
    4. 37. Responsive UI During Intensive Processing
      1. Implementing the Worker Logic
      2. Reporting Operation Progress
      3. Supporting User Cancellation
      4. Executing the Worker Thread
      5. Conclusion
  12. VII. Techniques to Enhance Usability
    1. 38. Designing an Extensible Plugin-Based Architecture
      1. Designing a Common Interface
      2. Embedding Plugin Metadata Information
      3. Building a Proxy Wrapper
      4. Loading Plugins Through the Proxy
      5. Reloading Plugins During Runtime
      6. Runtime Compilation of Plugins
      7. Enforcing a Security Policy
      8. Conclusion
    2. 39. Persisting Application Settings to Isolated Storage
      1. Concept of Isolated Storage
      2. Accessing Isolated Storage
      3. Levels of Isolation
      4. Management and Debugging
      5. Conclusion
    3. 40. Designing a Reusable and Versatile Loading Screen
      1. Splash Dialog
      2. Go for the Gusto
      3. Concept of Loading Jobs
      4. Responsive Processing
      5. Simple Example
      6. Conclusion
    4. 41. Writing Context Menu Shell Extensions
      1. Unmanaged Interfaces
      2. Reusable Framework
      3. Sample Usage—Standalone
      4. Sample Usage—Integrated
      5. Component Registration
      6. Debugging Techniques
      7. Conclusion
  13. VIII. Techniques to Increase Productivity
    1. 42. Automating Workflow Using Job Scheduling
      1. Benefits
      2. Solution Goals
      3. Implementation
      4. Conclusion
    2. 43. MVC Object Model Automation with CodeDom
      1. Advantages of an Automatable Object Model
      2. Comparison with Model-View-Controller Pattern
      3. A Simple Object Model Architecture
      4. Plugin-Based Architectures
      5. Controlling an Object Model with Scripts
      6. Implementing a C# Command Window
      7. Simple Automation and MVC Example
      8. Conclusion
  14. IX. Techniques for Deployment and Support
    1. 44. Deployment and Versioning with Clickonce
      1. ClickOnce and MSI Comparison
      2. Creating the Application
      3. Publishing the Application
      4. Launching the Application
      5. Deployment Configuration
      6. Pushing Application Updates
      7. Programmatically Handling Updates
      8. Conclusion
    2. 45. Testing for the Availability of the .Net Framework
      1. The Solution
      2. Example Usage
      3. Conclusion
    3. 46. Building and Customizing an MSI Installer
      1. Creating a Setup Project
      2. Project Configuration
      3. Deployment Configuration
      4. Custom Installer Actions
      5. Deploying the Installer
      6. Conclusion
    4. 47. Determining Binary File Differences
      1. What is Levenshtein Distance?
      2. Generating a Difference List
      3. Transforming Data Using a Difference List
      4. Thoughts for Usability and Deployment
      5. Conclusion
  15. X. Bonus Web Site Chapters
    1. 1. Distributed Computing Using .NET Remoting
      1. Investigating Scalability
      2. Fault Tolerance
      3. Managing Security
      4. Middleware Considerations
      5. Sample Framework
      6. Conclusion
    2. 2. Building a Managed Wrapper with C++/CLI
      1. Introduction to Managed C++ (C++/CLI)
        1. Overview of Extended Syntax
          1. Reference Handles
          2. Keyword: abstract
          3. Keyword: delegate
          4. Keyword: event
          5. Keyword: interface
          6. Keyword: property
          7. Keyword: sealed
          8. Keyword: __identifier
          9. Keyword: pin_ptr
          10. Keyword: safe_cast
          11. Keyword: typeid
        2. Common Language Runtime Compilation (/clr)
        3. Referencing Assemblies and Classes
        4. Mixing Managed and Unmanaged Code
      2. Example Unmanaged 3D Engine
      3. Creating a Managed Wrapper for SimpleEngine
      4. Consuming the Managed Wrapper
      5. Conclusion