How would I insert almost every city on Earth as a dot?

So I was quite inspired by @Hyperant’s game Rise Of Nations because he loaded in almost every city on Earth, but I also wonder how he did it.

I want to make a strategic war game like his but on a flat 3D map with dots as cities. However, I don’t know the first place to start programming-wise. I already know he uses something like The World Cities Database which has a lot (if not most) of the cities on Earth as a spreadsheet file. Still, I don’t know how I would, first of all, put everything on the spreadsheet into a Roblox Script, and secondly, create and position all the dots to represent where all of the cities are.

This is probably going to be very complex, but I really want to try and make a game like his. Can anybody help me?

1 Like

easy there is a video that kinda goes over that but a while ago from byteblox https://www.youtube.com/watch?v=a_CmPOAkRRM you can probably get a idea from this

image
Alright, well; let’s look here.

We got the city name’s, the latidue and longitude, what country it’s in and the population

Step 1 would be to convert everything in roblox-readable data, prefferably a dictionary structured as:

{
cityName = {lat, lng, country, ...}
}

and step 2, is to read it!
lat and lng are already seperated, so that’s nice; we can just make a new part and position it their respective X and Z coordinates (literally just put in the lat and lng)
You would probably want to multiply them aswell.

So… hardest step? Step 1. have fun on that since i have no clue on how you wanna do that

only way is to make it like a .json file thats online im pretty sure since roblox reads json files

Thanks for the reply, however the file I am trying to use already has locations, and I just want to find out how to insert the cities into the game with scripts, then convert the latitude and longitude of that city into a Robox Vector3 Value.

Thanks for your reply! Do you have any idea how I would convert the Latitude and Longitude of a country into a Vector3 Value? And also would there be a faster way to insert every city manually?

in the video it says how to just make the lng the X, make the Y = 1 or something and Z the lat

You need some kind of map projection from spherical coordinates (longitute and latitude) to 2D ground plane, similar to the mapping you might have seen in Blender for how the “UV sphere” is mapped to a 2D texture.

There are actually a lot of different projections, each with its own tradeoffs. Some preserve area, some distances, etc. You’re probably best off with a Mercador type that maps to a rectangle and forces all of the area distortions to be worst at the poles where no one lives. You probably want an aspect ratio more like the Miller variant: Miller cylindrical projection - Wikipedia

The wiki gives you the formula for converting spherical angles to 2D coordinates, you just need to scale the results to your map scale. Also, the Lua math library will not have inverse hyperbolic sine, so you have to implement that yourself using an identity, such as:

sinhinv(x) = math.log( x + math.sqrt( 1 + x*x) )

1 Like

Thanks for your reply, but how would I even start to scale my map?

Oh, for scaling I just meant that you’ll need to apply some uniform multiplier to the coordinates you get from those functions, to scale them down to fit in some bounds that are reasonable for a Roblox map, like a theme park version of the world. You obviously can’t make the whole world at the 1 foot = 1 stud or 1 meter = 3 studs scales developers typically use for life-size builds.