.NET
  Home arrow .NET arrow Page 8 - Game Development of .Nettrix: GDI+ and Col...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Game Development of .Nettrix: GDI+ and Collision Detection
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2004-08-23

    Table of Contents:
  • Game Development of .Nettrix: GDI+ and Collision Detection
  • Performing Graphic Operations with a Graphics Object
  • Creating Gradients
  • Collision Detection
  • Proximity Algorithms
  • Optimizing the Number of Calculations
  • Extending the Algorithms to Add a Third Dimension
  • Develop a Real Game Proposal
  • Diagrams of Basic Game Objects
  • The Game Engine
  • The Coding Phase
  • Testing the Program
  • The Block Class
  • The Constructor
  • The Down, Right, and Left Methods
  • The Rotate Method
  • The Show and Hide Methods
  • Final Version: Coding the GameField Class and the Game Engine
  • The CheckLines Method
  • The Game Engine
  • Adding the Final Touches
  • Further Improvements

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Game Development of .Nettrix: GDI+ and Collision Detection - Develop a Real Game Proposal


    (Page 8 of 22 )

    The Game Proposal

    The first step in developing any project is to establish the project’s scope and features.

    Note:  The main purpose for creating a game proposal is to have clear objectives stated; and everyone involved in the game creation must agree on every point.

    For this project we can summarize the scope in a list of desired features, as shown here:

    • Your game will be a puzzle game, and it’ll be called .Nettrix.

    • The main objective of the game is to control falling blocks and try to cre ate full horizontal lines, while not allowing the block pile to reach the top of the game field.

    • The blocks will be made out of four squares (in every possible arrange ment) that fall down in the game field, until they reach the bottom of the field or a previously fallen block.

    • When the blocks are falling, the player can move the blocks horizontally and rotate them.

    • When a block stops falling, you’ll check to see if there are continuous hori zontal lines of squares in the game field. Every continuous line must be removed.

    • The player gets 100 points per removed line, multiplied by the current level.

    • With each new level, the blocks must start falling faster.

    • If the stack of blocks grows until it’s touching the top of the game field, the game ends.

    This list contains many definitions that are important for any game proposal:

    • The game genre (e.g., puzzle)

    • The main objective of the game

    • The actions the player can perform (e.g., to shoot and to get objects)

    • Details about how the player interacts with the game and vice-versa: keyboard, intuitive interface, force-feedback joystick, etc.

    • How the player is rewarded for his or her efforts (points, extra lives, etc.)

    • How the player gets promoted from one level to the next (in this case, just a time frame)

    • The criteria for ending the game

    Note:  In more sophisticated games, there may be other considera tions, such as the storyline, the game flow, details about the level design or level of detail for the maps or textured surfaces, the diffi culty levels for the game, or even details on how the artificial intelligence (AI) of the game should work.

    The Game Project

    In a commercial game project, the game project starts with a complete game proposal (not just some simple phrases like ours) and continues with a project or functional specification. Although the proposal is written in natural language—so anyone can understand and approve it (including the Big Boss, who will approve or reject the budget for the project)—the project includes programming details that will guide the development team through the coding phase.

    It’s not our objective here to explain what must appear in the project documents (it depends largely on the development methodology used by the team), and you won’t create any complete projects because this isn’t the focus of the book. But since it’s not advisable to start any coding without a project, we’ll give you a quick look at projects just to make some implementation details clearer.

    Tip:  Of course, you can start coding without a project, but even when working alone, a project is the best place to start, since it lets you organize your ideas and discover details that were not clear before you put pen to paper. Even if the project is just some draft annotations, you’ll see that the average quality of your code will improve with its use. The more detailed the project is, the better your code will be, since it’ll help you see the traps and pitfalls along the way before you fall into them.

    Object-oriented (OO) techniques are the best to use in game projects, because usually games deal with some representation (sometimes a very twisted one) of the real world, as OO techniques do. For example, in Street Fighter, you don’t have real fighters on the screen; you have some moving drawings, controlled by the player or the computer, that create the illusion of a fight. Using an OO approach to project creation is roughly the same thing: You decide the important characteristics from the real-world objects that you want to represent in your program, and write them down. We aren’t going to go any deeper into this topic at this stage, but you can find some very good books on this topic. Look in Appendix A for recommended books and articles.

    Since this is your first program, we’ll walk you through the process of making it step by step, in order to demonstrate how you evolve from the game proposal to the final code; in later chapters you’ll take a more direct approach. In the next sections you’ll see a first version of a class diagram, then pseudocode for the game main program, and after that you’ll go back to the class diagram and add some refinements.

    This chapter is from Beginning .NET Game Programming in C#, by David Weller, et al., (Apress, 2004, ISBN: 1590593197). Check it out at your favorite bookstore today.

    Buy this book now.

    More .NET Articles
    More By Apress Publishing


       · Examples from the first page are invalid. You cannot do:Graphics g = new...
     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT