I'm creating an RPG/simulation game which is similar to the Uncharted Waters Series. The game allows the player to control a fleet to explore and navigate the world on the world map. My Game stores the world map as a tiled map into a 2158 * 1080 2D array.
The problem I'm facing is I want to simulate the ocean currents and trade winds on the world map so when the player is sailing on the map, the speed of the fleet will be affected by the current and the wind. It does not have to be a really accurate simulation because this is not a high-detailed simulation game but it should resonably simulate the ocean currents and the wind.
- Need to come up with a data structre to represent the ocean currents
- For each point (x,y) on the map, the data structure should provide a fast way to look up what is the strengh and direction of the current at that particular point
- The current can have 8 directions (N W S E NW NE SW SE).
- The strengh of the current is represented as an Int
- Same requirements for trade wind so I think the solution should be the same
I'm thinking about dividing the world into several regions and each region can be subdivided into smaller regions like a quad tree. For look up I can do a contains(x,y) and find out which region the point is in and then for sub-regions to the same thing until it arrives a leave of the tree which stores the strengh and direction of the current.
Is that a reasonable solution or there are better ways to do this? What are the gotchas for implementing it?
Thank you for you answers!