- Home /
World map and 3D view coordination.
Hello,
this is more about asking for best practice, rather than specific solution.
I am making a naval game (PC only) and i would like to have rather large (~1000km x 1000km) fictional "caribbean sea"-like area. I have the ship model, controls and "physics", but I would like to know a few things...
Currently I am using a sea mesh, which is following the boat and is large just enough for player to not see the edge. Every boat on this mesh is bouncing up and down according to sea waves. There are islands on fixed positions on the map and player simply sails with the sea mesh to the islands.
1) How to make a world map view with players position and other ships position in players area with smooth transition (not switching to a different scene)? One thing comes to my mind - having a plane with same dimensions as the world itself and a orthographic camera watching this world and showing the positions based on the coordinates of the boat. But I guess that this solution is not very smart and pretty heavy.
Other solution would be a different scene for the world map and sharing the coordinates with the 3D scene to spawn the models in 3D / spawn sprites on 2D.
2) Is it a good idea to have all the islands on the same map in the same scene? I would like to have rather large and detailed islands - roads, buildings, few ports... Should I use different scenes for map "tiles", or is it fine to use one huge map? Ive heard, that the only things rendered are the ones that the currently used camera can see - if this is true, I could make one huge map, right?
Other solution could be spawning the island as the player comes closer to it, and to spawn the details (buildings, etc) even closer.
Feel free to share any concern or issue that would come to your mind. Thanks
P.S.... other solution, that i can think of, would be using ~ 5km x 5km tiles and putting, lets say, 9 of them on the map with the center one in 0x0x0 coordinates. As the player crosses the tile at the border, the tile on the other side would become the center one and all the coordinates would recalculate..
These 5kmx5km tiles would be prefabs. For 1000km x 1000km map, that would require 40 000 tiles, but as most of the map is water, we can use prefabs only for islands, and shallow waters, reducing prefab count drastically.
example: Player is in the center of the map. He travels only on the z coordinate to the north. If he reaches the z at 2500, he is teleported to z = -2500 and all the objects are teleported to a new z coordinate = ("z coordinate before" - 2500) and the northern tile is moved to the 0,0,0 , beco$$anonymous$$g the center one. Three tiles at the south are discarded and three tiles at the top are spawned according to some matrix that stores neigbouring tiles info.
New coordinate calculations would go like this: If |player_x_coordinate|=2500 then player_x_coordinate = inverse value of player_x_coordinate , z_coordinate stays the same. All other object x_coordinate = x_coordinate - player_x_coordinate (- & - = + )
.... same goes for the case that player hits max z coordinate first.
Your answer
Follow this Question
Related Questions
How to set up a world map texture on a series of individual country meshes? 1 Answer
How to import picture size 43000 x 21000 pixels 3 Answers
How to use Static batching, occlusion baking etc while using floating origin for a large world ? 0 Answers
Apply a Rotation in World Space based on Quaternions 2 Answers
Generating Chunks 1 Answer