Into The Beach🏖️ - My game progress and Targeting Range Indicator

Hello,

I shared my work on Breadth-First Search before:
https://forum.gdevelop.io/t/my-first-game-progress-and-bfs-breadth-first-search/

Now I want to share my Targeting Range Indicator.

Into The Beach🏖️ is a working name because my tiles are inspired by Into the Breach - the name and the map will change later. The idea is to make a non-canon Fallout 2 dungeon crawler.

This is my first game, and I am learning by doing. As I mentioned in my first post, I struggled a lot because the pathfinding behavior was not working with my diamond isometric tiles, so I made a virtual grid. The only downside is that my player now “teleports” instead of “walking,” but I guess it’s fine for a turn-based game.

What I did since then: now there are already 3 player-controlled characters with individual stats and initiative-based turn order.

Then I started working on the Targeting Range Indicator and got stuck again - none of the ideas were working. I wanted walls to block my line of sight. It was working fine in 4 directions, for example, I set the gun range to 5, then I highlighted 5 tiles in each direction one by one, and if a tile is blocked, it stops expansion. But then I thought that only 4 directions for a game where most guns will be ranged is not enough.

Then I found Bresenham’s line algorithm:
https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

It was interesting but hard to apply in GD. However, I realized that instead of counting tiles, I could use a line, and the line worked well.

First, I created a line from the player to the mouse cursor, which highlights tiles and stops at blocked tiles:

ScreenRecording2026-03-20033625-ezgif.com-video-to-gif-converter

GIF is lagging a bit but it is much faster and smoother in game.

I think it was pretty cool, but again I wanted full targeting range, so I decided to make 64 static lines in all directions. Basically, when I open a weapon, it creates 64 lines, and the lines highlight my field of view. Of course, the lines will be invisible later - this is just an example of how it works:

ezgif.com-animated-gif-maker

I think it works fine for a small grid. If the grid were bigger, there would need to be more than 64 lines because there would be gaps at longer distances. Loading time is faster than expected - it takes maybe 0.5 seconds to draw the field of view. Also, if you have any advice on how to improve performance, it would be highly appreciated, as I am new to GD. Now I just need to set distance of the tiles and limit gun range based on a weapon type.

Overall, I am happy with the result. Again, it’s not the best way to do it, but I am glad that GD is flexible enough for alternative solutions. Next step will be creating smart enemies, and maybe I will release a prototype on itch.io in a month or so.

All the best :raised_hands:

3 Likes

The link tools pathfinder might be easier. Sort of. There’s a learning curve but it is very similar to the pathfinder once the tiles are linked and setup. It’s the setting up that can be tough to learn.

https://wiki.gdevelop.io/gdevelop5/extensions/link-tools/details/

1 Like

Thank you for sharing, I didn’t know about this. Yes, this looks more like real pathfinding, because what I did is more like a flood fill. I check the first 4 tiles in the 4 directions (up, down, left, right) and set their distance to 1 (tile variable). Then, from all 4 new points, I check another 4 tiles with the condition that the tile has not been checked yet (so it does not check inward) and set the distance to 2, etc. If a tile is blocked, the path goes around it. So if there is a wall in front of the player and the player has 2 move points, it cannot just teleport to the other side, it has to go around. But I think what I did is heavy on performance, so let’s see how it works when I expand the map.

ezgif.com-animated-gif-maker (1)

Also, I use a square grid, and now moving diagonally costs x2. I am not sure if that is fair. Logically, a diagonal line is longer, but maybe x2 is too much. It is very hard to do x1.5 in this flood fill logic. This is my first game, so I guess I will keep it simple.

1 Like