Request for a TCastleGrid Component

So, I am wanting to create a grid based city building game in CGE as shown in the screenshots below from UE.


When browsing the forums I noticed Someone had requested advice upon this topic, And feel it would be a great component for CGE as what If I have uneven terrain when I place a building that takes up 6 grids for example? as shown in the images above, This would only get more complex.

Did give a good explanation on how such a system and can be achieved using TCastleTransforms and TCastleViewport.MouseRayHit Then have some sort of GameMapManager unit that keeps track of the game map (as array[0...SizeX, 0..SizeY] of TMapTileSomething ) and this is where I personally get stuck.

examples\viewport_and_scenes\detect_scene_hit is a great demo for a simple grid game.
GitHub - castle-engine/wyrd-forest: Game about walking in a weird forest, planting healing trees, and shooting evil targets. Game sponsored by Patreon supporters, showing off various Castle Game Engine features. is another good demo for placement on terrain though lacks height checking.

I’d like to note such a component would make it easier for game developers to create many types of games much easier and faster. Unity has many examples on such a system, same for unreal engine. I’ll leave some links.

I was looking into CGE TiledMap though couldn’t find any demo’s for what I am wanting to achieve
3D Tilemap in Unity
Unreal Engine City Building Game
This would open up a whole new field of games such as RTS < Real time strategy games


Yes, we plan to have 3 features improving this, but with varying levels of “when they will actually be done” :slight_smile:

  1. Something that should happen sooner (definitely in 2023, maybe even before 7.0 release so 1-3 months): “snapping” for TCastleTransform operations. This will allow you to position things on a virtual grid.

    You could combine it with TCastleStickToSurface class to have height automatically adjust to terrain (see examples/terrain/ demo in CGE) and this way have snap in XZ, and TCastleStickToSurface determine the height.

  2. In more distant future (probably not in 2023):

    • We may likely have own editor for flat maps, built in CGE editor.

      For now, you can use Tiled integration, Tiled maps | Manual | Castle Game Engine . This works great, but is only for flat maps – so not really what you need, I know :slight_smile:

    • Our own editor may be enhanced to allow placing things in 3D, and then it would be like “snapping on steroids”.

I do want to also research more what other engines offer – thank you for the links, I’ll study everything :slight_smile:

1 Like