Menu
Baran Kahyaoglu Dev Blog
Baran Kahyaoglu Dev Blog
unity3d mapzen pokemongo water layer

PokemonGo clone using Mapzen – Part 4: Water Layer

Posted on 10/08/201611/08/2016 by brnkhy

Welcome back to the fourth part; Water layer, Git page, bug fixes and more!

-First of all, I finally created a git page for our little PokemonGo clone! You can find the latest fixes and updates, file bug reports, post feature requests there. I’ll be using it extensively so have no worries or hesitations about post there as well.

-Then we have some bug fixes. Previous versions didn’t really work properly in different detail levels for example. New tiles positions were messed up as well. They should be all fixed up now but yea, didn’t had time to test it extensively so please do let me know if you stumble upon anything weird. You can also read commit logs for more, I’m trying to write everything down properly there.

-There is also a parameter for tile sizes now. As you may remember, tile sizes wasn’t controlled in previous versions which caused countless problems. i.e. Lvl16 tiles were 611 unit wide while Lvl14 tiles were 2446 unit wide. Now we have a “TileSize” property under the world script, scaling down/up everything to fit tiles into that width&height.

-Last but not least, we now have a working water layer! It was a little tricky as there are lots of “MultiPolygons” in the water layer but turns out it isn’t that hard after all. I just did some silly mistakes which confused for a while. It happens. Occasionally. Sometimes frequently. But yea, with that fixed, we have a quite smooth water layer now. I just put a simple blue polygon for water but you can put Unity3D water over that easily.

unity3d mapzen pokemongo water layer
Yes, that’s Istanbul for you! Looking good? Nope? Yeah….

Hmmm am I missing something? Well it’s all on Git now, you can check all commits and commit messages for more. You can also check GitHub Issues page for known issues as well. I’m actively adding stuff there as well.

And that’s it. I guess. Please do let me know what you think about it or have any questions. Your feedback is what keeps me going. And page hits, share it will you? Thanks!

Cheers,
Baran

Download PokemonGO Clone Part 4: Water Layer

Share on Social Media
twitter facebook linkedin reddit email

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

  • Mapzen
  • OpenStreetMap
  • PokemonGo
  • Unity3D
  • 40 thoughts on “PokemonGo clone using Mapzen – Part 4: Water Layer”

    1. Alexey says:
      11/08/2016 at 12:11 am

      Why are you using a random height of buildings in the code?

      var height = UnityEngine.Random.Range(settings.MinimumBuildingHeight, settings.MaximumBuildingHeight);

      Many buildings in Matzpen are parameter height.

      {“kind”:”building”,”area”:2773,”sort_key”:475,”addr_street”:”Rector Place”,”height”:71.50000000,”volume”:198269,”source”:”openstreetmap.org”,”min_zoom”:13,”addr_housenumber”:”380″,”id”:277922715}}

      Reply
      1. brnkhy says:
        11/08/2016 at 12:18 am

        I always ignored that as like 99% of buildings in Turkey/Ankara doesn’t have it.
        But you’re right, I should have noted that properly as it might be useful for other people.

        Reply
    2. Jay B says:
      12/08/2016 at 5:53 pm

      Hi
      if you have a Gameobject in the Scene. How can you get the Lat/long of this object?

      Thanks for the answer.

      Reply
      1. brnkhy says:
        12/08/2016 at 7:39 pm

        Hey Jay!
        Depends on the object really. Everything we create there actually comes from Mapzen json which provides the lat/long values as well. Which means you can simply keep those values inside any object you want (i.e building lat/long inside building.cs). I haven’t done this but should be fairly easy.
        Converting a random point inside a tile to lat/long won’t be that easy though. First you’ll have to find the tile containing that point, convert that to lat/long. Then you’ll have to calculate the delta position relative to that tile center and convert that to lat/long using the ratio of tile Width/Height to point position. Sounds complicated I know but I can’t think of anything simpler off the top of my head.

        Reply
    3. Alexey says:
      13/08/2016 at 11:05 am

      Thank you for this project.
      I changed the code a bit, added to generate UVMaps, and use heights.from OSM

      Here’s what happened.
      http://fenix-cam.ru/data/Screenshot_3.jpg
      http://fenix-cam.ru/data/Screenshot_4.jpg
      http://fenix-cam.ru/data/Screenshot_5.jpg

      Reply
      1. brnkhy says:
        13/08/2016 at 11:03 pm

        It looks great man, good job!

        Reply
    4. Kurl Rip says:
      15/08/2016 at 1:09 pm

      Woa !
      Thank you for those 5 nice tuto.

      Reply
      1. brnkhy says:
        15/08/2016 at 1:49 pm

        Glad you like it Kurl!

        Reply
        1. Kurl Rip says:
          16/08/2016 at 11:05 pm

          Hello
          Is it possible to contact you, to talk about a game project ?

          Reply
          1. brnkhy says:
            17/08/2016 at 8:19 am

            Hey, sure man you can mail me; brnkahyaoglu@gmail.com

            Reply
    5. Ken says:
      15/08/2016 at 9:07 pm

      Awesome work so far! I am eagerly awaiting a post on how to position an object within a tile based on it’s actual GPS coordinates, or have you already posted on that? Essentially I’m looking for how to place the character at the right position based off of GPS.

      Thanks again for your amazing work =)

      Reply
      1. brnkhy says:
        15/08/2016 at 9:21 pm

        Hey Ken, thanks!
        I haven’t started the GPS thing yet, I have some other higher priority stuff like road meshes and merged meshes etc.
        I’ll try to get into that as soon as possible though, I know lots of people are waiting for that 🙂

        Reply
    6. maccu87 says:
      17/08/2016 at 6:56 pm

      Hey, nice to see you are still working on it 🙂 I mentioned in the last post you made about myself working on bringing water into it. I just loaded up your latest build and noticed that water isn’t working properly either. Some streams/water based areas as I said seem to want to use the polyline instead of polygons. It’s pretty annoying!

      You defintely fixed the issue with the way the mesh is built though as that has fixed areas where it wasn’t rendering correctly. I am happy to create some screenshots of the water areas I am looking at if you need to see what I am on about.

      Cheers, and keep it up!

      Reply
      1. brnkhy says:
        17/08/2016 at 7:12 pm

        Hey Maccu!
        Yes as you noticed I totally skipped LineStrings for now. Guess I can look into that in the future as well. Also can you post the lat/long you’re working on (or mail me) so that I can see&test the problem.
        I’m working on merged buildings&roads at the moment. Got it working but needs some more work, it’ll be great 🙂

        Reply
    7. MramidK1 says:
      18/08/2016 at 10:08 am

      Hi!
      Sorry for my English! Google Translate 🙂

      Great job ! I’m also doing a similar task. But on Mapzen I learned from your blog 🙂 Some aspects of your work and help me , thank you !
      By chance you do not know whether there is in the incoming JSON object center tile come in geographic coordinates ? The latitude and longitude . (That I need for the correct location of objects )

      Reply
      1. brnkhy says:
        18/08/2016 at 8:30 pm

        Hey!
        You mean tile center in lat/long? Hmm I don’t think Mapzen has that but I’m pretty sure you can convert tile coordinate to lat long. Have you checked the GM class inside this project?

        Reply
        1. MRAMIDK1 says:
          19/08/2016 at 9:23 am

          Yes , everything has turned out 🙂
          My inattention ) But before that, I had to stick to the devs Mapzen, and they sent the necessary formulas , which , as it turns out , there is already in your project 🙂

          Reply
          1. brnkhy says:
            21/08/2016 at 8:36 pm

            Awesome! 🙂

            Reply
    8. Alexey says:
      18/08/2016 at 11:51 am

      Hey. I’ve added support for min_height and mapping of forests and parks. I am currently working on a render of grass and trees in the park .
      http://fenix-cam.ru/data/Screenshot_2.jpg
      http://fenix-cam.ru/data/Screenshot_6.jpg
      http://fenix-cam.ru/data/Screenshot_1.jpg

      Reply
      1. brnkhy says:
        18/08/2016 at 8:31 pm

        Hey!
        Parks looks awesome, guess I’ll add that as soon as possible as well! Great work man, please keep posting your progress 🙂

        Reply
        1. Alexey says:
          20/08/2016 at 7:32 pm

          I added the automatic placement of grass and trees in the landuses.
          Grass is created everywhere (grass and wood), and trees only in the wood.

          http://fenix-cam.ru/data/Screenshot_7.jpg
          http://fenix-cam.ru/data/Screenshot_8.jpg

          Reply
          1. Petrov says:
            23/08/2016 at 12:26 am

            How are you making sure it stays within the boundaries? Are you just looking at min and max long/lat coordinates?

            Reply
    9. Kurl Rip says:
      19/08/2016 at 3:07 pm

      Hello

      Modification with :
      Color for Landuse
      color for road
      Real Height

      Paris : http://hpics.li/a41a3e0

      Central park : http://hpics.li/077434d

      Reply
      1. brnkhy says:
        21/08/2016 at 8:35 pm

        Looks great man!

        Reply
    10. Alexey says:
      21/08/2016 at 5:11 pm

      Mapzen contain not all OSM tags in particular it does not have key is responsible for the color of the building: building: colour.

      I added the extraction of data through the API OSM for Way and Relation.

      But faced with a problem.
      The OSM Relation consists of Ways, and each may have their own Way unique keys than the other Way.
      Mapzen all Way included in the shared object.

      http://fenix-cam.ru/data/Screenshot_10.jpg

      Reply
      1. brnkhy says:
        21/08/2016 at 8:37 pm

        Hmm I didn’t know about building color stuff. Looks interesting but I also don’t get what you mean by “ways”. Is it roads? Or something else?

        Reply
        1. Alexey says:
          21/08/2016 at 9:15 pm

          OSM has 3 types of data.

          Node – a point with coordinates.
          http://www.openstreetmap.org/api/0.6/node/326806790

          Way – the object consisting of the points (the parks, the roads, buildings)
          http://www.openstreetmap.org/api/0.6/way/422159731

          Relation – a complex object composed of different Way with different parameters.
          http://www.openstreetmap.org/api/0.6/relation/2470041

          OSM contains information about the color of buildings, material, shape of the roof, its color and size. more: http://wiki.openstreetmap.org/wiki/Simple_3D_buildings

          Reply
          1. brnkhy says:
            21/08/2016 at 9:59 pm

            Aaah I see. Maybe I should look into OSM stuff in the future as well, I don’t know much about it at the moment.
            Thanks man!

            Reply
    11. Kurl Rip says:
      21/08/2016 at 9:26 pm

      Hi,
      I just finished the GPS implementation today.

      Thk you for those 4 tuto

      Reply
      1. brnkhy says:
        21/08/2016 at 10:00 pm

        Good job Kurl, you’re welcome! 🙂

        Reply
      2. MRAMIDK1 says:
        22/08/2016 at 9:14 am

        Do not share the solution? 🙂

        Reply
    12. Kadir Selçuk (@kselcuk) says:
      23/08/2016 at 3:24 pm

      Baran tebrikler ve teşekkürler. Tam aradığım şeyi bizden birin geliştirmiş olması da ayrıca mutluluk verici oldu :).

      Reply
      1. brnkhy says:
        23/08/2016 at 3:50 pm

        Merhaba Kadir. Beğenmene çok sevindim, umarım işine yaramıştır. Yakında çok büyük birkaç ek daha geliyor, çok daha güzel olucak 🙂

        Reply
    13. Kadir Selçuk (@kselcuk) says:
      23/08/2016 at 7:31 pm

      Heyecanla bekliyorum 🙂

      Reply
    14. LilyAnne says:
      25/08/2016 at 8:40 am

      Hi,

      Thank you so much for these tutorials, they are very helpful.

      I do have a question though.

      If I have the lat/long of the tile center, and the lat/long of a random point in the same tile, do you know of a way to calculate distance (X and Z in unity) between these two points in the tile?

      Reply
      1. brnkhy says:
        25/08/2016 at 3:01 pm

        Hey Lily, gald you like it!
        I’m sure there should be a better way to do this but you can always convert those lat/long to meters and multiply with the scale factor of base world object. Can’t check it right now but that should yield the distance in “unit” I believe. Guess I’ll look into this in the future as well, getting lots of questions on that.

        Reply
    15. Andrés says:
      25/08/2016 at 2:31 pm

      no idea why the textures do not apply ? I changed the texture of the materials in the resource folder. But it does not work

      Reply
      1. brnkhy says:
        25/08/2016 at 3:06 pm

        Hey Andres,
        I don’t generate UV coordinates for meshes at the moment, has to be that. No texture or anything will work without that, just flat material colors.
        You can try generating UV’s in mesh creation functions, that’s technically an easy problem but it’ll get messy considering various building types and city etc.
        Guess I’ll stick with flat color for a looong while 😉

        Reply
        1. Petrov says:
          26/08/2016 at 12:48 am

          Alexey got a grass texture working in one of the comments above; would making everything a single game object break that now?

          Reply
          1. brnkhy says:
            26/08/2016 at 9:40 am

            Hmm I’m not sure but I believe he can make it work again with minimal effort. We have a landuse layer for parks now for example, you can use that mesh and generate grass on it no problem.

            Reply

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Search

    Subscribe to Blog via Email

    Follow me on Twitter!

    My Tweets

    Categories

    • Desktop Development (26)
    • Game Development (39)
    • Mapbox Unity SDK (4)
    • Uncategorized (8)
    • Unity3D (21)
    • Web Development (6)
    • WinRT Development (1)

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    ©2023 Baran Kahyaoglu Dev Blog | Powered by WordPress & Superb Themes