Terrain 2.0

Discussion in 'Planetary Annihilation General Discussion' started by jaykat77, March 2, 2015.

  1. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Little status update:
    I think I have found a solution to add smooth slopes. Well, at least I have understood what my algorithm does, and why it behaves in such way. Which means I should be able to simply decline the ground which makes connected regions blend. Now I only need to find a way to do that, without resolving to expensive stuff like cubic splines.
    guest1, blightedmythos and cdrkf like this.
  2. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    If only we could get height adjustments via a paintbrush method so maps could be made manually. Then you could generate a map, and go in a manually add your slopes where you want them. This would probably be better from a gameplay perspective. Still, really awesome work! I can't wait to see this in game. Maybe it will inspire uber to finally do more with terrain themselves.
  3. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    I don't believe it can be? Correctly me if I'm wrong @exterminans but the controls for this are all built into the engine.
  4. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    I think you may have missed this post: http://steamcommunity.com/app/233250/discussions/2/558751813508748383/
    This is just proof of concept, I think. (Though pretty cool!)
  5. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Heightmap via paintbrush has one severe disadvantage: You have an insane amount of data to store. A cubemapped heightmap with 2048px*2048px per side, 8 bit grayscale, comes to ~25MB of raw data, even with efficient compression (and forget about lossy compression such as JPEG for height maps!), that's at least 1-2MB for the height map. And 2048*2048 is nowhere enough for larger planets, as this directly limits how fine grained cliffs and coast lines can be. If you don't watch out, you can easily end up with 50-100MB of almost incompressible data just for the heightmap alone.

    So the logic consequence in the first step is not to store the baked heightmap, but the sequence of brushes you have applied and to replay that sequence. Some computational overhead, but distributing the map at least becomes feasible.

    In a second step, realize that replaying a sequence of brushes isn't optimal. You are probably going to finetune the terrain in thousands of individual operations, many of them undoing the result of previous operations. And replaying that entire sequence is going to take quite a while. So you don't want a data format which replays all operations. You want one, which approximates the final results with the least number of operations possible.

    So how do you get that? Well, you don't.
    At least not that easily. There are interpolation algorithms which can solve this, and they are fast when it comes to replicating the original file from a list of parameters. But the process of determining these parameters is just nasty, and the more "noise" you have generated, the more difficult it becomes to replicate since the difficulty of these algorithms is determined by the number of individual sample points you have to use to span the original surface of the planet. Having several tenthousand data points, means having a runtime in the range of several minutes to a few hours to compute that compact representation.

    The final consequence is simple: You let a random generator generate most of the fine grained detail, and all you provide is a set of coarse grained feature descriptions. That's the only way of guaranteeing :
    • fast map generation
    • small file sizes
    • fast map editing
    • full control over the gameplay
    What you loose in return is some artistic freedom. If you want organic shapes, you are left with only a small number of tunable parameters, fine details are outside of your sphere of control.

    Long wall of text, I know. But that's the exact chain of conclusions I followed before I settled with the current approach.
  6. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Is that link correct?
    DeathByDenim likes this.
  7. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Ugh, no. Thanks. I mean: https://forums.uberent.com/threads/terrain-2-0.68152/page-5#post-1075263
  8. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    Thanks for taking the time to explain all this. My question is a 100 mb files really that big of a deal in the grand scheme of things. Especially with people getting 150 mbps internet downloading something like that is no biggy. There are a lot of creative ideas I have for maps. Giant mountains with narrow choke points through them. A winding grand canyon with flat plateaus on either side. Ocean cliffs and beach heads. These are things I don't think can be random generated without a lot of work.

    These type of changes would probably have to be done on the fly I am assuming. I've seen other games be able to adjust height maps without issue in the past. Populous: the beginning, Black and White 2 and Godus come to mind.
  9. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    http://en.wikipedia.org/wiki/List_of_countries_by_Internet_connection_speeds

    yeah I wish we all had 150mbit/s. Well to be honest I wish at least MY connection had 150 mbit/s.

    To use 100 mb files and not scare of 99% of the users you would need a distribution system and a system to cache the map data once it has reached the client. Such a system that downloads the map once if you dont have it would certainly allow map files to be rather sizey. 100mb would still hurt though.

    The current system of "transfer all map data as a json blob on every lobby join" cant handle more than few mb at most.
    Currently map data is also stored inside replay files as well, that would need to change as well unless you want one full copy of that 100mb map for every replay you have on it.
  10. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    I really Don't think 100 mb is a big deal. Download them ahead of time or have the user missing it be redirected to download it. That's 10 great handmade maps at about 1GB. Not to bad. let's see.. I get about 15 mb/s so it would take about 4.5 seconds to download a 100 mb map. Now realistically not everyone has my awesomesauce internet, so let's argue 30 seconds for the average user. Still not terrible imo. Hard drive space isn't really a big deal anymore either. You can pick up a 3 TB drive for $100 these days.

    I understand this is not ideal, but it's definitely worth it for a handful of great handmade maps with interesting features.
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    If your average user is a korean person I guess.
    Also just because you get 15mb/s doesn't mean the server that you download from delivers them for you. Especially not if 9 other people also want to download the map.
    I am not saying 100mb maps are impossible to have, but they need extra work to be handled effectively. If you insert a 100mb map into the current lobby system you wont be able to play at all.
  12. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    I remember when I lived in Britain with a 300kb/s connection, waiting 20 minutes to download 140mb custom campaign maps for Halo Custom Edition, haha.

    Anyway there are a lot of people with 1mb/s or lower even. =o
  13. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    They dont play PA multiplayer as much though, as with less than 1mb/s you cant play online.
    For a single download for a map you plan to play within the next days 20 minutes ofc is still completely fine.
  14. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    Actually you'd be suprised with what Web and ftp servers come with these days In terms of bandwidth. Well beyond what you'd think. They are really cheap too (I have one myself for less then $8 a month). I don't think this smaller community could hit the cap. Not saying it's impossible just that I don't think it should be a concern at this point.
  15. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    I could play PA just fine on 300kb/s, download rate doesn't necessarily mean you'll have bad ping.

    I had around 80 ping Iirc.
  16. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    USA used to have the world's fastest internet, now it's 27th. There are third world countries with faster internet. The monopoly based cable cartels strangle any kind of competition or cities trying to build their own municipals. It's a serious issue in our country. Verizon for example was given millions by the CA government to upgrade infrastructure as part of the deal and Verizon just kept the money without doing the agreed upon retro grades. This is common place in other areas as well. It's very unfortunate.
  17. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    This is what is sold as "1 Gbit/s" to me for 7$ a month.
    [​IMG]
    My own internet connection in the center of a german town has ~25mbit/s with occasional bugs dropping it to 5mbit/s. Even when my local internet is running totally fine I can't get more than ~6mbit/s to that server in the US, you need servers around the planet if you want to reach all users with full speed.
    But I was thinking we are discussing solutions that Uber can consider. For that it is important to have a system that can handle maps in a somewhat effective matter. Meaning they need a distribution system and a local cache system.

    Nothing impossible ofc.
    blightedmythos likes this.
  18. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    1 mb/s isn't even classified as broadband anymore. Still, as long as you don't have a lot of packet loss and you aren't too far away it's perfectly playable. Hell I used to play on dial-up back in the day.
  19. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    but definitely not PA ;)
    blightedmythos likes this.
  20. blightedmythos

    blightedmythos Active Member

    Messages:
    405
    Likes Received:
    202
    Not, populous the beginning, starcraft, diablo 2 and a bit of dungeon keeper 2.

Share This Page