Compare
Community

Join thousands of game developers in our forums and read over 2 million messages

Enter the Forums

Vouchers

Purchase vouchers for use on future orders or as a gift for others.

View Vouchers

Toolbar

toolbar powered by Conduit

Free Software

Download a free version of FPS Creator

Dark GDK vs. DarkBASIC Professional

Using the standard DarkBASIC Professional example programs we recorded the following frame rates. This was from simply duplicating the DarkBASIC Professional code with Dark GDK functions. Frames displayed are the average frame rate.

Test Dark GDK DarkBASIC Professional Difference
Camera Showcase 230 165 65
Matrix Showcase 398 249 149
Image Showcase 285 276 9
Particle Showcase 889 785 104
Advanced Terrain 733 692 41
Sphere Mapping 940 935 5
Road Terrain 523 408 115
Animation Showcase 260 189 71
Sprite Showcase 1504 1259 245
Core Example 27 13 14
Compilation Times

As well as increased FPS rates you will also notice significantly faster compilation times from Dark GDK thanks to the speed of the Microsoft Visual C++ compiler. Other areas where C++ excells such as with extremely fast looping functions, integer, string, float and memory handling and object orientated development structures will also increase the overall speed of your game. Game start-up times are virtually instantaneous after loading (there is no decompressing of required DLLs to the local drive) and the memory footprint is also smaller. Final EXE build size is only 1.8 MB (with the 3D engine fully invoked) as opposed to a minimum of 6.39 MB. The EXEs also compress well - a 1.8 MB EXE can be RAR'd down to only 750 KB.

An example program

When using the Dark GDK you can expect to see significant benefits in all parts of development from a reduction in compile time to faster frame rates. Here's an example showing a simple program that creates a cube that is rotated in the main loop of the program. You can also see a loop in the program that does nothing more than create a random number. Later on the frame rate is displayed on screen.

`	DarkBASIC Professional Source Code
sync on
sync rate 0
 
make object cube 1, 10
 
do
   rotate object 1, object angle x ( 1 ) + 0.1, object angle y ( 1 ) + 0.1, object angle z ( 1 ) + 0.1
 
   for a = 1 to 100
      for b = 1 to 100
         for c = 1 to 100
            d = rnd ( 100 )
         next c
      next b
   next a
 
   set cursor 0, 0
   print "fps = " + str$( screen fps ( ) )
 
   sync
loop

After compiling and running this program in DarkBASIC Professional the frame rate was displayed as 13 frames per second. Here is the same program was created using the Dark GDK. The source code is as follows:

void DarkGDK ( void )
{
	dbSyncOn   ( );
	dbSyncRate ( 0 );

	dbMakeObjectCube ( 1, 10 );

	while ( !dbEscapeKey () )
	{
		dbRotateObject ( 
				1,
				dbObjectAngleX ( 1 ) + 0.1f,
				dbObjectAngleY ( 1 ) + 0.1f,
				dbObjectAngleZ ( 1 ) + 0.1f 
			);

		for (int a = 0; a < 100; a++)
		{
			for (int b = 0; b < 100; b++)
			{
				for (int c = 0; c < 100; c++)
				{
					int d = dbRnd ( 100 );
				}
			}
		}

		char szFPS [ 256 ] = "";
		strcpy ( szFPS, "fps = " );
		strcat ( szFPS, dbStr ( dbScreenFPS ( ) ) );
		dbText ( 
			dbScreenWidth ( ) - 20 - dbTextWidth ( szFPS ), 
			dbScreenHeight ( ) - 40,
			szFPS
		);

		dbSync ( );
	}
}

When running the program the frame rate stayed at a constant 27 frames per second which demonstrates a major improvement over the original DarkBASIC Professional version - that is with a straight DarkBASIC Professional to Dark GDK function for function replacement, but by modifying the original code we see other improvements when using the Dark GDK:

Another test used the same code but this removed the line "d = rnd ( 100 )" from the DarkBASIC Professional program and "int d = dbRnd ( 100 );" from the Dark GDK program. The frame rate of the DarkBASIC Professional program was displayed as 52 frames per second while the Dark GDK program raced ahead at 2995 frames per second.

In a further test the code inside the loop was changed to "d = a * b * c" in the DarkBASIC Professional program and "int d = a * b * c" in the Dark GDK. The DarkBASIC Professional program ran at 38 frames per second while the Dark GDK executable ran at 2988 frames per second. Substantial increases like this are very common when using the Dark GDK due to the core functions being handled directly by the C++ compiler.

Community

Find help from a large online community in our Dark GDK forums.