My brain makes things explode.
Posts tagged Programming
C++/D3D Pong Tutorial 03: Scene Objects and Sprite Rendering
Mar 21st
Tutorial Description
In the last tutorial, we finished getting Direct3D set up, implemented a timer system to allow us to calculate the time between each frame, and set up the framework that will grant us access to our game without interfering with the core engine. In this tutorial, we are going to implement a reusable Scene Object class, which will be the parent for all future classes that we wish to enable in a scene manager. The scope of this tutorial series makes a full-fledged instance management system overkill, so we will not be building one in here. However, as this tutorial series will act as the base for future tutorials that will implement a scene manager, I am going to implement the scene object class here.
Downloads
Binary Only (18.8KB)
Full VS2010 Project Dir (28.4KB)
Starting Words
I just wanted to point out that this tutorial series borrows a lot of the structure of Jonathan Harbour’s Advanced2D game engine, from the book “Advanced 2D Game Development“. While I certainly believe it to be a wonderful book, and an excellent starting point for beginners (in fact, the reason for me borrowing the format for his engine is because I find the method well-suited for beginners), I find that I have a lot of personal quirks with Jonathan’s methods and programming habits, and there are a number of inconsistencies in it. Furthermore, there are some topics that are covered in the book that just aren’t well-suited for beginners, and can cause things to be a bit confusing and convoluted. In this tutorial series, I don’t plan to implement three-dimensional rendering, which he does cover briefly, and have no intention of including game scripting, though several more advanced tutorials will cover these aspects at a later date (read: when I stop being lazy). Anybody looking at learning to program two-dimensional games with DirectX and C++ should look into the book, but should remember that there will always be better ways to implement certain systems than what is shown to you in a book – or an online tutorial. Anybody that wants to gain a solid understanding and truly grasp the depth of these programming systems is highly encouraged to look up information on any subjects that they are unfamiliar with. I strongly recommend Safari Books Online – I read a lot of books there, and it’s certainly helped me improve myself. Advanced 2D Game Development is available on SBO, as well.
Notice: This tutorial continues from where “C++/D3D Pong Tutorial 02” article left off. Please read it if you have not already.
Torque Game Builder/Box2D Integration
Feb 20th
I’ve been looking at Box2D a lot recently, mostly because Torque 2D (Torque Game Builder’s replacement) is going to be using it. It’s a damn good, and powerful, two-dimensional physics engine -- it’s what powered Crayon Physics, and several similar physics-oriented games. Box2D is a pretty beautiful thing, from what I’ve looked at, and it’s been ported to a lot of systems. Recently, I found a Torque Game Builder integration for it, and figured I’d look into it. Currently, it’s integrated into the Torque Game Builder editor, and still allows for the use of the standard TGB physics (you cannot have both Box2D and TGB physics on the same object, however). The system comes in the form of a class that needs to be set on the Scene itself, and behaviors that you add to objects. The system uses the object’s convex collision polygon, as well.
Video
Screenshots of the Pyramid Test
Stacked Pyramid
Tumbling Pyramid
TGB/Box2D Integration Links
Torque Game Builder 1.7.4
Box2D implementation
Need to stop being lazy.
Feb 16th
Well, I’ve come to the conclusion that I need to stop being lazy and get some work done on the OS X port of Waxy’s Sushi Party. So, for the next couple of nights, I am going to start working my ass off to get an early prototype ready.
This means a lot of playing the game, taking notes, and fucking around with Torque Game Builder for me, and nightly development blog entries for the whole.. two or three of you who read my blog. Yeah, so, enjoy. >.>
C++/D3D Pong Tutorial 02: Setting up Direct3D and our Engine Framework
Feb 15th
Tutorial Description
In the last tutorial, we set up the basics required for the Windows API to open our window. While basic, the task was also essential, though many people who are familiar with Win32 Programming will likely have gained nothing from it. Here, we are going to do several tasks. In no particular order, they are as follows:
1) Set up Direct3D rendering
2) Set up the framework for our game engine
3) Implementing game timing
Downloads
Binary Only (10.4KB)
Full VS2010 Project Dir (13.1MB)
Starting Words
Notice: This tutorial continues from where “C++/D3D Pong Tutorial 01” article left off. Please read it if you have not already.
C++/D3D Pong Tutorial 01: Setting up the Project
Jan 24th
Alright, the time has come for me to start up my tutorials again. Suppose I’ll start off with creating a Pong clone using C++ and Direct3D 9 (the game will be in two dimensions, though, for this product. Perhaps a 3D Pong tutorial can come later.)
Welcome to the D3D Pong Tutorial Series
Throughout this tutorial series, we will be developing a two-dimensional Pong clone using C++ and Direct3D 9. The tutorial assumes basic knowledge of the C++ language, as well as basic familiarity with namespaces, pointers, and the Microsoft Visual Studio IDE.
System Requirements
This tutorial series assumes that the following are true:
1) You have the DirectX SDK installed and configured on your system.
2) You know how to configure your IDE to use the header files and libraries included within the DirectX SDK
3) You know how to set up a new Win32 project (vice the use of a console project) in your IDE
4) You know how to add static libraries to a project within your IDE
Tutorial Description
This tutorial covers the first part of the D3D Pong project. We will create a Windows Application project, add the appropriate libraries, and will create the game/application window. In the next tutorial, we will cover setting up Direct3D, and will lay out the framework for the game engine.
