Lots and lots of cities

Turn this into a tactical game and ill play every single day

5 Likes

And thus it has been done

(Only one unit type and troops can walk on water but oh well)

15 Likes

Have nukes been removed?

this look’s amazing i can’t wait to try this out (even though it’s out now it’s still exciting to play)

bro why cant the current game look like that

please tell me youre joking bru

Isn’t it kind of crazy how this little earth simulator became the now very very popular Rise of Nations?
Anyways, can I have some insight on how this works? I’d really love to know.

1 Like

You would have to make an HTTP request to an external API that returns data about certain cities like name, population, latitude and longitude etc (or if you happen to have downloaded a large database saved to your computer). After that the fun part would be deriving a method to convert lat/lon coordinates into a position on the Earth model.

One way to do it is by defining a Vector3 which represents the offset from an origin, in this case the centre of the Earth model at the equator. The vector’s components will be calculated by interpreting the lat/lon coordinates of each city using a spherical coordinate system.

Latitude represents the angle in degrees from the equator while longitude represents the angle in degrees from the prime meridian which runs through London.

First make sure to convert latitude and longitude from degrees into radians lat = math.rad(lat) and lon = math.rad(lon). Then you can calculate the components of the offset by doing:

  • x = radius * math.cos(lat) * math.cos(lon)
  • y = radius * math.cos(lat) * math.sin(lon).
  • z = radius * math.sin(lat).

Note: This differs slightly from the formulas in the linked wikipedia article because latitude measures the angle from the equator instead of the angle from the north pole like in the article. This means we have to do math.cos(lat) instead of math.sin(lat) and vice versa.

2 Likes

Thanks for the feedback, I’ll certainly use it somewhere, not fully sure where though.