deathruler Posted January 7, 2008 Share Posted January 7, 2008 Hello guys, I've had trouble with creating a sphere, and then i need to unfold it, and make a chart out of it. What I'm trying to do, is a little hard to explain, but I'll do my very best. I'm trying to create a game, and when a user registers with the game, he must be assigned to a planet. That planet should exist of land, water, rocks, trees, etc.. A planets index: What I'm trying to do is split the planet to squares, witch would hold the actual player size. So, players, water, rocks, trees take 1 spot of the planets size. So lets say, if the planet got 200 land marks, 200 players can be on the planet. But if the planet got 1 square water, and 1 square rocks, 198 players can be on the planet. So basically, I'm trying to generate a number from a random diameter, which tells me how much space the planet has. From a sphere to a map: Basically what happens if you convert Earth to a map, you'll get this. And that, is what I'm trying to create. That image, should be generated by a diameter i give a function and split into spaces which will be the spots. Now the planet does not need to have a perfect hyperbole, but it should look like it. Example: http://img242.imageshack.us/img242/968/worldmo1.png The red lines, and squares you see will be the index. But only full blue squares ( brown ) will be a spot which a player can own. The red crosses, are not fully blue spots, and shouldn't exist and remain black like the rest. So eventually you'll end up with a squary 2 sided hyperbole. Now, the reason i posted this is because my skills in sphereology ( math in spheres ) is none. I just don't know how to flatten a sphere to a map, and decide which spots should be land, and the other ones empty. Can someone help me with the formula's, and the way i should do it after that point. I'm good with php, don't get me wrong, but this kind of math is just to much for me. Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/ Share on other sites More sharing options...
fert Posted January 8, 2008 Share Posted January 8, 2008 why the hell are you doing this in php? go for C++ Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-433173 Share on other sites More sharing options...
deathruler Posted January 8, 2008 Author Share Posted January 8, 2008 Why on earth would i create anything in c++, if I'm developing a browser based game in php? If i wanted it in another language, i would have asked "Which language should i use", and i would never have posted it in a "php forum". Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-433663 Share on other sites More sharing options...
Barand Posted January 8, 2008 Share Posted January 8, 2008 see http://en.wikipedia.org/wiki/Map_projections Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-433773 Share on other sites More sharing options...
deathruler Posted January 9, 2008 Author Share Posted January 9, 2008 I already read that, but that doesn't explain show the formula's needed to do this. And as i said, my math isn't good with these shapes. My native language is also Dutch, and as you read through this map projection tutorial, the English used in that is much to hard for me. When i read it, i spend most of the time converting words from English to Dutch, and still not understand what their saying in it. There is a tutorial like that on wiki in Dutch ( kaartprojectie ), But that one isn't good. That is why i came here, perhaps there is someone who would like to explain step by step how to do it. And for those who see beyond the map projection option, the Robinson projection is what i prefer above the map projection. Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-434540 Share on other sites More sharing options...
Barand Posted January 9, 2008 Share Posted January 9, 2008 If you just want to know how much space the planet has, it's 4 * PI * r^2 (r being the radius) Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-434828 Share on other sites More sharing options...
btherl Posted January 16, 2008 Share Posted January 16, 2008 Probably a silly question, but can't you generate the map after unfolding instead of generating it on a sphere and then unfolding? Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-440626 Share on other sites More sharing options...
cowfish Posted February 8, 2008 Share Posted February 8, 2008 Have you researched on methods to convert Cartesian Coordinates to Spherical Coordinates. My maths is not too hot but that's where I would start researching. I think. Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-461602 Share on other sites More sharing options...
cowfish Posted February 8, 2008 Share Posted February 8, 2008 Also I think you sahould create a class called Planet, with an 2D grid array as an instance variable. Those arrays would hold objects of Players, Trees, Rocks etc. Is that what you need? Quote Link to comment https://forums.phpfreaks.com/topic/84901-creating-and-unfolding-a-sphere/#findComment-461603 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.