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: http://www.microsoft.com/downloads/details.aspx?FamilyID=6521d889-5414-49b8-ab32-e3fff05a4c50&displaylang=en
and the .NET 3.5 Framework: http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7&displaylang=en
You will also need to install the fonts Miramonte and Miramonte Bold from the XNA Redistributable Fonts pack: http://creators.xna.com/en-GB/contentpack/fontpack
These fonts are also included with the compiled binary, in the file "RedistributableTTFs.zip".
Documentation
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:
![DEditor.png DEditor.png]()
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.
![FactionsMenu2.png FactionsMenu2.png]()
Factions main menu.
![FactionsMenu.png FactionsMenu.png]()
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.
Controls:
![FactionsInGame.png FactionsInGame.png]()
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.
Thanks to:
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: http://www.microsoft.com/downloads/details.aspx?FamilyID=6521d889-5414-49b8-ab32-e3fff05a4c50&displaylang=en
and the .NET 3.5 Framework: http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7&displaylang=en
You will also need to install the fonts Miramonte and Miramonte Bold from the XNA Redistributable Fonts pack: http://creators.xna.com/en-GB/contentpack/fontpack
These fonts are also included with the compiled binary, in the file "RedistributableTTFs.zip".
Documentation
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.
Controls:
- 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.
- Z-priority! A proper rendering order with respect to units and terrain needs to be written. Should be able to have units be rendered in front of or behind other units/terrain.
- General code cleanup is required.
Thanks to:
- http://forums.tigsource.com/index.php?topic=8856. - DBB for his awesome Mecha Construction kit I've used in Factions.
- http://lostgarden.com/2007/05/dancs-miraculously-flexible-game.html - Danc's Miraculously Flexible Game Prototyping Tiles for the bush graphic used in Factions.
- http://www.codeplex.com/FarseerPhysics - The Farseer Physics engine which handles all the physical simulation in the DEngine.
- http://www.ziggyware.com/readarticle.php?article_id=130&rowstart=0 - mdx4ever for his SceneGraph tutorial.
- http://www.gamedev.net/reference/articles/article934.asp - Gamedev for their excellent article which I drew upon for the terrain transitions.