Making game programming easy...

wyrd

Senior Contributor
Joined
Aug 23, 2002
Messages
1,405
Location
California
I've already made a minor class library that helped when it came to getting a game up and running ASAP. Unfortunately, I constrained it too much for my own needs, and it wasn't generic enough for others to use without making their own modifications.

I've decided to correct this. I'm making a new class library for gamers, that will make game programming a snap (well, let's hope). C# already makes it easier, but I want to make it even easier.

For this to happen, I need help. I need people to help me test what I already have, provide feedback (can I make something easier, is it missing something, etc) and what-have-you.

Right now, I have the basic functionalities finished;

Pheonix.Game namespace - GameBase, Rand, Timer.
Pheonix.Graphics namespace - Display, Sprite.
Pheonix.Input namespace - Mouse, Keyboard.

Each class not only makes it easy to get a game up and running, but still allows you full access to the DX objects.

I plan on adding a full AI namespace and Scripting namespace, that way you can get bots up and running in no time. Also, a windowing system will be provided as well (all games have windows, you know?). And of course, a Sound namespace will eventually be provided.

Creating a game is literally a snap;

1. Create an empty project.
2. Reference Pheonix and DirectX libraries.
3. Create a file called Game.cs.
4. Copy the below template into the Game.cs file.
5. Fill in the code where appropriate.
6. Set Game.cs as your start-up project.

Basically what you're doing is inheriting the GameBase class, which handles everything from accessing game input to performing your game loop. All you have to do is worry about handling game logic and drawing graphics.

Game template;
Code:
using System;
using System.Windows.Forms;
using Pheonix.Game;
using Pheonix.Graphics;
using Pheonix.Input;
using Microsoft.DirectX.DirectDraw;
using Microsoft.DirectX.DirectInput;
using System.Drawing;

public class Game
	: GameBase
{
	[STAThread]
	static void Main() 
	{
		// In this template, we're using a form as the game window. You can use ANY control you want.

		Form window = new Form();
		window.WindowState = FormWindowState.Normal;
		window.FormBorderStyle = FormBorderStyle.None;
		window.Show();

		// Start the game.
		Game game = new Game();
		game.Start(window);

                          // Cleanup.
		game.Dispose();
		frm.Dispose();
	}

	override protected void Initialize(Display display)
	{
		// Initialize graphics and game here.
	}

	override protected void ProcessInput(Pheonix.Input.Keyboard.State keyState, Pheonix.Input.Mouse.State mouseState)
	{
                          // Process game input. In this case the game ends upon hitting escape.
		if (keyState[Key.Escape]) { this.End(); }
	}

	override protected void UpdateLogic(float frameTime)
	{
                        // Update all game logic here.
	}

	override protected void DrawGraphics(Surface backbuffer, Control window)
	{
		// Draw all graphics here. In this case we're simply clearing the screen over and over again.
		backbuffer.ColorFill(Color.Brown);		
	}

	override protected void Closing()
	{
		// Cleanup all resources here.
	}
}
 

Attachments

Some more notes...

You can access any of the protected members of GameBase at any time. For convenience, and to make things easier for those who are new, it passes them to the paremeters where they are required.

_display, _timer, _mouse, _keyboard, and _window.

Creating & Destroying Surfaces;

// GameBase passes the display as a parameter via Initialize() method.
Surface surface = _display.CreateSurface("sprite.bmp");
surface.Dispose();

Creating & Destroying Sprites;

Sprite sprite = new Sprite(_display.CreateSurface("sprite.bmp");
sprite.FrameSize = new Size(32, 32);
sprite.SetTransparency(0x00RRGGBB);
sprite.Dispose();

Drawing Sprites;

// GameBase passes the backbuffer as a paremeter via DrawGraphics() method.
backbuffer.DrawFast(x, y, sprite.Surface, sprite.Area(0), DrawFastFlags.DoNotWait | DrawFastFlags.SourceColorKey);
 
Im Doing a simular thing with D3D

So far there is still allot being fixed however, i have made initialising and manipulating a 3d world easyer, Vertex Buffer controls are now easyer, Along with Static and Animated (Tweening) meshs, and Some Animating Vertex Buffer code, Once it gets to a workable level i may post the DLL here, with of course usual rules use for your projects anything that will be marketed youll need to contact me for... same old same old..
 
Major update and design changes. :) The library is now D3D, and also provides easy-to-use classes for 2D. Hopefully it'll provide an easier method for those looking to do 2D in D3D. Also, all input is now done through multithreading (as opposed to polling), and is provided via a callback function (delegate).

Documentation; http://www.danpeverill.com/phoenix/doc/
Latest source & test proj (shows a sprite rotating and moving around);
http://www.danpeverill.com/phoenix/dl/Phoenix.zip

The following classes are finished;
Phoenix.Game - GameBase, Rand, Timer
Phoenix.Graphics - Display, Graphic, SpriteEx
Phoenix.Input - Keyboard, Mouse, DeviceBase
 
Also I've started to write a 3D graphics engine oriented on vertex and pixel shader 2.0. My graphics engine is called Enginet
Is at first fase of development but support:
lightmap
stencil shadows
device lost management
vertex shader tweening animation
lens flare
fire noise
3D collision detection
skin mesh animation
raylight detection
bump sky
input and audio interface (in future also network interface).
2 tools for assemblies level and animation

It has one defect: is documented in Italian.
If you want to help me to debug the first version I'll thank.
You can find it on my website
robydx.altervista.org in section project enginet.
I need debbuger help to accellerate the development of it.
 
Not sure if this will help, but just found this site. Might help with DirectX if you need it...

By the way, you spelled Phoenix as "Pheonix" in your first post. Might distract those just reading the thread for the first time.

-Nerseus
 
Hi

Your website isn't working.. just thought I would let you know. As I wanted to get the new update..
 
Back
Top