Turn-based Territory game mechanic

0 favourites
  • 3 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • hi I'm looking to do a turn-based game like Risk...selecting territories needing to know bordering and adjacent "tiles" and possibly a map generator.

    just wondering if anyone has done it or worked a similar process. I searched forums and didn't find much.

    I was thinking of setting up a grid system of numbers and number all the tiles, then flag all the ones that makeup a specific territory. Then I would need to give each territory a number. But then it would have to be setup so I knew which territories were adjacent.

    Like:

    0 10 20 30 40

    1 11 21 31 41

    2 12 22 32 42

    3 13 23 33 43

    When territory 11 attacks you could check the territory they are attacking to see if it adjacent.

    if (atk_terr > (att_terr - 11) AND < (att_terr + 11))

    *although I would have to compensate for being in the first or the last column which is fine.

    I could maybe fill a giant tilemap with squares and make the shapes of the territories but it probably wouldn't look the best.

    Anyone else have ideas? Thanks!

  • One idea you could use to specify the neighboring countries is to keep the countries spaced and add roads between them. So a neighbor would be overlapping one of the same roads that overlap the source country.

    Another idea would be to nix the roads and just use a text variable with a comma separated like of the uids of the neighbor countries. It's a lot more tedious to set up though. Could be simpler by making an in game tool to help do it.

    Anyways got my example to simple game status. I don't think the odds are that fair somehow.

    dropbox.com/s/fahqcjo44t8lgsb/risk_like_test2.capx

    generating a map is trickier, mainly because we'd want it to look good. I've found a hand designed map usually looks better.

    But here's one idea for the map generation, and selection of neighboring generated countries. The generation could be a lot quicker, it's mostly slow here because I only create one sprite per frame.

    dropbox.com/s/b9kany4mlibjk5q/map_generation_test1.capx

    It looks pleasing enough, although islands are an issue sometimes. I guess you'd also need to place a border otherwise the winning player would have a Pangaea instead of many separate countries.

    Anyways maybe some of that will give some ideas.

    -cheers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for those! some good ideas! the map generator is nicely done, much better than my attempt. But needing to know bordering states is probably my biggest issue right now.

    Another idea would be to nix the roads and just use a text variable with a comma separated like of the uids of the neighbor countries. It's a lot more tedious to set up though. Could be simpler by making an in game tool to help do it.

    I like this idea, but I'm thinking of having about 20 maps. I want to dynamically figure out neighboring territories. Also my idea is to have friendly neighboring territories add to your defense (of the territories being attacked). So I will need some sort of function that I can keep calling to identify counts of bordering territories.

    Because I am having 20 maps I don't know if I should the actual territory objects should be made up of "tiles" and then bordered somehow. That way I don't need to hand make (26 to 48 * 20) sprites! Then there's the issue of identifying the shape of a territory.

    Lots to consider!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)