# Strategy Game Demo using CGE and Tiled

**URL:** https://forum.castle-engine.io/t/strategy-game-demo-using-cge-and-tiled/30
**Category:** News
**Created:** [January 12, 2019, 7:21am UTC](https://forum.castle-engine.io/t/strategy-game-demo-using-cge-and-tiled/30 "2019-01-12T07:21:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [January 12, 2019, 7:21am UTC](https://forum.castle-engine.io/t/strategy-game-demo-using-cge-and-tiled/30/1 "2019-01-12T07:21:24Z")

</div>

| [![Castle Game Engine - strategy game demo - hexagonal Tiled map](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091937-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091937.png "Castle Game Engine - strategy game demo - hexagonal Tiled map") |
| [![Castle Game Engine - strategy game demo - designing menu in CGE Editor](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091907-200x104.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091907.png "Castle Game Engine - strategy game demo - designing menu in CGE Editor") |
| [![Castle Game Engine - strategy game demo - main menu](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091915-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091915.png "Castle Game Engine - strategy game demo - main menu") |
| [![Castle Game Engine - strategy game demo - orthogonal Tiled map](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091923-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-091923.png "Castle Game Engine - strategy game demo - orthogonal Tiled map") |
| [![Castle Game Engine - strategy game demo - isometric staggered Tiled map](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092108-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092108.png "Castle Game Engine - strategy game demo - isometric staggered Tiled map") |
| [![Castle Game Engine - strategy game demo - isometric Tiled map](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092153-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092153.png "Castle Game Engine - strategy game demo - isometric Tiled map") |
| [![Strategy game demo - instructions screen, designed using Castle Game Engine Editor](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092207-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092207.png "Strategy game demo - instructions screen, designed using Castle Game Engine Editor") |
| [![Strategy game demo - humans victory screen, designed using Castle Game Engine Editor](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092642-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092642.png "Strategy game demo - humans victory screen, designed using Castle Game Engine Editor") |
| [![Strategy game demo - aliens victory screen, designed using Castle Game Engine Editor](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092809-200x116.png)](https://castle-engine.io/wp/wp-content/uploads/2019/01/Screenshot-of-selection-at-2019-01-06-092809.png "Strategy game demo - aliens victory screen, designed using Castle Game Engine Editor") |

I’m happy to present a new large _Castle Game Engine_ demo: _“Aliens vs Humans”_. It is a simple strategy game with maps designed using Tiled.

The demo is in the [examples/tiled/strategy\_game\_demo/](https://github.com/castle-engine/castle-engine/tree/master/examples/tiled/strategy_game_demo) directory of our source code. You can also download precompiled versions for [Windows](https://castle-engine.io/miscella/strategy_game_demo-win64-x86_64.zip) or [Linux](https://castle-engine.io/miscella/strategy_game_demo-linux-x86_64.tar.gz).

Our Tiled maps API was enhanced with various methods to make writing games easy:

- [TCastleTiledMapControl.PositionToTile](https://castle-engine.io/apidoc-unstable/html/CastleTiledMap.TCastleTiledMapControl.html#PositionToTile)
- [TCastleTiledMapControl.TileRectangle](https://castle-engine.io/apidoc-unstable/html/CastleTiledMap.TCastleTiledMapControl.html#TileRectangle)
- [TTiledMap.TilePositionValid](https://castle-engine.io/apidoc-unstable/html/CastleTiledMap.TTiledMap.html#TilePositionValid)
- [TTiledMap.TileNeighbor](https://castle-engine.io/apidoc-unstable/html/CastleTiledMap.TTiledMap.html#TileNeighbor)
- [This is all building upon improvements I announced last week](https://castle-engine.io/wp/2018/12/28/tiled-maps-improvements/) to the [Tiled](https://www.mapeditor.org/) support in CGE.

These methods work for all map orientation types (hexagonal, orthogonal, isometric, isometric staggered). This way you can handle e.g. hexagonal and orthogonal maps the same way, with the same code, without worrying about the differences how “neighborhood” is defined differently for hexagons (6 neighbors) and orthogonal maps (4 or 8 neighbors, depending on `CornersAreNeighbors`).

The user interface is designed using [Castle Game Engine Editor](https://castle-engine.io/manual_editor.php). The game code uses [TUIState to split the game into states](https://castle-engine.io/manual_2d_user_interface.php#section_ui_state). Each state UI is loaded from a separate `.castle-user-interface` file. Thus, this is also a demo of how to use TUIState with CGE editor, to organize a larger game into states.

This demo was requested by [Castle Game Engine supporters on Patreon](https://www.patreon.com/castleengine). I took some time to make it, as I wanted to make it perfect 🙂 If you’d like to see more crazy CGE demos, [join us on Patreon](https://www.patreon.com/castleengine)!
