1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Game Mechanics Working on a tile strategy game

Discussion in 'Game Design, Development And Publishing' started by Psycho_666, Oct 20, 2019.

  1. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    Hey everyone...
    Short story:
    So some time ago I bought Carcassone on Steam, played a bit, got heavily disappointed by a few things and refunded. Now I'm thinking, you know, I can stay disappointed, or I can make my own card tile strategy game. So I will...
    Main part of the question:
    So I want to make a card style tile based strategy game. Basically you build stuff on semi proc gen land and battle it out with your opponent/s.
    My struggle is the internal mechanics.
    I'm thinking each tile having bunch of states - ownership, what's built on it, what status it is, meaning low level, high level, destroyed, culture level, influence levels, religion, etc...
    Other option is data structure and each tile calls to the ds to check all the variables.
    I can program both, but I am not sure if there isn't another better way of implementing this.

    The easiest for me would just be to set one parent object tile and plop a bunch of tiles on the map so they will all act identical and will save their own variables in themselves so no possible mixing of variables can happen.

    The actual game:
    The idea is, you have a large land with a few kingdoms, some mines, mountains, rivers, etc. You gather resources, build stuff and take over the opponent's through war, culture, religion, etc. Your resources buys you cards, with cards you build stuff, more stuff you build, more cards you unlock, larger more diverse deck you have to build with. Its basically simplified Medieval Total War with cards.

    TL;DR: I want to build a tile based strategy game and I am wondering what is the best way to store and use all the variables for each tile...

    Specific code - I do not want. I want basic ideas. Figuring out the code is a pleasure you will not take away from me.
     
    Calvert likes this.
  2. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    991
    ARRAYS! They are the best and can handle everything your thinking of. Other people will recommend ds_lists and ds_maps, but for once, I got here first, and the truth is that arrays are 1 million times better, for about 54 reasons.You can mold them into any kind of thing you want, and they would work perfectly for the kind of game your dealing with
     
    Simon Gust and Psycho_666 like this.
  3. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    So instead of DS I will use arrays? And again calling variables from each tile to it's it's respective row in the array?

    My question is, why is this better than a separate objects and variable stored in each object method?
     
  4. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    991
    Well, instances are good aswell(call them instances or frosty cat will lecture you on the difference between objects and instances)
    In alot of ways they are better cus they can hold variables and do things. And all the things that move on the screen need to be controlled by an instance.
    You could probably make the whole game with instances alone.
    But I think arrays will come in real handy with all the statistics, classes of different buildings, resources, etc.
    It's like building a library of all the different parts
    Instances can go into it : read from a certain part, get what they need and then do what they need to do.
    When you really get a good array database going, most of the game is powered by it or . refers to all the info in it alot. And it ends up making all the code in the project alot smaller and easier to manage
     
    Psycho_666 likes this.
  5. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,934
    Arrays are garbage collected, so they're good if you want to handle a lot of temporary data (e.g. generate battle stats for an entire army when a battle starts, but represent them as a single "unit type / amount alive" counter on the map view). I'd say there's never any reason to use ds_grids since they do exactly what a 2D array does, and we'll soon get support for arbitrary-dimensional arrays which are even more powerful... stacks, queues and priority queues can do some REALLY cool stuff, though, all of which are relevant in the AI (e.g. use a queue to store the list of cells in A* pathfinding, and use a priority queue to sort AI actions based on how beneficial they would be).
     
    Psycho_666 likes this.
  6. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    Ok, quick design question:
    The plan is the entire game to take place on something like 10x10 pieces map. Now since the view is not going to be top down, but somewhat at an angle, imagine Don’t Starve style 2D sprites and view, so the further away objects will be smaller.
    Perspective, Pete… That’s the word you are looking for…
    Anyways, that basically means there will be more in the background than is gonna be playable on the map.
    What is a good way to deal with that extra land?
    I can do the Heroes 3 thing and just cut the map…
    [​IMG]
    That’s the easiest way… Just cover it up in fog or clouds and pretend it doesn’t exist.

    Another option is to surround the entire thing with mountains or a sea, so the entire game basically takes place on an island or in a valley, locked away from the rest of the world…
    That’s kinda more realistic and justifies the existence of other maps, since there will be a few…

    The last option I am thinking about is the Hoard route - just acknowledge the fact it’s all a virtual board game and show the freaking board…
    [​IMG]

    Honestly I’m thinking of option number 2 that will take me most effort, but will look the best. It will make the map look like part of the world…
    [​IMG]
    Like the sea on the left - it’s an artificial barrier, but still doesn’t break the illusion of a huge epic world
     
  7. NewHopeGames

    NewHopeGames Member

    Joined:
    Sep 7, 2019
    Posts:
    4
    I have recently started experimenting with a very similar style of design for a tbs counter style wargame. When you mention a 10x10 pieces map, how big do you plan on having those pieces? In my design I have tiles and units which are 64x64 pixels and each tile is an instance. I originally started with a 1024x768 room and now a 1920x1024 room. So there are 30 instances across and 14 down and I have a controller which creates the entire map randomly. As these tiles are created they will randomly choose the type of terrain. I messed around with grids but ended up going back to the original design. The challenge here involved the movement/attack with the ai and the player because units had to remain on each title. In the end I am not sure if it is the most efficent way of handling this design but I am very satisfied with how it all came out. I have not experienced any slow downs or frame rate issues and the ai is tweaking up really well. I believe it is a good start at a decent engine for game designs like this. I hope to release screenshots and an early alpha of the game fairly soon.
     
    Psycho_666 likes this.
  8. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    Not sure honestly...
    I want to make this 10x10 the smallest 1v1 map. It will have a couple mines, a couple NPC villages to take over and so on... Larger maps the player should be able to scroll through. The idea is, scrolling through the map will change the size... The tiles will be purely visual. Yeah, I think I will use objects for each tile simply because it is the easiest way I can see dealing with everything.

    If I want to add new gameplay features - I just program a new tile object and bam - extra gameplay...
     
  9. NewHopeGames

    NewHopeGames Member

    Joined:
    Sep 7, 2019
    Posts:
    4
    If you are going small like that I don't think you will have a problem with using instances if I am not since my maps are fairly large and not even using views. I took advantage of parent objects and that made things easier as well since I have several types of units and terrain.
     
    Psycho_666 likes this.
  10. Stillwel

    Stillwel Member

    Joined:
    Jun 25, 2019
    Posts:
    3
    I think u should use instances , cause whatever you can do in array it can be simplified in instances. though the downside would be that it can make it hard to keep track of where things should be or where the line of codes is written in.
     
    Psycho_666 likes this.
  11. Rob

    Rob Member

    Joined:
    Jul 12, 2016
    Posts:
    713
    Using 1 object per tile can make it easier to make your own A* path finding, if that's what you need to do also.

    I'm working on a project that draws an isometric map with different heights and the grid I'm using stores a list that holds data for each cell.

    I could use the indexes of each list for path finding like I use instance id's but I just find objects easier to use and conceptualize.

    Think about how you're going to save the game data too, though. Are you going to be converting the data stored in the objects into lists and then into a grid or map? Would it be easier to just stick with lists in the first place?
     
    Psycho_666 likes this.
  12. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    I'm using instances. There is only one tile object and it's all instances. They all act identical, which allows the player to treat each piece of land on the map (tile) the same.
    Most of the code is in that one object in the mouse events...
    Oh that's so intimidating... I'm just gonna make the AI cheat and the player will be responsible for their own pathfinding...
    Not entirely sure, honestly... But I can easily save everything in an .ini file...
     
  13. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    NEW QUESTION:
    More so asking for advice...
    So I'm doing the cards setup now. I wonder what to do. I have a couple options...
    I can show all cards on screen. In the beginning this won't be an issue, since there will be just a few cards. Later on the screen will be massively overcrowded with cards.
    I can split the cards and sort them by buildings and population. That way you have 2 decks instead of one and later on the screen will not be overcrowded.
    Split the cards by class - resources, war, religion, culture, etc, so the player sees only the class it wants to see.
    Not really sure what to do...
     
  14. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,934
    How about having checkboxes that the player can use to sort / search through the cards at will? That way they can look for the card they want by changing the "decking" conditions on the fly.
     
    Psycho_666 likes this.
  15. Psycho_666

    Psycho_666 Member

    Joined:
    Dec 5, 2017
    Posts:
    135
    So showing the entire deck and giving the player the option to sort it the way they want... That's ... Something I haven't thought about...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice