I'm working on a small multiplayer game where players can create cities, and these cities will be placed on what's called the "world map." The world map is basically a giant coordinate plane made up of tiles, and the server will load the "world map" in chunks from the database relative to a player's position on the world map.
Now, I want players to be able to send planes from their city to another spot/tile anywhere on the world map. Say for instance player who owns City 1 at position 10,10, wants to create an oil_well at position 70,30. I want a plane to fly from the departure point to arrival point, and client that loads the chunk will see that plane flying across the map.
How can I make the server calculate where the plane is? I have the following information:
speed is the time in seconds that a plane can cross a tile on the world map.
I also have
distance, which is simply calculated as (distance formula):
var distance = Math.sqrt(Math.pow( data.arrival_x - data.origin_x , 2) + Math.pow( data.arrival_y - data.origin_y , 2));
Again, how can I calculate the current position of a moving plane on this world map? Because the plane can fly at many different angles, depending on the angle of departure point → arrival point.