[C#] Project GreGoR

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 83
Yes, hoh my gawd!
GreGoR PG Engine
Version: N/A

Info
GreGoR PG Engine is the name for my RPG Engine. The capital letters are the only ones that stand for something. GGRPG Engine - Game Guys Role Playing Game Engine. So I placed it in GreGoR which sounds more catchier. And easier to say.

Alright, I promised King Munkey we would at least attempt to make an RPG from scratch using XNA. Well due to my well first losing my laptop and my main computer breaking down, I haven't done anything to contribute to this project. And now that I do have a computer at home, its just a lack of internet and now I'm relying on school computers to put out info.

Well I've been working on the engine now for about a week. I have accomplished some nice features and I would like to share them with you along with a demo. However I cannot get a demo out yet, until I put it on my flash drive and bring it to school. (Will do so tomorrow) Anyways below is some basic features and info about the engine.

Features
Alright so I've been working on some key main features we'd need for a basic engine like this. I basically setup the project to go off of what RMXP does. The main file that gets processed Game1.cs acts as the "Main" script in RMXP. I think I came up with a nice genius way to make this as easy as possible.

Heres what I have now.
  • Basic Scene and Main Structure
  • Basic Window Structure
  • Tilemap is Almost done (Working on autotiles)
  • Test scenes have been made

Basic Structure
Alright so my basic structure is quite simple actually. Maybe its not the "right" way to do it, but its making it a lot easier for me anyways. I've made it so easy to create windows and scenes it takes a matter of minutes just to recreate Scene_Title from RMXP.

So basically I have a class called "Scenes.Base"
This Base has every method any scene needs for updating, drawing, loading and unloading content.
Scenes.Base also has two important variables for scene changing.
Code: [Select]
Scenes.Base scene;
bool scene_change = false;
The main process checks to see if scene_change is true, if so, change the scene to the one thats defined within the scene itself. Basically Scenes.Base is structured like this.
Spoiler for:
Code: [Select]
class Scenes.Base : GameComponent
{
 Scenes.Base scene;
 bool scene_change = false;
 ContentManager content;
 public Main(Game game) // cant remember the real method name
 {
    content = new ContentManager(game.Services, "Content");
 }
 public virtual void Update(GameTime gameTime)
 {
 }

 public virtual void Draw(SpriteBatch spriteBatch)
 {

 }

 public virtual void LoadContent()
 {

 }
}

I created an item template, so when I add a New Item I can click Scene.cs and it'll add all methods and stuff I need. Now in my "Main" script you could call it, which is the actual Game class itself, it acts basically as Main does. Its basically like this.
Spoiler for:
Code: [Select]
class Game1 : Game
{
 Scenes.Base scene;
 public override void Update(GameTime gameTime)
 {
    if (scene.scene_change)
    {
     scene.UnloadContent();
     scene = scene.scene;
    }
    scene.Update(gameTime);
 }
 public override void Draw(GameTime gameTime)
 {
    spriteBatch.Begin();
    scene.Draw(spriteBatch);
    spriteBatch.End();
 }
}

Now any class that inherits Scenes.Base will be labeled as a Scenes.Base class. It may be inefficent maybe but its making it a lot easier on my part. So recreating the Title scene is quite simple too. However can't create that unless I have a Window base. Which I also have.

Window Structure
This is setup practically like Scenes.Base. The only difference is its Windows.Base now. And it has methods in the Draw method that actually creates the window. Now it doesn't use RMXP's windowskins. For now it just uses a simple window graphic and stretches it to the windows size. Later, we'll have our own custom window skin template.

So now you can also create windows using Windows.Base. For example here could be a simple window displaying "Hello World". However when creating a window, you'll need a second argument when calling the base.Main method. Also note I cannot exactly recall how the method looks, I'm just using Main as a place holder.
The second argument is the location and size. Basically when creating a new window in RGSS
super(x, y, width, height) except we're using a Rectangle class as the argument.
Spoiler for:
Code: [Select]
class Windows.Info : Windows.Base
{
 SpriteFont font;
 public Main(Game game, new Rectangle(0, 0, 128, 64))
 {

 }
 public override void LoadContent()
 {
    font = base.content.Load<SpriteFont>("spritefont");
    base.LoadContent();
 }
 public override void Update(GameTime gameTime)
 {
    base.Update(gameTime);
 }
 public override void Draw(spriteBatch)
 {
    base.Draw(spriteBatch);
    base.DrawText("Hello World", new Vector2(4, 4), Color.Black, font);
 }
}

Now in an actual scene, we can call the window.

Scene Creation
Now we can actually create a test scene. Basically the scene will handle some input and draw the window.
Spoiler for:
Code: [Select]
class Scenes.Test : Scenes.Base
{
 Windows.Info info;
 KeyboardState input;
 public Main(Game game) : base(game) // again just placeholder, don't recall actuall method setup
 {
    info = new Windows.Info(game);
 }
 public override void Update(GameTime gameTime)
 {
    info.Update(gameTime);
    base.Update(gameTime);
 }
 public void UpdateInput()
 {
    if (input.IsKeyDown(Keys.Escape))
    {
     Game.Exit();
    }
    input = Keyboard.GetState();
 }
 public override void Draw(SpriteBatch spriteBatch)
 {
    info.Draw(spriteBatch);
    base.Draw(spriteBatch);
 }
}
    Now we run that and it'll draw the window that says "Hello World" and when we press Escape it'll close the game.

    Whats in the Demo
    So whats in the demo exactly? Well it consists of 3 different scenes.
    Scene_Map
    Scene_Test
    Scene_Title
    It contains 4 different windows
    Window_Text
    Window_MapControls
    Window_Test
    Window_Command[/li][/list]

    The scene title is basically replicated as the one from RMXP. It displays a nice background image for the title screen and its got a command window with 3 different options.
    “Tilemap”
    “Test”
    “Exit”

    The scene detects input as the actual one from RMXP and detects actual command window’s index like in RMXP. It uses a case statement and under each index it’ll do a process.

    The Tilemap option calls Scene_Map and Scene_Map calls the Tilemap class and draws out the map. Its also cool as well because I made a little program that converts RMXP maps into data for my engine. The Scene_Map containts Window_MapControls which basically all you can do in Scene_Map is scroll around the map. I finally got around to making my engine support maps larger than 20x15. And the fact that I have scrolling is a huge improvement compared to my last engine. You can press Escape to return to the Title.

    The Test option which calls Scene_Test contains 4 windows. Window_Test, Window_Text, and 2 Window_Commands. The command windows have the options to be active or not. If a command window is not active, the cursor will not be displayed. Here you can choose 1 of 4 options from the first window. Each option will change the text displayed in Window_Text. The fourth option will disable command window 1 and activated command window 2. command 2 has 4 options as well. 4th one will return to the title screen, the 3rd one will reactivate the first window.

    Thats whats basically in the demo. I think I’ve done a pretty good job at it, now all I have to do is get it to you guys.

    Demo
    Scenes Test - This is a demo that shows the changing of scenes.
    Tilemap Demo - This displays 5 different maps you can scroll around.
    Zombie Swarms Topic

    Scenes Demo Video

    You need the Microsoft XNA 3.1 Redistributable in order to run the demo. So please download and install wto play the demo.
    XNA 3.1 Redist

    Notes and Stuff

    I’ll have the demo up soon. I’ll get some screenshots and try and upload a video from somewhere. I can’t go to youtube from my school so... and every proxy I found is blocked. Cya guys.
    « Last Edit: November 29, 2010, 07:34:31 PM by game_guy »

    *****
    Rep:
    Level 84
    This text is way too personal.
    Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
    This looks cool! Great work, hoping for the demo soon.

    ***
    Rep:
    Level 83
    Yes, hoh my gawd!
    Actually the demos were posted. I just never updated my info.