Alfie Noakes wrote:I am making an RTS, with huge maps, 500000*500000, and I am looking to work on the fog of war aspect now.
I am also hoping to hundreds of ships, that will all have radar (circular), which will be their sight.
I am thinking that a tile-based method would require huge arrays, or be very innacurate, with 100*100 squares (which would still require 25 million cells)...
The view size is always 1366*768 pixels...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Alfie Noakes wrote:Even with grid cells of 1000*1000, it seems to drastically reduce performance when I tried to implement a very crude method of fog of war: drawing black rectangles on spots where no ships could see. The frame rate dropped from 100+ to about 5-6.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Alfie Noakes wrote:I had a quick look at sparse matrix on wikipedia, and it gave me an interesting idea. Because of the way I draw stuff in my game, I might be better off drawing a black rectangle to cover the view, and then subtract polygons from that depending on if it is in range of the ships that I draw.
What I normally do is, since I can zoom in quite far in a huge map, I only draw objects that will be visible in the view. So I could then only check the radar range of those visible objects, and from there I could subtract their view from the fog (big black rectangle).
If you have any suggestions on how to better that idea, or just a better idea, please feel free to suggest it.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ok, by referring to X, Y and Z, do you mean finding the distance between different objects' coordinates? If so, I only need X and Y - it's 2D. I think I could store a ArrayLists in each team that contains all of the visible ships and structures, by checking distances between enemy and friendly ships and structures.