Real world map to game terrain (osm2terrn2 Project)

Joako360

Mechatronics Engineering student
Joined
Jan 19, 2018
Messages
13
Location
Luis Guillon, Buenos Aires
Recently I discovered an open data map, OpenStreetMap, which allows you to export data from an area, and it is possible to develop a solution to convert data from this map into a game terrain.The objective of this would be to make more realistic terrains in a simpler way, mainly oriented to urban environments.
But this would significantly reduce the creative-artistic factor of creating a totally fictitious and non-existent environment, as had been done since the beginning of time.
My question would not be if it can be because I could do it, my question would be if it is "morally" right to do it.
That's why I created this thread, to make sure I was not creating a "monster" land generator and flooding the repository with real-life maps.
Well... that's it... thanks for reading and waiting for soon response ;)
 
Hello @Jonako360 and thanks for posting the interesting question.

This is the first time I'm hearing about OSM, so I did some googling on what data it contains and if anyone ever made a meaningfully looking game terrain with it. Turns out that there's a very good looking actual case here: Osm2city.py - FlightGear wiki

I think it would be great to have a tutorial or a tool for converting OSM data to RoR terrains. I see it as a fresh new approach to play RoR. The point about repository deserves a larger discussion, it would most likely need a new category or something, but I think this is also fine.

You're saying you can do this already... I'm curious to hear more about your tools and techniques.
 
Hello [MENTION=356]only_a_ptr[/MENTION] and thanks for the quick response.


Well ... then a tool that creates real world environments is fine, that's good news, so I'll start this project. Thanks for finding Osm2city.py, it is an important help.


About the tools and techniques that I use, I must confess that I am not a systems expert, just a engineering student. I was learning to develop Windows console applications in C/C++, so my main IDEs would be Visual Studio and Code::Blocks. I am learning to use GitHub as a project manager.


But my knowledge in programming is enough to start developing a WIN32 console application that converts OSM data to terrains with object definition and etc.


So, my idea would be to develop the project alone, when the project has an important advance and learn to manage projects on GitHub (it is more complicated than it seems at the beginning), I publish the code for those who want to bring changes to the project, etc.


I will announce any news by this same thread, be patient, thanks :).
 
Hello again, after some time since the last publication, I have to announce that the current status of this project is ... Active!:D but with some changes in the original concept. After some research:unsure:, I discovered and decided that C # is a good option for the realization of the idea, since it allows to work with xml files much easier and faster than C/C ++. This Project also has a name, I named it "osm2terrn2" (It'll generate all necesary files, not only *.terrn2, but i guess it's a good name :giggle:)

Then, I decided that it is better that the project can be programmed in Visual Studio as a Visual C # Windows Forms Application project (not a console application as planned), with this we will give a graphic interface, which will make it easier to use it.

I am organizing a repository on GitHub to host the project, I am still learning how to use it (I only program arduino microcontrollers and console applications, this is new for me hehe), if you want to take a look I leave the link: Osm2Terrn2 Repo. Its incomplete because I have only defined all filetypes classes, but there's no process yet (empty program LOL), but it's a beginning.

That's all, I will be trying to do updates more frequently, just trying! (nothing promised).
 
Update May 2021:
1- Sorry for the long absence.
2- Now talking about the project...
I said that the project would be based on C#... but that was before I learned a minimum of python (much easier for someone who is not a programmer like me who study mechanics), plus I found a library to use openstreetmap data (osmnx). So, I deleted the C# project repo and started another one in Python.
I have to add the documentation of how my idea works to agree on the direction of the project. Also, I am about to finish personal projects, so I will be working on it when I can.
in short:
Goodbye C#, Hello Python 3.8 (I particularly use anaconda suite and recommend to use it for those who are interested in participating in this project (more details in the documentation of the repo (when I have time I will write it))).
 
Wow! I hope this gets finished. I really wanna get my town into RoR. (privately, of course!)
 
Also when this is done, will this auto-import buildings, roads, etc? That would be cool.
 
Also when this is done, will this auto-import buildings, roads, etc? That would be cool.
Including real life buildings is something I plan to do since it is not as difficult as it seems, just draw an outline, extrude it up a couple of meters, change the roof model and put some textures. But for now I'm trying to make sure the streets have the right elevation and orientation.
 
I wanted to show you where the version I have named "indev v0.1" is in.

I am doing the tests in my city, Luis Guillon, Argentina (more info here). This way I can tell that something is wrong.
Starting with the heightmap.

1622733784306.png


I want to show that it can build an elevation map. I find a couple of problems with this:
  • I do not have a real elevation map with which to compare if this result is correct or not. In this case of Guillon is a city with low elevation, and from my perspective it makes sense, although it is not the best example.
  • Resolution, I am working with a native resolution of 30 meters per pixel. This is improved by increasing the resolution and applying interpolation to the values.
  • Finally, something that perhaps is not so serious is a problem with the algorithm that builds this elevation map that repeats values in some places, if you zoom in on the image you can notice a cross-shaped pattern in the center.
In the future it is planned to add depressions for rivers and lakes or lagoons.

Here a screenshot of the result so far
screenshot_2021-06-03_12-11-34_1.png

As you can see, there are only the street crossings, without streets, that will be the next thing.

screenshot_2021-06-03_12-43-56_1.png

Here you can see that the elevation of the crossroads does not match with the elevation of the terrain, surely there is a precision error in the elevation map and that is something that must be corrected.

Future plans:
  • Add streets. I plan to use the procedural streets included in the game. once this is achieved, a beta test can be launched.
  • Add railroad networks.
  • use information from airports, train stations and racetracks.
 
This is awesome! When this is released, I also wanna make the town of my grandmother's house, and the other town is connected by a bridge.
 
cool! Is the UK will be implemented?
He never said he's making maps. He said he's making a tool that'll create real maps, So you'll have to make the map yourself. You'll have to make loads and loads of maps to do the whole of the UK though. be better to do just a small village or farm town
 
This is something I looked in to, but real scale maps get a bit boring, due to the time taken to get around.
I saw a lot of games use scaling, so one of the commercial truck sims scales towns and cities to 1/3 and motorways to 1/10. This then makes a lot of work for picking what streets to keep and drop etc.

Even games like Forza Horizon seem to be about 1/2 to 1/3 scale.

Your precision error might be down to the projection of the maps, OSM is WGS84 which is only accurate to between 2 and 5m in x and y. If you are using python though you can reproject using gdal
 
  • Like
Reactions: K20
As an example of the difficulties I experienced: to make this bridge to 1:1 scale for a terrain derived from OSM it needed to be just over 1km long. Same size as some existing maps!
 

Attachments

  • Screenshot_20210827_141152.png
    Screenshot_20210827_141152.png
    451.6 KB · Views: 218
  • Wow
Reactions: K20
Back
Top