Click here to Skip to main content
15,867,453 members
Articles / Multimedia / DirectX

Game Engine

Rate me:
Please Sign up or sign in to vote.
3.78/5 (6 votes)
20 Nov 2009CPL2 min read 47.2K   1.5K   34   8
A game engine first prototype

Introduction

Engine is codenamed wg3dfx and works in an environment DirectX API, which means that it is adaptable to all versions of Windows (from version 2000 to Windows 7). Engine uses Truevision SDK 6.5, and to ensure the proper functioning of Truevision, you'll need to download the SDK 6.5 and MTV3D65.dll set as a reference. For audio support, wg3dfx used irrKlang and you will need to download and install the same. You can find more about it at woodgamesfx.

I call the code collection as game engine because it has almost all elements of game engine. You can use it as is or you can improve some parts of code.

Background

These are some screen shots:

Using the Code

The project is separated in three code sections: unit, scene and game engine section.

For example, this is the main game engine loop:

C#
public void GameLoop()
{
    while (bLoop)
    {
        fTime = TV.AccurateTimeElapsed();

        if (SimuLatePhysics)
        {
            Fizika.PhysX.Simulate(TV.TimeElapsed() * 0.0025f);
        }
        if (Teren.Land == null)
        {
            Kamera2.Update(TV.TimeElapsed());
        }
        else
        {
            Kamera2.UpdateTerrainCamera(ref TV,  Teren.Land  );
        }
        GetMouseLandPosition = Teren.GetTerreinPosition(ref Scene, 
                               Kamera2.tmpMouseX1 ,Kamera2.tmpMouseY1 );
        UpdateScene();
        TV.Clear(false);
        Teren.DrawTerrain();
        if (SkyBoxs.Atmos != null)
        {
            SkyBoxs.DrawSkyBox();
        }
        Svijetlo.RenderLight();
        XActor.CrtajJedinice("Sve",ref Text2D,ref Globals );
        XModel.CrtajJedinice("Sve");
        Scene.FinalizeShadows();
        Partikali.DrawParticles("All");
        if (PodlogaTest != null)
        {
            PodlogaTest.DrawFlor();
        }

        if (Oblaci.Atmos != null )
        {
            Oblaci.DrawClouds();
        }

        if (Magla.Enabled)
        {
            Magla.DrawFog();
        }

        if (Voda != null)
        {
            Voda.DrawWatter();
        }       

        if (bDrawCoordinateSystem)
        {
            DrawCoordinateSystem();
        }
        VMannager.DrawVehicale();
        VMannager.CheckInputs(Kamera2._inputs, ref Fizika.PhysX);

        Dekoli.RemoveDecals(TV);
        Dekoli.DrawDecals();
        Scene.RenderAllMeshes(true);
        Scene.RenderAllActors(true);
        if (Kamera2.tmpMouseB1)
        {
            XActor.DeselectUnits();
        }

        if (Kamera2.tmpMouseB1)
        {
            Screen.Action_Begin2D();
            Screen.Draw_Box(XActor.Mouse1Coor.x,
            XActor.Mouse1Coor.y, XActor.Mouse2Coor.x,
            XActor.Mouse2Coor.y, Globals.RGBA(0, 1, 0, 1));

            Screen.Action_End2D();
        }
        XActor.UpdateActors(Kamera2.tmpMouseX1, Kamera2.tmpMouseY1, 
                            Kamera2.tmpMouseB1, Scene, Kamera2._inputs);
        TV.RenderToScreen();
        Application.DoEvents();
    }
}

In total, there are about 12,000 lines of code in all three sections.

Points of Interest

I will be publishing the first version of the open source engine very soon. Engine is in the development stage and some parts of code are not fully documented. I prohibit the use of parts of code, distributed library and executables for insulting the religious, racial, ethnic and gender level, causing damage to other parts of the code or using the files that come with WoodGamesFX. Software code and supporting files can be used for educational, commercial and noncommercial purposes as long as they meet the above-mentioned conditions. I will not be responsible for the use of code by the above conditions.

I hope that the information and content will benefit individuals or groups interested in creating computer games, simulations or other forms. We suggest you use this information for fun and learning.

History

I was developing this code for several months. If you have any questions about how to use the code, please send me an email at info@woodgamesfx.com.

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)


Written By
Software Developer
Croatia Croatia
Programer

Comments and Discussions

 
QuestionWhere are dlls? Pin
Ali Aboutalebi21-Nov-09 7:49
Ali Aboutalebi21-Nov-09 7:49 
AnswerRe: Where are dlls? Pin
Member 387363321-Nov-09 8:10
Member 387363321-Nov-09 8:10 
You can ignore them. I think it should work without them. As I remeber I use my gefxem.dll in some other project , but I forget delete them. XNAHavok is C# wraper for Havok physics engine, but you can delete every think about it. Because TV3D have Newton Game Dynamics included by default.

Nigdar ni bilo da ni nekak bilo !!!

GeneralRe: Where are dlls? Pin
blackboardx12-Aug-10 10:16
blackboardx12-Aug-10 10:16 
AnswerRe: Where are dlls? Pin
Jacob van Eijk25-Nov-11 20:44
Jacob van Eijk25-Nov-11 20:44 
AnswerRe: Where are dlls? Pin
Member 139774068-Feb-20 10:11
Member 139774068-Feb-20 10:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.