wyrd
Well-known member
Ive 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 wasnt generic enough for others to use without making their own modifications.
Ive decided to correct this. Im making a new class library for gamers, that will make game programming a snap (well, lets 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 youre 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;
Ive decided to correct this. Im making a new class library for gamers, that will make game programming a snap (well, lets 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 youre 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, were 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 were simply clearing the screen over and over again.
backbuffer.ColorFill(Color.Brown);
}
override protected void Closing()
{
// Cleanup all resources here.
}
}