How do you parametrize spheres?

Discussion in 'Planetary Annihilation General Discussion' started by lecopivo, May 1, 2013.

  1. lecopivo

    lecopivo New Member

    Messages:
    2
    Likes Received:
    0
    Hello,

    I would like o apologize because this post is probably going to be only for mathematically oriented fans but the strategy game on sphere is so interesting from mathematical point of view that I have to ask this question.

    I really liked the march 22nd live stream. And I wondered what kind of coordinates do you use to parametrize the planet. It looked to me that for the cost fields you just store the cost field on the cube(which is easy to parametrize because it is flat) which surround the planet and than project it onto sphere.

    From math class I'm always used to use spherical coordinates for sphere. But It is obvious that they are not the best call for cost fields. You would not get reasonably uniform resolution of the cost field(dense at poles and sparse around equator).

    Each spherical coordinate is singular at one particular meridian(line of longitude). So I was thinking what about to use two spherical coordinates. That the singular meridian of first spherical coordinates would go through prime meridian and the singular meridian of second spherical coordinates would be half of the equator(that half which goes through Pacific ocean, not through Africa).

    Now if you divide sphere to two pieces according to which map you use at particular point you would get something like tennis ball. http://www.pachd.com/free-images/househ ... all-01.jpg

    The advantage is that these maps overlap. So if you do some local computation that you can stay in one map. And this is not possible when you parametrize sphere with cube(you have 6 different non-overlapping maps) so you have some troubles at the edges of cube.

    So I would like to ask what king of coordinates do you use for something like unit position. Do you define position by 3d vector which has unit length or do you use some maps(like sperical or that projected cube). What are advantages of your approach? and what are drawbacks of your approach?

    Thanks Tom
  2. smallcpu

    smallcpu Active Member

    Messages:
    744
    Likes Received:
    72
    Read here on Mavor's blog. That should give you some idea how they do it.


    But basically terrain gets split into seperate chunks that get accessed as needed. Iirc they simply use rectangles which then get deformed as necessary. That way they can always create a pretty uniform coordinate system for any necessary calculations.
  3. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    The flow fields themselves are based on sectors that are roughly a "flat" patch and that have their own basis.

    When generating the planet we use a cubemap style param for doing the initial generation and generating the base height data that gets fed into the CSG. The one caveat is that the distance between each piece of the cubemap is evenly divided by angle instead of the texels having a varying size (well technically they vary but not as much).

    Most of the game looks at the planet as a mesh and not as an ideal sphere.
  4. Pawz

    Pawz Active Member

    Messages:
    951
    Likes Received:
    161
    Kind of a spin off on the topic, but does this mean that theoretically the units should be able to move along just about any surface, or are there limitations? For example, spiral ramps, layered bridges, Möbius strips, caves with overhangs, and so on?

    Obviously there are more issues than just pathfinding like camera angle etc, but I'm just wondering if the core possibilities are there.
  5. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    Theoretically it could be extended to do that but we do make some assumptions right now that would break on a mobius. Overhands are no problem though.
  6. ooshr32

    ooshr32 Active Member

    Messages:
    749
    Likes Received:
    141
    So... Spider bots that can hang upside down!?
  7. miturian

    miturian Member

    Messages:
    75
    Likes Received:
    32
    I wanna fight on a mobius :)
  8. lecopivo

    lecopivo New Member

    Messages:
    2
    Likes Received:
    0
    Thanks everyone for answer!

    Yeah I was thinking about something like this! It would be massive if we could supply any mesh as "planet".
  9. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    You kind of can but we would still have to work through all of the edge cases. We'll get to this eventually I'm sure.
  10. ta4life

    ta4life New Member

    Messages:
    67
    Likes Received:
    0
    Mobius is for noobs, give me a Klein bottle to play on.

    But even the Mobius strip would probably be the greatest achievements in RTS in the last decade.
  11. Pawz

    Pawz Active Member

    Messages:
    951
    Likes Received:
    161
    Well, as far as I understand what Mavor is saying, is that most of the game looks at the terrain as a 3d mesh, instead of taking the regular shortcuts that a 2d map-based game does. Which would be a lot more work for the game to do, but would definitely allow for just about any shape & size of map.

    I wonder if they are using a common center of gravity for a planet to determine up/down.. Although that would cause issues with an odd shaped asteroid. Hm. Perhaps the game creates a gravity 'field' around a playable area, so that projectiles act like they're being fired across a flat plane.
  12. lophiaspis

    lophiaspis Member

    Messages:
    215
    Likes Received:
    2
    Does this mean you can have "concave" maps? Play on the inside of Ringworlds, Dyson Spheres, O'Neill Cylinders? That would be unbelievably awesome :)
  13. smallcpu

    smallcpu Active Member

    Messages:
    744
    Likes Received:
    72
    As they've said on the livestream, currently no. But they will look into options in the future to make that maybe possible.

    One of the issues may be that they use certain assumptions like where the centre of gravity is for calculations. Maps which would play on the inside of things would have their gravity (for gameplay) all wrong then and units wouldn't work properly anymore. (For ringworlds etc. you need gravity (or centrifugal forces to be more exact) to go outside of the world instead of inside.)
  14. ravener96

    ravener96 Member

    Messages:
    32
    Likes Received:
    0
    If you make the game assume every object is a dought with the inner circle being exactly as large as the outer in the negative you can have single model for round and torus planets, also the ability to make composite planets would be cool. Then we could have a planet with a few rings around, wink wink.
    For gravity i would assume you can assign gravity to be towards a point in the middle of a planet or along the midle of the ring of a torus.

Share This Page