Hints & Tips

Video cards support

HGE will run even on low-end video cards, including built in video cards such as Intel Solano (i815 chipset).


For performance reasons Gfx_RenderLine, Gfx_RenderTriple and Gfx_RenderQuad accumulate consecutive primitives with the same texture and blending mode and then render them with a single call to DirectX. In most cases you will not see any difference and don't have to deal with this batching at all. But to be sure and safe it is recommended to group your primitive rendering calls first by primitive type, then by texture, then by blending mode. Also you can use Gfx_StartBatch and Gfx_FinishBatch for ultra fast rendering of large primitive arrays.

Texture dimensions

The dimensions of any texture must be a power of 2. And it is not recommended to use textures bigger than 1024x1024, because they can be slow and some video cards may have no support for them. Try to place all your graphics onto several big textures to minimize texture switching that affects performance.

Using Z-buffer

Use Z-buffer only if you need to, because this affects performance. By default the Z-buffer is turned off. To turn it on set the HGE_ZBUFFER system state to true with System_SetState call. When the Z-buffer is turned on, it is a good idea to sort your rendering in front-to-back order for better performance.

Clearing screen

Clear the screen only if you need to, because this affects performance. If you cover the whole screen with graphics each frame - there is no need to clear. Although, when using Z-buffer you probably have to clear the screen anyway to reset it.

Scaling and rotation

If you plan to scale or rotate your sprite - ensure that the graphics spread at least for 1 pixel beneath the alpha mask and/or bounding box edges to avoid distortion.

Sprite and tile libraries

You can use hgeAnimation helper class as a sprite or tile library. Just don't call the Update method and select the needed sprite manually with the SetFrame method.


You can use asignment operator (=) or copy constructor to easily clone an instance of most helper classes. Eg. in case of sprite pointers the syntax will be *sprite2=*sprite1; or hgeSprite *sprite2=new hgeSprite(*sprite1); Exceptions are hgeGUI, hgeResourceManager and hgeParticleManager.

Distortion mesh and Sprite without a texture

You can use hgeDistortionMesh and hgeSprite instances without a texture to apply colorful effects to your whole scene or it's part. Try using BLEND_ALPHAADD blending mode.

Displaying a mouse cursor

To display a mouse cursor, render anything you want at the coordinates returned by Input_GetMousePos in your frame function. For more correct behaviour do this only when Input_IsMouseOver returns true.

Using external sound routines

If you don't want to use BASS for handling sound, and have your own sound routines, set HGE_USESOUND system state to false with System_SetState function before calling System_Initiate. Now you can also get rid of BASS.DLL.

Managing HGE interface pointer

Any time you need access to HGE, you may call the hgeCreate function, then use the received pointer and release it with Release. Or you may get the interface once during startup and store it in a global variable, then release during cleanup. Although the latter is supposed to be 'bad style', this works fine with not very big projects and all HGE helper classes use this approach.

Float to int conversion

If there are a plenty of float to int conversions in your code, you may use the /QIfist option of Visual C++ compiler. With that you can't be sure of the rounding method being used, but in most cases it doesn't matter and you'll receive improvement in performance. To activate this option, type it into Project Options text box in the Project->Settings...->C/C++ dialog tab for debug and release configurations. If you use different compiler you should find similar option or use one of fast float to int conversion routines from the net instead of standard cast.

Speed synchronization

To make your game independent of execution speed, scale all your internal speeds by the value, returned by Timer_GetDelta. Alternatively you may set HGE_FPS system state to use fixed FPS mode.


While developing, you may keep all your data in plain disk files. Then just compile the resource pack with pkzip and attach it with Resource_AttachPack. Nothing else need to be modified in your code to use resource pack. See Compiling resource pack section for more information.