I wish to make movement of my units hex based, like the the turn based strategy game Battle for Wesnoth. Below is an example picture:
I plan to use behavior stacks to represent the amount of hexes a unit can move, unless a better way is suggested. And I don't need the terrain to be in a hexagonal format, but I would like to track how many hexes it would take to move around cliffs, doodads, etc. as well as determining impassible hexes (cliffs and doodads). I'm thinking of using an array of points (though this may be massive for larger maps) for the center of each hex and precalculating them. Then, when a player issues a move order, I can reorder the move using the closest point. Of course, I may be looking completely in the wrong direction, so please point me accordingly and if I am right, please help me on how to implement this.
I just recently noticed that this system is used in this map here. I downloaded it and attempted to observe its system, but to no avail, as the triggers are very messy. Could someone else analyze this?
As a side note, notice that, near the center of the above image, there is the text "4 Slowed" floating above a unit. I've seen this done in SC II, but how do I do it? I will need that for my damage system.
I'm currently making the same type of game and am looking for/using the same ideas you posted. Ive got moving to a set position through clicking a lowered supply depot and ordering a marine to move to the selected unit. i used buff stacks through and an attribute just to show the steps of the unit. but i cant figure out how to take the steps away.
I think you would use a trigger along the lines of "Unit Enters Point Any Point (assuming the only points you have are hex points), Remove 1 RemainingHexMoves (Behavior)." This would be useful if the player clicked a hex or so short of his/her maximum movement, thus the UI would redisplay his/her remaining movement area so that he/she can move again or order a Hold Position.
EDIT: Or determine the distance of the hex clicked and the hex the unit is on and subtract that many behavior stacks.
Yeah what i had was any unit enters within 1.0 of a lower supply depot. remove one buff stack but the attributes still stay so it proves that the stacks were not removed. That is a great idea man. the unit runs out of steps you could order a hold position. ima make a video of what i have so far and put it up.
Is your movement behavior of type Buff, or Attribute?
I don't know why you would use supply depots, though. I just finished making my hex system in terms of finding the points and showing them as hexes. Let me make a screenshot of what I have.
Lol because i’m not very good with the trigger editor and it was just a placeholder to get the unit movement. That’s why i posted on your post. the movement is with the trigger. when i select the marine it stores it and when i select a supply depot in range it moves the marine to the selected depot.
I appear to be making a similar map to both of you, I'm remaking Final Fantasy Tactics using a random terrain generator and unit spawner. I'm yet to edit any data or terrain yet though, as i am currently still in the pen-to-paper drawingboard of my map, but both your maps seem to be coming along nicely.
I wish the guy who made that tact map was more organized because that would be perfect for my map. I still haven't made any progress and am getting frustrated but i really don't want to give up on this map. its nice because all three of our maps are going to be the same concept but very different.
To find the position you probably just need to use some simple math, find out the width and height of a the hexagon, then divide it by the total area width or height to come up with the number of the grid. you will also need to check what row it is in even or odd. Movement is harder because you are going to have to check if a unit or something else will be blocking the path and the movement has to be in terms of the hexagon grid.
Well i dont know any galaxy. and i don’t understand what you guys are telling me to do lol.
Then you're not going to have a very easy time with this :P
If you're serious about this project and becoming a better mapper/programmer, I highly suggest trying out some Galaxy coding.
As for the grid stuff, http://en.wikipedia.org/wiki/A*_search_algorithm check out that link. Basically A* is a pathing algorithm for grid systems. You'll learn a lot about how it's setup and in turn will help you with some ideas on how your grid needs to be setup.
Thank you for finding a way to determine the hex path a unit may take; however, I still require an algorithm for determining which hexes a unit can move to. Also, I have just recently made contact with the creator of the map I linked to in my first post, so he and I will be working together so that I can learn how his hex system works (which so far seems to have been made using only the GUI.) Maybe once my system is complete, I will make a tutorial to help out others.
sweet im starting to understand this after reading up on some articles. however im having trouble as i dont know any galaxy code. could you direct me somewhere to get me started on that?
Okay so I’ve been reading on how to make the hexagonal grid. and i don’t understand how I’m supposed to find the center of each hexagon and save it into an area. how many hexagons will be in the area? will someone please help me out with all this?
Each hexagon is only a unit in and of itself. The points are determined based on the width of the whole model and length on one side and are stored into a 2D array. For example, my hexes are 2.67 units wide and one side is 2.0025 units. My hex model has been scaled so don't just go in and throw values around when they're not yet right. As for making the hex unit, you will create a unit from scratch, based on Default Settings (Unit) race Neutral object type Prop, then make an actor of type Unit, base on Beacon and doodad type Not Doodad. This actor should have only two UnitBirth events: one to create and one to ModelSwap to DecalProtoss 4. There are other events, but I'm not sure they affect anything. Take a look at that map's units and actors if you get confused. I hope that helps.
i know how to make the unit i get that. how do you figure out the size of your hexes? and how do you store the points into an array? how are you supposed to figure out how many hexes will fit inside a certain region?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I wish to make movement of my units hex based, like the the turn based strategy game Battle for Wesnoth. Below is an example picture:
I plan to use behavior stacks to represent the amount of hexes a unit can move, unless a better way is suggested. And I don't need the terrain to be in a hexagonal format, but I would like to track how many hexes it would take to move around cliffs, doodads, etc. as well as determining impassible hexes (cliffs and doodads). I'm thinking of using an array of points (though this may be massive for larger maps) for the center of each hex and precalculating them. Then, when a player issues a move order, I can reorder the move using the closest point. Of course, I may be looking completely in the wrong direction, so please point me accordingly and if I am right, please help me on how to implement this.
I just recently noticed that this system is used in this map here. I downloaded it and attempted to observe its system, but to no avail, as the triggers are very messy. Could someone else analyze this?
As a side note, notice that, near the center of the above image, there is the text "4 Slowed" floating above a unit. I've seen this done in SC II, but how do I do it? I will need that for my damage system.
I'm currently making the same type of game and am looking for/using the same ideas you posted. Ive got moving to a set position through clicking a lowered supply depot and ordering a marine to move to the selected unit. i used buff stacks through and an attribute just to show the steps of the unit. but i cant figure out how to take the steps away.
@EFoG: Go
I think you would use a trigger along the lines of "Unit Enters Point Any Point (assuming the only points you have are hex points), Remove 1 RemainingHexMoves (Behavior)." This would be useful if the player clicked a hex or so short of his/her maximum movement, thus the UI would redisplay his/her remaining movement area so that he/she can move again or order a Hold Position.
EDIT: Or determine the distance of the hex clicked and the hex the unit is on and subtract that many behavior stacks.
@Drakken255: Go
Yeah what i had was any unit enters within 1.0 of a lower supply depot. remove one buff stack but the attributes still stay so it proves that the stacks were not removed. That is a great idea man. the unit runs out of steps you could order a hold position. ima make a video of what i have so far and put it up.
@EFoG: Go
Is your movement behavior of type Buff, or Attribute?
I don't know why you would use supply depots, though. I just finished making my hex system in terms of finding the points and showing them as hexes. Let me make a screenshot of what I have.
Picture:
Lol because i’m not very good with the trigger editor and it was just a placeholder to get the unit movement. That’s why i posted on your post. the movement is with the trigger. when i select the marine it stores it and when i select a supply depot in range it moves the marine to the selected depot.
I appear to be making a similar map to both of you, I'm remaking Final Fantasy Tactics using a random terrain generator and unit spawner. I'm yet to edit any data or terrain yet though, as i am currently still in the pen-to-paper drawingboard of my map, but both your maps seem to be coming along nicely.
I wish the guy who made that tact map was more organized because that would be perfect for my map. I still haven't made any progress and am getting frustrated but i really don't want to give up on this map. its nice because all three of our maps are going to be the same concept but very different.
@EFoG: Go
To find the position you probably just need to use some simple math, find out the width and height of a the hexagon, then divide it by the total area width or height to come up with the number of the grid. you will also need to check what row it is in even or odd. Movement is harder because you are going to have to check if a unit or something else will be blocking the path and the movement has to be in terms of the hexagon grid.
I made a pretty sick Grid Based Movement system back in WC3.
You're going to want to google A* Pathing algorithm, from there it's easy.
This is going to be alot easier with straight Galaxy coding then trying to accomplish in the Data Editor or GUI editor.
If you need any help shoot me a PM.
Well i dont know any galaxy. and i don’t understand what you guys are telling me to do lol.
Then you're not going to have a very easy time with this :P
If you're serious about this project and becoming a better mapper/programmer, I highly suggest trying out some Galaxy coding.
As for the grid stuff, http://en.wikipedia.org/wiki/A*_search_algorithm check out that link. Basically A* is a pathing algorithm for grid systems. You'll learn a lot about how it's setup and in turn will help you with some ideas on how your grid needs to be setup.
This is an interesting concept. I look forward to seeing maps do this successfully. Execution will be everything once you figure out the grid system.
Thank you for finding a way to determine the hex path a unit may take; however, I still require an algorithm for determining which hexes a unit can move to. Also, I have just recently made contact with the creator of the map I linked to in my first post, so he and I will be working together so that I can learn how his hex system works (which so far seems to have been made using only the GUI.) Maybe once my system is complete, I will make a tutorial to help out others.
sweet im starting to understand this after reading up on some articles. however im having trouble as i dont know any galaxy code. could you direct me somewhere to get me started on that?
Okay so I’ve been reading on how to make the hexagonal grid. and i don’t understand how I’m supposed to find the center of each hexagon and save it into an area. how many hexagons will be in the area? will someone please help me out with all this?
@EFoG: Go
Each hexagon is only a unit in and of itself. The points are determined based on the width of the whole model and length on one side and are stored into a 2D array. For example, my hexes are 2.67 units wide and one side is 2.0025 units. My hex model has been scaled so don't just go in and throw values around when they're not yet right. As for making the hex unit, you will create a unit from scratch, based on Default Settings (Unit) race Neutral object type Prop, then make an actor of type Unit, base on Beacon and doodad type Not Doodad. This actor should have only two UnitBirth events: one to create and one to ModelSwap to DecalProtoss 4. There are other events, but I'm not sure they affect anything. Take a look at that map's units and actors if you get confused. I hope that helps.
@Drakken255:
i know how to make the unit i get that. how do you figure out the size of your hexes? and how do you store the points into an array? how are you supposed to figure out how many hexes will fit inside a certain region?