Project Description
A 2D game engine written in C# and XNA. Features animated sprite capability and physics simulation by FarseerPhysics. Includes a level editor, a GUI controls library and a sample RTS game, Factions. Contains A* pathfinding for unit movement and an ants system for AI navigation.

The DEngine requires XNA 3.0 Runtime:
and the .NET 3.5 Framework:
You will also need to install the fonts Miramonte and Miramonte Bold from the XNA Redistributable Fonts pack:
These fonts are also included with the compiled binary, in the file "".

The Documentation will give you an idea how to use the DEngine to make your own 2D game.

DEngine Overview

The DEngine is a 2D engine work-in-progress that includes physics simulation and a level editor for Windows.

There are three projects in the Visual Studio solution:
  • DEngine - Class library which contains the guts of the code. Implements a quad tree, a scenegraph, and several GUI objects.
  • DEditor - A Windows Forms application for creating and editing XML-formatted level files for the DEngine.
  • FactionsGame - A sample working strategy game using the DEngine.

The DEditor main window.

The DEngine uses Tiles, Actors and Backgrounds to make up a game world. These are defined using images and XML files as can be seen in the sample game, Factions.
When you place terrain tiles in the DEditor, surrounding terrain will be altered to form seamless terrain edges. These "transition tiles" are defined in XML also.

Read the full Documentation for more info.

The DEngine also includes a set of GUI objects that you can use in your game, they are within the DEngine.DGui namespace within DEngine. You can see a few GUI elements in the screenshots below.

Factions main menu.

The New Skirmish Game menu for Factions.

The Factions game includes robust multi-unit pathfinding code, an ants system for enemy attack planning, a minimap, and is capable of playing large maps of 250x250 tiles or even more.

The gameplay is currently a little lacking in functionality. So, you can't yet build units. But units placed on the game board can be moved and commanded to fight with enemy units. The enemy will also attack you.

  • Left Mouse - Select unit(s)
  • Right Mouse - Move or attack with selected units
  • Ctrl+A - Select all units
  • M - Move mode for selected units (Left-click to issue move location)
  • A - Attack mode for selected units (Left-click to issue attack target)
  • S - Stop movement for selected units

In-game screenshot of Factions.

Hopefully people may find useful code in here to use in their own game. Hack it apart as you wish!

Outstanding Issues / Future Work

There are numerous issues with this code as it currently stands.
  • There is still a situation in which a transition tile is not added correctly to an interior corner.
  • XML data for levels, actors, and tile transitions are not compiled with the XNA content processor. This is not a big deal but allows the user to modify game data which will become a problem when multiplayer code is written.
  • General code cleanup is required.

Thanks to:

Last edited Jun 25, 2010 at 8:51 AM by spamdog, version 29