Author Topic: RTS Type Game  (Read 23104 times)

0 Members and 1 Guest are viewing this topic.

Offline MyndFyre

  • Boticulator Extraordinaire
  • Moderator
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: RTS Type Game
« Reply #30 on: July 31, 2006, 03:22:46 pm »
Using the above code you can render to any .NET control!
Woot, here I come ToolStripMenuItem!!!!
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #31 on: July 31, 2006, 04:16:14 pm »
I hope.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #32 on: July 31, 2006, 04:20:03 pm »
For some wierd reason Microsoft.DirectX.Direct3DX is throwing a NullReferenceException..my DLL compiles fine just at run-time it throws that error..odd.

Edit: I seemed to trace it down to:

this.OverlaySprite.Begin(Microsoft.DirectX.Direct3D.SpriteFlags.AlphaBlend);

and

this.OverlaySprite.End();

Throwing NullReferenceExceptions.
« Last Edit: July 31, 2006, 04:31:32 pm by Warrior[x86] »
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #33 on: July 31, 2006, 04:53:54 pm »
Update!

Fixed the error and implemented font drawing!

Code: [Select]
using System;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;

using Ravage3D;

namespace Ravage3DTest
{
    public partial class Form1 : Form
    {
        Ravage3D.Device GameDevice = null;
       
        public Form1()
        {
            InitializeComponent();
        }

        public void Form1_Load(object sender, EventArgs e)
        {
            GameDevice = new Ravage3D.Device();
            GameDevice.InitDevice(this.pictureBox1.Handle, true, this.pictureBox1.Width, this.pictureBox1.Height);
           
            Thread t = new Thread(new ThreadStart(this.Render));
            t.Start();
        }

        public void Render()
        {
            while (true)
            {
                GameDevice.BeginRendering();
                    GameDevice.EngineOverlay.PrintText("Arial", 20, 60, 60, FontStyle.Italic, "Testing fonts!", Color.White);
                GameDevice.EndRendering();
            }
         }
    }

}

Currently, the engine doesn't check for any types of error nor does it even exit graciously. The next update will probably include me implementing handlers for those sorts of errors as well as handling the LostDevice exception.

Screenshot:



The current code for the Overlay.cs is

Code: [Select]
using System;
using System.Collections;
using System.Text;
using System.Drawing;

using System.Windows.Forms;

using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
   
namespace Ravage3D
{
    public class Overlay
    {
        public Ravage3D.Device EngineDevice = null;
        public ArrayList OverlayFonts = null;
     
        public Overlay(Ravage3D.Device Dev)
        {
            this.EngineDevice = Dev;
            this.OverlayFonts = new ArrayList();
        }

        public void PrintText(String TextFont, float TextSize, Int32 X, Int32 Y, System.Drawing.FontStyle TextStyle, String Text, System.Drawing.Color TextColor)
        {
            System.Drawing.Font tempFont = new System.Drawing.Font(TextFont, TextSize, TextStyle);

            OverlayTextC tmpText = new OverlayTextC();
            tmpText.OverlayText = Text;
            tmpText.OverlayColor = TextColor;
            tmpText.XPos = X;
            tmpText.YPos = Y;

            tmpText.OverlayFont = new Microsoft.DirectX.Direct3D.Font(this.EngineDevice.EngineDevice, tempFont);

            OverlayFonts.Add(tmpText);
        }

        public void OverlayRender()
        {
            Microsoft.DirectX.Direct3D.Sprite OverlaySprite2 = new Microsoft.DirectX.Direct3D.Sprite(this.EngineDevice.EngineDevice);
            OverlaySprite2.Begin(Microsoft.DirectX.Direct3D.SpriteFlags.AlphaBlend);
           
            foreach (OverlayTextC t in OverlayFonts)
            {
         //       Rectangle tmpRect = new Rectangle(t.XPos, t.YPos, this.EngineDevice.Width, this.EngineDevice.Height);
                t.OverlayFont.DrawText(OverlaySprite2, t.OverlayText, t.XPos, t.YPos, t.OverlayColor.ToArgb());
            }

            OverlaySprite2.End();


            OverlayFonts.Clear();
        }
    }

    public class OverlayTextC
    {
        public Int32 XPos;
        public Int32 YPos;
        public String OverlayText;
        public System.Drawing.Color OverlayColor;

        public Microsoft.DirectX.Direct3D.Font OverlayFont;
    }
}

I don't know how pretty/ugly this is since I'm not a .NET guru so comments are very much appreciated.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline MyndFyre

  • Boticulator Extraordinaire
  • Moderator
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: RTS Type Game
« Reply #34 on: July 31, 2006, 05:11:00 pm »
For some wierd reason Microsoft.DirectX.Direct3DX is throwing a NullReferenceException..my DLL compiles fine just at run-time it throws that error..odd.

For reference, the compiler can't predict EVERY ERROR that you would ever generate.  Otherwise there would be no such things as bugs.

A NullReferenceException is generated when you're trying to use a reference type (a class object) that has no value (it's like a null pointer) and you call a method or property on it.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #35 on: July 31, 2006, 05:11:55 pm »
I fixed it by just making it a local var, it was odd I was declaring it in my constructor as the type.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #36 on: July 31, 2006, 07:47:12 pm »
Update!

Tested some Node stuff with the new printing code which led me to the conclusion that my design sucks.

The new design which I'll code in tomorrow will feature a Node class which has built in functions for adding onto it and it manages it's own ID's and such as opposed to the previous design via SceneManager..only thing that SceneManager (or Ravage3D.RavageSM) will be good for is adding the Root Node and changing it. Maybe some other functions but that's mostly it.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #37 on: August 02, 2006, 04:08:52 pm »
Update!

Implemented the new node system!

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline MyndFyre

  • Boticulator Extraordinaire
  • Moderator
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: RTS Type Game
« Reply #38 on: August 02, 2006, 04:35:35 pm »
So, it took you all that time just to write text, when I've been doing it for a long time, *and* I have sweet-ass tool tips, and yet *I* suck?  PH33R!
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #39 on: August 02, 2006, 05:21:48 pm »
So, it took you all that time just to write text, when I've been doing it for a long time, *and* I have sweet-ass tool tips, and yet *I* suck?  PH33R!

Nah most of the time was design and making the actual text printing fit into the design, theres more behind the scenes than that. Also let's not forget to mention the SceneNode system which can be extended to include Meshes, Lights, Animations, and Cameras in the future.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: RTS Type Game
« Reply #40 on: August 02, 2006, 06:40:37 pm »

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: RTS Type Game
« Reply #41 on: August 04, 2006, 04:21:25 pm »


:(

At least he cares enough to say how much he doesn't care.  Just think of the feelings of the people he didn't mention! :)
And like a fool I believed myself, and thought I was somebody else...

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: RTS Type Game
« Reply #42 on: August 05, 2006, 04:36:12 pm »
So, it took you all that time just to write text, when I've been doing it for a long time, *and* I have sweet-ass tool tips, and yet *I* suck?  PH33R!
I like how you took the time to black out the names of the characters but then totally missed the "Diaris on Illidan" on the tab.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline MyndFyre

  • Boticulator Extraordinaire
  • Moderator
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: RTS Type Game
« Reply #43 on: August 06, 2006, 09:13:39 pm »
So, it took you all that time just to write text, when I've been doing it for a long time, *and* I have sweet-ass tool tips, and yet *I* suck?  PH33R!
I like how you took the time to black out the names of the characters but then totally missed the "Diaris on Illidan" on the tab.

Yeah, but to my knowledge there isn't a character named Diaris on Illidan.  The tab names are arbitrary.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: RTS Type Game
« Reply #44 on: August 22, 2006, 06:56:36 pm »
Made some small progress since then but I'm not home. Basically I restructured how most of it works to make it more flexible in the longrun. The engine has been renamed Nova Engine and can draw primitives using Vertex Buffers and I'm working on automatically managing lights in a scene which would pave the road for me adding meshes.

I've also been keeping an eye on the XNA framework and may restart the renderer to comply with that.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling