How would I go about making a TILE based Grand Strategy game?

Hi everyone!

  1. What do you want to achieve? I wish to make a game which uses a tile based movement system for divisions. (Somewhat like Hearts of Iron 4)

  2. What is the issue? I genuinely don’t know the best way to do this, without it getting stuck in a peninsula.

  3. What solutions have you tried so far? I’ve tried the PathFindingService, but that is more designed for humanoid characters, not for parts trying to follow a path by jumping tiles (which are different sizes as well)

Thanks! (I just want to know how I should do it, do NOT write me code.)

1 Like

easiest way is probably to make a grid. Assign each grid value an ID (A1, B8, imagine chess). Then make the movement of your characters hop between different grid values.

1 Like

I can see that, however each tile will be different shapes and sizes (as this is based on historical events), so I don’t think that’d work very well. Thanks though!

Something like the following:

Ideally you’d create a graph* representing your map.

*graph

A graph is a set of nodes connected by edges. In your case, each node is a tile and each edge represents which tiles are next to each other. Here is a picture of a graph:

Source: Mathematics | Graph Theory Basics - Set 1 - GeeksforGeeks


Something like:

-- Map is a ring of 3 tiles
local mapModel = workspace.Map
local graphOfMap = {
    {Name = "Tile1", Data = {}, Instance = mapModel.Tile1, Neighbors = {"Tile2", "Tile3"}};
    {Name = "Tile2", Data = {}, Instance = mapModel.Tile2, Neighbors = {"Tile1", "Tile3"}};
    {Name = "Tile3", Data = {}, Instance = mapModel.Tile3, Neighbors = {"Tile2", "Tile1"}};
}

You can then use breath first search (common algorithm you can find online) to find the shortest path between tiles for path finding. You can also move stuff between tiles because each tile knows which tiles it’s next to using the Neighbors table.

For example, in the video you gave, your graph would look like:

Screenshot 2024-02-17 at 8.40.02 PM

With each circle as a table with a reference to all of the neighbors around it within your array of tiles.

Adding onto Bends idea, you could make unions representing each area (I’m assuming that the map won’t be done in a UI), and use a GetPartsInPart to return a list of all colliding zones to where your troops are stationed. By doing this, you could automate the neighboring, making it easier for fixes and updates. Then you could have a separate module which holds all data related to the ID of each of these parts. To move the troops, you could just tween them between the two points, using a downwards raycast to determine their Y value, preventing them from sinking into the map