Showing range on hexagonal grid

Posted by user23673 on Game Development See other posts from Game Development or by user23673
Published on 2012-12-06T11:08:27Z Indexed on 2012/12/06 11:34 UTC
Read the original article Hit count: 159

Here is the situation.

I have hexagonal board,and a unit on it,with speed or move value 4.Diffrent terrain has a diffrent cost.When i click on the unit,game should show me a move range.

My solution was to check each hex in range of 4,with A* pathfinding,and if path cost was less than 4 then this hex was in range.Finally game nicely show me range of that unit.

My question is: Is there other solution to search for range on hex grids or square grid,because even if i am really proud of what i did in my solution,i think,it is a little to exaggerated?:))

What make me ask this question?I noticed that when unit speed is 4 or 6 or even 8,time to computing range for my computer was really good,but when speed was 10 and more i noticed that i needed to wait few second to compute.Well in real games i rather dont see something like this and my A* pathfinding is rather well optimized,so im thinking that my solution is wrong.

Thanks for any replies.

© Game Development or respective owner

Related posts about algorithm

Related posts about programming