Click here to Skip to main content
Click here to Skip to main content

Game Engine

By , 20 Nov 2009
 

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:

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)

About the Author

Member 3873633
Software Developer
Croatia Croatia
Member
Programer

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionDebuggingmemberJacob van Eijk25 Nov '11 - 21:00 
I had no errors in my project but when I do debug it tells that no source is available.Confused | :confused:
 
please help
QuestionWhere are dlls?memberaliaaa21 Nov '09 - 7:49 
Hi, thanks for your great article.
I downloaded both of "Truevision SDK 6.5" and "irrKlang" but there are 2 references in your gefx project that I don't know where I have to find them: "gefxem.dll" and "XnaHavok.dll". Confused | :confused:
Please help me.
AnswerRe: Where are dlls?memberMember 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?memberblackboardx12 Aug '10 - 10:16 
I need just gefx.dll,gefxem.dll bu i seach web site but not found.
I need help.
AnswerRe: Where are dlls?memberJacob van Eijk25 Nov '11 - 20:44 
I know were you can find "XnaHavob.dll".
You can download it from here:
[^]
But I don't know were you can download "gefxem.dll".

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 20 Nov 2009
Article Copyright 2009 by Member 3873633
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid