0%

Book Description

VISUAL C# GAME PROGRAMMING FOR TEENS teaches teens and other beginners how to create games using C# and Windows Forms (GDI+). A true beginner's guide, this book covers each essential step for creating your own complete role-playing game, including a character creation screen and a combat system. This book serves as a comprehensive introductory guide for readers who are new to programming or new to programming for games. The reader is shown how to load and draw bitmaps, create sprites, render a game world, keep track of inventory and character stats, and build tools: a level editor, character editor, item editor, monster editor. Every chapter contributes toward a growing game library that is used to improve and add new and more advanced features to the game, and when the student is finished they will have created a complete game.

Table of Contents

  1. Copyright
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. Pacing and Experience
    2. Prerequisites
    3. Visual C# 2008 and the .NET Framework
    4. Managed DirectX?
    5. Contacting the Author
    6. Book Contents
    7. Conventions Used in This Book
    8. Companion Website Downloads
  5. I. Dungeon Prerequisites
    1. 1. Welcome to the Dungeon
      1. Game Programming Is an Art
        1. Getting Your Feet Wet
        2. On Programming Languages
        3. Let Your Creativity Fly
      2. On Creativity, Talent, and Hard Work
        1. The Sky’s the Limit
        2. Learn the Tricks of the Trade
      3. Taking a Look at Dungeon Crawler
        1. Building a Role-Playing Game
        2. The Dungeon
        3. Describing the Player’s Character
        4. Adventure Game or Dungeon Crawler?
      4. Level Up!
    2. 2. Drawing Shapes and Bitmaps with GDI+
      1. Drawing Lines
        1. PictureBox Is Our Friend
        2. Surfaces and Devices
        3. 4D Programming with a Timer
      2. Drawing Rectangles
      3. Drawing Text
      4. Dissecting Bitmaps
        1. Loading a Bitmap File
        2. Drawing a Bitmap
        3. Rotating and Flipping a Bitmap
        4. Accessing Bitmap Pixels
      5. Creating a Reusable Framework
        1. Game Class Constructor
        2. Game Class Destructor
        3. Bitmap Loading
        4. Game Updates
        5. Framework Demo
      6. Level Up!
    3. 3. Sprites and Real-Time Animation
      1. What Is a Sprite?
      2. Animating a Sprite
        1. Sprite Animation Theory
        2. Creating a Sprite Class
      3. Sprite Drawing Demo
        1. Improving the Game Class
        2. Form1 Source Code
        3. Adding a Real-Time Game Loop
        4. Gameplay Functions
      4. Level Up!
    4. 4. Collision Detection
      1. Reacting to Solid Objects
        1. Rectangle Intersection
        2. Collision Test
      2. Archery Game (Collision Demo)
        1. Sprite Class
        2. Game Class
        3. Form1 Class
      3. Level Up!
    5. 5. Playing Sound Effects and Music
      1. Programming Audio
        1. Loading and Playing Audio Files
        2. Using Audio Resources
        3. Built-In System Sounds
        4. The Audio Playback Demo Program
      2. Using Windows Media Player
        1. Referencing the Media Player
        2. Playing MP3 and MIDI Files
      3. Level Up!
  6. II. Building the Dungeon
    1. 6. Creating the Dungeon Editor
      1. Level Editor Design
        1. Tile Properties
        2. Using the Level Editor
          1. Creating a New Tilemap Level
          2. Loading and Saving
          3. Exporting the Level as a Bitmap
          4. Tile Property Viewing Options
          5. Saving the Editor Palette
          6. Filling Empty Tiles
          7. Filling the Whole Map
          8. Clearing Data Fields
      2. Building the Editor
        1. Importance of the Tile Palette
        2. Quick Jaunt through the Sources
      3. Level Up!
    2. 7. Rendering a Dungeon Level
      1. Mapping the Dungeon
        1. Tile-Based Dungeon
        2. Loading and Drawing Level Files
      2. Introduction to Tiled Scrolling
        1. Constructing the Tiled Image
        2. Tile Buffer
        3. Stepping Stones of the World
        4. Tile Rendering Theory
      3. Per-Tile Scrolling
        1. Full-Tile Scrolling
        2. Full-Tile Smooth Scrolling
      4. Sub-Tile Scrolling
        1. Sub-Tile Scrolling Theory
        2. Drawing the Scroll Buffer
        3. Aligning Tiles to the Scroll Buffer
        4. Sub-Tile Scroll Buffering
        5. Sub-Tile Smooth Scrolling
      5. Level Up!
    3. 8. Adding Objects to the Dungeon
      1. Adding Objects to the Game World
        1. A New Game Loop
          1. Reviewing Game.cs
          2. A New Game Loop
        2. New Level Class
        3. Adding Trees
          1. Modifying Sprite.cs
          2. Adding the Trees
      2. Adding an Animated Character
      3. Level Up!
    4. 9. Going Deeper into the Dungeon with Portals
      1. Updating the Level Class
      2. It’s a Data-Driven Game World
        1. Creating a Portal
        2. Teleporting to Another Dimension
        3. Looking for Tile Collisions
        4. Secret Doors
        5. Portal Demo Program
      3. Level Up!
  7. III. Exploring The Dungeon
    1. 10. Creating Characters and Monsters
      1. Character Classes and Attributes
        1. Attributes
          1. Strength (STR)
          2. Dexterity (DEX)
          3. Stamina (STA)
          4. Intellect (INT)
          5. Charisma (CHA)
          6. Hit Points
        2. Gaining Experience and Leveling Up
        3. The Base Character Classes
          1. Warrior Class
          2. Paladin Class
          3. Hunter Class
          4. Priest Class
        4. Peasants as NPCs
        5. The Monster Classes
          1. Skeleton Warrior
          2. Skeleton Archer
          3. Berserker
          4. Zombie
      2. The Character Editor
      3. Loading Character Files
        1. The Character Class
        2. The Animated Character Artwork
        3. Character Demo
      4. Level Up!
    2. 11. Dialogue: Trainers, Vendors, and NPCs
      1. Talking with NPCs
        1. Creating the “Vendor” NPC
        2. Starting a Conversation
        3. Dialogue Choices
      2. Creating the Dialogue System
        1. Making Eye Contact
        2. Dialogue GUI
          1. Positioning the Dialogue Window
          2. Drawing the Dialogue Window
          3. Drawing the Title
          4. Drawing the Message with Word Wrapping
          5. Drawing the Buttons
        3. Final Example
      3. Level Up!
    3. 12. Fighting Monsters, Gaining Experience, and Leveling Up
      1. Preparing for Combat
        1. Starting an Attack
        2. Combat Demo 1
      2. Character Templates
        1. Animations: Player Characters (PCs)
          1. Hero (Axe)
          2. Hero (Sword)
          3. Hero (Axe & Shield)
          4. Hero (Sword & Shield)
          5. Hero (Bow)
          6. Hero (Staff)
          7. Hero (Unarmed)
        2. Animations: Hostile NPCs
          1. Skeleton (Bow)
          2. Skeleton (Sword & Shield)
          3. Skeleton (Unarmed)
          4. Zombie (Unarmed)
      3. Creating the Combat System
        1. Making Up Our Own Rules
        2. Spawning Enemy NPCs
        3. Attack Rolls
          1. Armor Class (AC)
          2. Melee “Chance To-Hit” Rolls
          3. Ranged “Chance To-Hit” Rolls
        4. Rolling for Damage
          1. Melee “Damage” Rolls
          2. Ranged “Damage” Rolls
          3. Critical Hits (“Crit”)
        5. Attack Roll Example
          1. Armor Class
          2. Attack Roll
          3. Damage Roll
          4. Hit Points
        6. Dealing with the Player’s Death
        7. Combat Demo 2
          1. Turn-based Combat
          2. More Dialogue
          3. Attack!
      4. Facing Your Enemies
        1. Which Way Did He Go?
        2. A Change of Character
      5. State-Based Combat
        1. Dialogue Improvements
        2. Plugging in Attack State
      6. Dealing Permanent Damage
        1. Gaining Experience
      7. Level Up!
    4. 13. Equipping Gear and Looting Treasure
      1. Item Editor Design
        1. Item Images
        2. Looking Up Items
        3. Item Class
        4. Item Editor Project
      2. Looting Treasure
        1. Preparing to Loot
        2. Stumbling Upon Loot
        3. Items Class
        4. Character Class
        5. Dropping Loot
      3. Managing Inventory
        1. Inventory Class
        2. Player Class
      4. Level Up!
    5. 14. Populating the Dungeon
      1. Player Spawn
        1. Dungeon Entrance
        2. Positioning the Player
        3. Enforcing Tile Collision
      2. Treasure Caches
        1. Creating Treasure
        2. Dropping Loot-Style Treasure
        3. Designing Treasure Drops
      3. Monster Spawns
        1. Adding Monsters
        2. Monsters by Design
      4. Level Up!
    6. 15. Deep Places of the World
      1. Going Deeper
        1. Line of Sight (Ray Casting)
        2. Torch Light Radius
        3. Scroller Optimizations
      2. Lua Script Language
        1. Installing Lua
          1. Installing LuaInterface
          2. Testing LuaInterface
          3. Sharing Tile Data with Lua
        2. Incorporating Script Into the Engine
      3. Finishing Touches
      4. Level Up!
18.118.126.241