Skip to content

Add TileInfo#924

Open
ajhalme wants to merge 1 commit intoC7-Game:Developmentfrom
ajhalme:tileinfo
Open

Add TileInfo#924
ajhalme wants to merge 1 commit intoC7-Game:Developmentfrom
ajhalme:tileinfo

Conversation

@ajhalme
Copy link
Copy Markdown
Contributor

@ajhalme ajhalme commented Apr 6, 2026

Adds basic TileInfo popup.

The implementation is based on a new terrain layer that exposes the targeted terrain tile by selectively removing some of the overlays around the target tile. The terrain layer implementation allows for the Tile Info popup to stay in place even if the map is moved, but it does complicated some things, as we want to ultimately draw in the UI layer.

Implementation follows GotoLayer implementation in that we set the target tile object when we right click somewhere in the open map, or select the target from the context menu. In the TileInfo layer this selection is then ignored by all tiles expect the selected one. Presentation and content logic is mostly confined to the new layer, but the "stripping back the layers" implementation means that some of the overlay layers also need to know about the TileInfo context, so they don't draw parts that would be exposed inside the TileInfo window.

Trickiest part here is hiding the city labels from tiles to the North, NE, or NW of the target tile, as these overlap the target tile. We resort to some gnarly hackery to hide the labels. We want to keep the city (as it shows outside the frame), but hide the label (as it shows up inside).

I'm fairly confident that this approach is aligned with original's, as the size of the TileInfo frame perfectly covers the tiles South, SW, and SE of the target, each of which needs to set to temporarily not draw any units, as these would show up in the Tile Info window.

As a bonus, I added the tile coordinates up top, as I often wanted to know these while debugging.

Note: standalone mode needs the corresponding frame asset.

--

From the Civ Guide

tile_information_in_guide

Original game samples (justification issues probably due to my dodgy Steam install)

tile_information_samples

OpenCiv3

fileinfo_openciv3

@ajhalme
Copy link
Copy Markdown
Contributor Author

ajhalme commented Apr 6, 2026

Added a basic standalone asset for the tile info box: C7-Game/Assets#5

Copy link
Copy Markdown
Contributor

@stavrosfa stavrosfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Except what I already commented on in the code, I have some extra comments.

We should be able to hide the tile info when left-clicking outside the texture. We should also be able to hide it when Escape is pressed. Right now if I press escape this happens

Image

I was also able to move a unit while having this open. I think we should either hide the graphic upon performing some action, or disable other actions altogether (except closing the actual window of course).

I like that now when showing the tile info on a city tile, we can finally see the actual terrain and not an empty city, which was not really helpful. We can add some graphic in the future showing that its a city tile, but it's fine as is for now.

But I just realized, we also can't see any improvements like mines or roads on tiles.

When we inspect a tile that is known to us, but currently not visible, the tile still shows with that half-fog of war overlay instead of being "lit" as if it's visible, like in the original game.

Notes aside, what I think the original is doing, is not hiding and showing "layers", units, etc, but rather, draw on top of what is already being shown, the current tile info.
But we will never know 😅

Comment thread C7/Map/TileInfoLayer.cs Outdated
Comment thread C7/Map/TileInfoLayer.cs Outdated
Comment thread C7/Map/TileInfoLayer.cs Outdated
Comment thread C7/Map/TileInfoLayer.cs Outdated
Comment thread C7/MapView.cs
@ajhalme
Copy link
Copy Markdown
Contributor Author

ajhalme commented Apr 7, 2026

We should be able to hide the tile info when left-clicking outside the texture. We should also be able to hide it when Escape is pressed. [..]
I was also able to move a unit while having this open. I think we should either hide the graphic upon performing some action, or disable other actions altogether (except closing the actual window of course).

I agree with these, though this is starting to sound like #452 ...

The main question probably is: Should TileInfo be part of the terrain layers (and fixed to the map) or part of the UI (floating when panning the map)? The latter doesn't feel right to me, but having a UI element in the terrain makes the whole render sequence more complicated.

Are you sure we want to show improvements? I thought they are one of the layers peeled away so the terrain can shine through. E.g., the horse here is obscured by the mine:

Screenshot at 2026-04-07 23-52-27

Half-fog shouldn't be too hard to remove. I'll look into it.

@stavrosfa
Copy link
Copy Markdown
Contributor

I wasn't aware of the issue linked, but sounds very reasonable.

Are you sure we want to show improvements? I thought they are one of the layers peeled away so the terrain can shine through.

Not 100% sure which I like more tbh, I was commenting more in line with what the original does.

E.g., the horse here is obscured by the mine:

In the screenshot the opposite is happening, not sure what you mean here

Half-fog shouldn't be too hard to remove. I'll look into it.

This falls under "famous last words" hahaha
I hope it treats you better than it has treated me in past my friend 😄

@ajhalme
Copy link
Copy Markdown
Contributor Author

ajhalme commented Apr 11, 2026

Popup based implementation. Now with tile improvements shown, and the half-fog.

The popup mechanism comes with its own control and event screening, so issues relating to interactions while the popup is open should go away. Esc-key works as well.

It seems one can now click through the minimap to trigger TileInfo, so that needs another look.

The way the popup scheme currently sets up the isolation might be a bit off as well, though I might well be misunderstanding what it's actually doing. I've tried to extract the salient parts out of the main popup class.

Copy link
Copy Markdown
Contributor

@stavrosfa stavrosfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good for the most part!

Comment thread C7/UIElements/Popups/TileInfoPopup.cs Outdated
Comment thread C7/UIElements/Popups/TileInfoPopup.cs Outdated
Comment thread C7/UIElements/Popups/PopupOverlay.cs Outdated
@ajhalme
Copy link
Copy Markdown
Contributor Author

ajhalme commented Apr 16, 2026

Current implementation does all I want it to do, but I've been having a bad time trying to make the MiniMap and bottom right info box ignore the right click. Either I'm misunderstanding how event propagation and handling is supposed to work or there's some Godot weirdness at play.

The original game has an elegant solution to the problem of trying to draw TileInfo for a tile at the bottom edge of the screen: the TileInfo modal is drawn out of position, without moving the map. This implementation I've cobbled together doesn't allow this, as it's based this "stripping back the layers" approach. A more robust approach would require changing tile rendering so that individual tiles could be rendered effectively in isolation. I actually tried to do this, but there was a bit too much to adapt in the layer scheme to make it worthwhile.

I've been considering an approach where the screen centered on the target tile, if one tried to get TileInfo on a tile close to the bottom of the screen / close to the UI elements. This could be a nice workaround. But having lookead at this for two weeks, I'm kinda keen to move on to something else.

Anyway, I've force rebased the branch to a single commit to hide my earlier crimes with layers, etc. Some cleanup and reorg. Good to go, I reckon, if we can live with the right click glitches on the UI elements. Fixes welcome, if somebody has a better handle on Godot mouse events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants