Anyone worked on integrating some kind of Google maps/mapbox library before?
Nothing official is out, just wondering if some people got started working on it. Also, how would you go about buidling it? I might start it, but would appreciate some pointers.
I don’t think anyone has played around with this before. Are you planning only to use location data, points of interest etc or the full experience with a map, overlays etc?
I’m pretty sure you can use the webview extension to show Google Maps but I’m guessing you want something closer to Pokemon Go with map data overlaid with game objects, labels etc?
I think the Mapbox API allows you to pass in a geolocation and zoom level and get back URLs to map pieces that a MapView can use to pan, rotate and zoom. You could probably use the same kind of API to get URLs to map images that you can download and buffer and show using GUI nodes or sprites.
Yes I guess that would mean implementing the complete mapbox (or google maps) SDK again.
If it’s just a minimal tiling it’s fine but I’m guessing having the correct coordinates projections could be an issue.
Bumping this topic to know if anyone has worked on integrating the Defold tilemap system with a tile provider like Mapbox to be able to build pokemon-go style games with Defold.
Sounds like a fun project! I remember working with Mapbox many years ago when I was a consultant for a company working on connected cars. Their API was relatively straight forward as I recall it. What I think you need are:
- A native extension to get the location of the user
- Request map tiles using the Raster Tile API
- Resize (perhaps not needed, tiles are 256x256) and write the tiles to a free location in an existing tilesource
- Possibly also cache the tiles on disk to reduce network load and speed up map updates
- Update the Defold tilemap to present the map
Could you please provide a bit of help as to how to achieve this part?
“write the tiles to a free location in an existing tilesource”
How do you edit dynamically a tilesource at runtime? I’ve looked at the doc but don’t quite see it. Thanks!
Hmm, you’re right, I don’t think it is possible currently. I guess you could do it with game objects and by updating an atlas.
Also note that @jhonny.goransson is working on a texture manipulation API for Defold where it will be possible to modify these things more easily.
Can you not use a tilesource on a sprite?
If so, you can get the path to the texture from it?
Oh, maybe you can? I’m not up to date on this it seems…
In any case, to change the texture of a whole atlas which is currently assigned to a sprite:
I can easily change the texture of an atlas at runtime, but it means I have to assign a different atlas for each tile. I didn’t find any way to create an atlas at runtime, or is there?
No, since it’s a predefined grid, that you know the size of, you can choose what areas to write to.
Currently, you are required to upload the entire texture, but in an upcoming change, you will be able to update a sub region of the texture.
Can’t wait for that update!