HOME

GAME PROGRAMMING RESOURCES

BEFORE YOU START...

Starting from version 5, 3Impact Game Engine supports programmable shaders. Learn more here!

3Impact Game Engine is available both as an .exe and a .dll. The game code will be portable, basically unmodified, from the .exe version to the .dll version of the engine and vice-versa.

This tutorial refers to the .exe version of the engine, which provides a more intuitive way to approach game developing. It's about the same as creating 'mods' for popular games.

If you aren't an absolute beginner, you may want to use the .dll version instead, which is more powerful and flexible. Please see one of the following step-by-step tutorials for details:

Programming 3Impact Game Engine's DLL with Visual C++
Programming 3Impact Game Engine's DLL with Visual C++.NET
Programming 3Impact Game Engine's DLL with Visual C++.NET 2005 Express
Programming 3Impact Game Engine's DLL with Dev-C++
Programming 3Impact Game Engine's DLL with BlitzMax
Programming 3Impact Game Engine's DLL with Framework Pascal

COMPILE YOUR FIRST 3D GAME!
QUICK START TUTORIAL

To code your games you will need a Microsoft® Windows based PC with the latest DirectX® version installed. You don't need DirectX® SDK!

You don't need any rocket-science-installation either to program with 3Impact game engine! Our engine was designed to be EASY to use, even if you have never programmed before.

1. Register 3Impact game engine, download the distribution file and install it.

After installation, the engine is a file named '3impactd.exe', inside the
'C:\Program Files\3impact5\3ImpactWork\' folder, on your hard disk.

You can fully control the engine by coding a simple DLL as follows.

Visual C++. If you own Microsoft® Visual C++, run it.

From the pull-down menu select

File -> Open Workspace

and open the '3impactDLL.dsw' workspace in the

'C:\Program Files\3impact5\3ImpactDLL\BallGame\' folder.

In the smaller window pane, select the FileView tab, click the 'Source Files' folder and visualize the '3impactDLL.cpp' file by clicking it.

Dev-C++. Alternatively, you can code and compile your DLL with a free compiler named Dev-C++. Download it here (version 5.0 beta 9 - 4.9.9.2). Important! Make sure you download the full version (9.0 Mb)!

Run Dev-C++, from the pull-down menu select

File -> Open Project or File

and open the '3ImpactDLL.dev' project in the

'C:\Program Files\3impact5\3ImpactDLL\BallGame\' folder.

2. On your screen should be visible the source code of the game.

All lines preceded by '//' are comments. Each comment section explains what the code following it does.

When compiled, the code becomes a file named '3impactd.dll', in the
'C:\Program Files\3impact5\3ImpactWork\' folder, on your hard disk.

When the engine (3impactd.exe) is launched, the DLL (3impactd.dll) is executed and the game coded in it is run.

Visual C++. In Visual C++, you can compile the DLL and run the engine by pressing [Ctrl]+[F5] key combination.

If you just switched from a different project, select Build -> Rebuild All menu option first, to ensure the .dll file is re-built.

When asked for the 'executable for debug session', browse to 'C:\Program Files\3impact5\3ImpactWork\' and select '3impactd.exe'.

Dev-C++. In Dev-C++, you can compile the DLL and run the engine by pressing [F9].

If you just switched from a different project, select [Ctrl]+[F11] first, to ensure the .dll file is re-built.

3. The simple game is controlling a ball by pressing [Ctrl] and arrow keys. You can exit by pressing [Esc]. Try modifying the DLL code, compile and run again.

4. The source code of 3Impact engine games is basically a list of function calls. All 3Impact function calls start with 'i'. For example, 'iCameraCreate()'.

To know how to call all available 3Impact functions, see the Reference document.

5. A compiled game is a stand-alone software. For example, after compilation, the interactive-ball game can be separated from the developing contest and run on other computers as follows:

  • copy the

    'C:\Program Files\3impact5\3ImpactRelease\3impact.exe'
    'C:\Program Files\3impact5\3ImpactRelease\bsdlicense.txt


    files to a custom empty folder in your system, outside the '3impact' folder.


  • copy the

    'C:\Program Files\3impact5\3ImpactWork\3impactd.dll'

    file to the custom folder, and rename it to '3impact.dll'.


  • copy the

    'C:\Program Files\3impact5\3ImpactWork\default_res'

    folder and its content to the custom folder.


  • Your custom folder is the stand-alone version of the interactive ball example you have compiled, and can be ported to other Windows systems. Double click the 3impact.exe file in it to run the game.


  • If needed, you can rename the 3impact.exe file in your custom folder. Just remember to rename the 3impact.dll file the same way, for example 'mygame.exe' and 'mygame.dll'. You can also change the icon of the .exe file by using an icon manager like this.

    6. This is just an example, the entry point. Additional commented source code and specific tutorials are available to guide you, step-by-step, through the gate of game programming!

    And don't forget to visit the forum, where you will find updated information, meet other 3Impact users, share information, show off screenshots of your games under development...

    See you there!


    ADDING A NEW CUSTOM PROJECT
    TO THE PROGRAMMING ENVIRONMENT

    1. In Windows 98, click on the Start button and select

    Programs -> Windows Explorer

    In Windows XP, click on the Start button and select

    Programs -> Accessories -> Windows Explorer

    A new window should open.

    2. In the left pane, expand My Computer by double-clicking it.

    In the left pane, expand (C:).

    In the left pane, expand Program Files.

    In the left pane, expand 3impact5.

    In the left pane, expand 3ImpactDLL.

    In the right pane, click once on BallGame, press [Ctrl]+[C] on your keyboard and then press [Ctrl]+[V].

    A new folder named Copy of BallGame should appear in the right pane.

    In the right pane, click once on Copy of BallGame, press [F2] on your keyboard and then type a new name for the new folder.

    3. Run your compiler and open the workspace/project in the new folder.

    The source code is now a copy of the one in the BallGame folder and you can alter it.

    CUSTOM NAMED PROJECTS

    Although stored in specific folders, for simplicity, all 3Impact's sample project/workspace files are named the same way. Also, all projects will generate .dll files with the same name.

    However, giving your custom projects an unique name may be preferable, especially if you are going to work on many projects at the same time and/or your compiler allows for project group management.

    Cloning the default BallGame project to a custom named project can be as easy as opening it with your compiler and saving it back with a different name, or as hard as editing each single project file manually.

    Please refer to your compiler's documentation for details about renaming an existing project/workspace.


    ENGINE EXECUTABLE WORKFLOW

    When you launch the engine executable, for example 3impactd.exe, it immediately loads your compiled .dll, for example 3impactd.dll, and executes the code you have written in the PreInit(), Init(), Run(), Exit() and PostExit() callback functions.

    Callback functions are executed as outlined below:

    3IMPACTD.EXE 3IMPACTD.DLL
    Start. Loads 3impactd.dll into memory, executes PreInit()
    void PreInit()
    {
    ...your code
    {
    Shows settings panel, goes full-screen (or windowed), executes Init()
    void Init()
    {
    ...your code
    {
    DLL-loop. Executes
    Run(), renders the scene, executes Run() again and so on. When the loop is broken executes Exit()
    void Run()
    {
    ...your code
    {
    void Exit()
    {
    ...your code
    {
    Frees user created resources, exits full-screen (or closes window), executes PostExit()
    void PostExit()
    {
    ...your code
    {
    Unloads 3impactd.dll, exits back to Windows

    REMARKS

  • The frequency of the DLL loop is 1/75 seconds. It means that your code in the Run() callback is entirely executed 75 times per second, regardless of the current display refresh rate (frame rate).


  • The frame rate is variable and depends on the amount of data to process and render. At best, the engine will refresh the screen 75 times per second. If the GPU cannot render the world fast enough, the frame rate is dropped.


  • If the CPU cannot process the Run() callback or the game dynamics fast enough, the entire simulation is slowed down, and the screen is never refreshed (still image or black screen).


  • The DLL loop is broken when the [Esc] key is pressed, or when the iExit() function is called. The [Esc] key break can be inhibited by calling the iEscEnable(FALSE) function.


  • 3Impact is DirectX® based, and when running in full-screen mode may not be halted by pressing the [Ctrl]+[Alt]+[Canc] key combination. Furthermore, if some fatal error locks the engine, chances are that you will need to reboot your system to regain control. These limitations aren't there when the engine runs windowed.


  • By default the startup settings panel is shown. The user can choose not to show it again by clicking a check-box, but then there are only two ways to show it back: (1) by deleting the 'settings.bin' file created by the engine in its current folder, (2) by calling iSettingsPanelSkip(FALSE) in the .dll code.


  • At startup, the engine always sets its executable file's folder as current working directory. It then checks whether the (absolute or relative) file path, provided as command line, is a valid .dll file. If it is, the .dll is loaded and its folder becomes the current working directory. If it is not, the engine tries to load, from the current folder, a .dll with the same name of the engine executable file, with .dll extension.


  • Windows and DirectX are registered trademarks of Microsoft Corporation.