Thursday 17 July 2014

Creating the Planet

Ok, so I know more or less what I want to make HTP into now.

The first thing I decided is that when real-life data was available, I would my best to use it. The first gem I found was a list of every city and town in the world with a population of more then 15,000, complete with the longitude and latitude, country code, language spoken, alternative names, etc. It was a perfect starting point.

Next I found a vector drawing of the world and all it's borders. It is an equirectangular projection, which made plotting the locations of the cities in my huge city list easy, with this kind of projection, X/Y map directly to longitude/latitude. This is why it's so often used in computer graphics, it makes mapping UVs trivial.



The map was in the SVG vector format, something I didn't have much experience with. There are parsing libraries out there, but it turns out web browsers are already very capable of parsing them for me. So I wrote a little javascript that would let the browser do the hard work and spit out a huge vertex list which I could dump into a text file and use in-game.

I'm using the Unity engine at this point, though I'm fairly certain I'll roll my own further down the line. I'm using so little of the heavy-lifting Unity offers and the overheads for what I am using it for are too high for the scale of what I'm trying to create. For those familiar with Unity, the possibility of over a million GameObjects in a scene at once doesn't smell very good. But for now, Unity will do fine. On another note, I made a production choice very early on with this project, and it might sounds insane to many. I'm doing 100% of the development of HTP on a Microsoft Surface Pro tablet. My reasoning (beyond the joy of developing in a bar in my lunch breaks), is that I'm afraid developing on a powerful desktop machine will only end up with me creating a massive, but horribly inefficient simulation. This approach will force me to keep my code lean and clean, hopefully resulting in a very slick gaming experience for all users in the end.

But, saying all that, I have made a few 'upgrades' :]


No comments:

Post a Comment