Sorry if my title is a little vague, I wasn't entirely certain how to word this specific question.
I'm developing a small little MMORTS game, and in this game is the world map which consists of thousands of tiles (the view on the client is an isometric grid). The world map data is stored in a MySQL database table. This table stores each individual tile and the tile data. So when the player visits the world map screen, the server will load a chunk (12x12) of the world map at a time for the client to render.
Now, it's come to the point where I need to allow players to send planes from their cities that are on the world map, to other tiles around the world map. For instance, a player that owns City 1, which is located on tile 100,100, wants to send a plane to an oil well on tile 60,60.
How can I show the movement of that plane from the city -> destination in real time across all clients in the most efficient manner? Let's assume each game server can have hundreds of players, so we can expect thousands of flights across the world map at a time.
When a flight is created, it would be stored in the database with data such as destination_x
, destination_y
, origin_x
, origin_y
, flight_speed
.
And when a client loads a chunk of the world map at whatever coordinates, I can query the database on each chunk load to see if any flights are currently crossing this chunk. However, how can I do this? With the data I just mentioned that would be stored for a flight, how could I determine if a flight is currently in a given chunk? Let's assume a chunk is 12x12 tiles.
How should I go about doing this, and is my current thought-out method the most efficient approach to this problem?
~~~~~~~~~~~~
If context helps, here is a picture of the world map:
I would like for flights to show up across this world map as they are heading to a destination from a given origin. The plane should only load if it's crossing this viewed chunk by the client.
~~~~~~~~~~~
I apologize if this question is still too vague, I tried my best to explain my current situation and problem. If you have any questions, please ask. Thanks!