In this second part, I added a player character and 3D buildings to our cute little PokemonGo clone!
It’ll be a short post really. I used the Ethan model from “Standard Assets” package. All I did was importing the package, simple as that. It works with WASD controls at the moment as that’s the easiest way to navigate during development process but I implement GPS coordinate based movement in the future as well.
3D buildings was even in the previous package actually. I somehow forgot it in there but the building heights was set to zero so it was quite hard to notice it. Anyway I fixed the bug and the code itself for better looking buildings. Just better, not beautiful… but we’ll get there, slowly. Generation code is quite straight forward but still I’ll try to explain shortly.
As you know from previous post; CreateMesh() function in the Building class takes the building corners as a List<Vector3> called verts. Those vectors (coming from Mapzen Api), or lets say the polygon generated from those vectors, gives us the base of the building. What I did was, to generate that polygon in the air and use it as a roof. Then for every edge in the roof, I created a side wall down to y=0 and viola!
This yields quite simplistic, bare bone buildings as seen in PokemonGo. Should be enough for now but might give BuildR a chance in the future as well.
With character movement working, we have a new problem at hand; player can actually run to & fall off the map. We’ll fix that in the next post, by creating & loading new tiles dynamically as the player moves.
Hope you like it, Cheers,
Baran
Download PokemonGO Clone Part 2
Excellent. When the next article ?
Thanks! All I can say is; as sson as possible. It’s my birthday tomorrow so might not be able to work for a few days. But I’ll try to post it this week.
Happy birthday 🙂 Thank you for the article .
Thank you tooo!!!! 🙂
This is amazing !!
Thanks you to much, that will help me to much for my new proyect.
I have a question for you.
How can i add a point in the map with a exactly GPS Location. I mean for example, the player leaved some message in one area, so i taked the information on my DB, then i will like to show this message exactly on the point map.
The simple question is, can i add some gameobject using my GPS DB information?
Im not sure if u can understand me hehe, my english inst really good 🙁
Hey, thanks for your kind words!
You can always run your own GPS data service on top of the Mapzen data service.
Remember how we query mapzen server for building&road data by tile (TMS) coordinates?
You’ll need a serviec on your own (can be a simple class for starter, than sql or somethnig maybe) and every time you query Mapzen for tile information, you’ll query your service for custom data as well (using same tile coordinate).
I can do a blog post for something like that if you want, after completing the basics of course.
Cheers! (and yea your english is quite fine)
Sorry for dont reply here, just a mistake hehe.
http://barankahyaoglu.com/dev/pokemongo-clone-using-mapzen-api-unity3d-2/#comment-6616
Thank to much for your quickly answer !!
I’m looking your work and I’m really impresionante, this is great!!!
I’m looking in the “tiles” script and Building Factory, thats all i need for my project.
I need to add a gameobject in a concrete coordinates by my DB (with the gps info). Its like a one “pokestop” or some “pokemon” when appear in the map.
Thank to you again for this work, u are amazing!
PD: Happy birthday !!
Thanks a lot man! Glad you like it 🙂
I’ll try to post 3rd part in a few days (little teaser gif here; http://imgur.com/a/uv9Km) and I’ll move to some other features, maybe with custom data thing as you need. Cheers!
Wow ! Thats looks amazing i cant wait to see the 3rd part !!
Thanks for your time and work !!
Happy birthday! This article is very cool!
Thanks man, glad you like it!
happy birthday, I’ve following your blog since your previous publication about generating maps in unity, because I wanted to create a version of the game for windows phone.
but instead of creating streets using vectors, I just used snazzy maps to change the layout of GoogleMaps and used as an image map. (https://pbs.twimg.com/media/ComNgzrXEAA_v58.png)
But since googlemaps updated their custom models, the streets don’t have outlines anymore 🙁 then, when I was almost giving up, I enter in your blog again and saw you update your previous post with pokemon go theme in mind, that just fall from sky to me, thanks.
I would like to implement the way you’re doing, but I’m afraid that pull a lot of mobile data bandwidth.
if you want some item of the game, I can arrange for you, gui, mesh, sounds, I have the majority. I’m waiting for your next publication so that I can put on my street map, I really wanted a yellow outline on the streets, do you think I can do it creating a larger yellow vertex and overwrite the original? what do you think? like this (https://lh3.googleusercontent.com/dq_t7Is81-gkHYxKfAQ7PuLQBR-Qrte-7S1DsKFZnhaZATpibMSiw3aCrJzYik1x3IV5=h900)
Hey Hiro!
I haven’t thought about visuals yet but I think we can achieve those yellow outlines using mapzen two ways; creating road polygons with outline (as if a pavement) and outline shader. I believe Pokemon go is doing the first one but they are using Google Maps road data which is probably a lot better than Osm/Mapzen. I really don’t like Osm/Mapzen road data structure which doesn’t have the concept of intersections, just simple road segments etc.
Hello.
I am just a Unity3D geek from Canada.
I was so excited to see you’ve done much job here.
I really love your work! I can not wait your next publish with auto loading tiles!
When can I see new features?
Hey!
Thanks a lot man, I’m glad you like it!
I was planning to post it yesterday but had almost no time to work weekend so instead I fixed some bugs and did some polishing last night. It works quite good now so I’m planning to post it tonite (roughly in 5-8 hours).
Thank you so much for quick response!
Brilliant! 😀
And now I am just looking at the BasicLoader scene. and have one question.
-Is it possible to add river and ground to this map?
I mean you pulled buildings and roads json datas from OSM,
how can I pull other type of datas?
Cheers!
Hey!
All you have to do is to change “_mapzenLayers” variable in TileManager. I can’t remember the keywords right now but I believe it was “water” for rivers for example. You can check mapzen api documentation for that. I can also add that in a few days (lets say this week) as well, shouldn’t be trouble really. Good luck!
I am now reading your next article!
Nice work! I love this one even more.
Something wanna say should be – players won’t see loading tiles like “they are suddenly appear”. In my opinion, we can load more n tiles to do this.
One more(minor), Download link is not working.
Yea I’m using range = 1 just to simplify it when I’m explaining stuff. You can increase that number but even that should be enough when the camera zoomed in.
I took that file down to fix something but it’s uploading extremely slow now, should be up in 10 minutes.
Glad you like it man!
Getting error, Addcompontent with Monobehavior is not allowed, which leads to a null object on the next line…? CourtineStarter.cs line 32 33
Hey Ben,
I removed the CoroutineStarter class, can you give it another shot? Are you still getting that error?
hey
I am developing clone of pokemon
i have done AR portion of other stuff but i need some technique to move player based on GPS location
Kindly let me know if you have any solution
Thanks
Hey Samula,
I decided not to include GPS in this project but you can find a discussion going on here;
https://github.com/brnkhy/MapzenGo/issues/10
Hope that helps!