|
|
|
|
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.
|
|