Parse GML to use in map creation

1k views Asked by At

so I posted a question on OpenData and after advancing me a bit further in my quest to create maps from real cartographic information, I was advised to post my follow up questions on this website.

So after this intro, here is the original question:

I'm creating a 2D realistic RTS (Real time strategy game) and I wanted to be able to use real locations as the scenarios for the games.

The game will be developed via unreal engine which uses c++. The idea is for the engine to read an file and convert into a grid (coordinate point) where each square has type of terrain associated, like in this image of a scenario editor.

enter image description here

The file resulting from the other website is a GML (Geographic Markup Language) of a given location in the globe. GML is a XML extension.

The problem I'm facing is converting that GML for a given location into data that can be used by my game, like an location array or something like that.

Any sugestions?

1

There are 1 answers

0
Francis Cugler On

There are many possibilities into doing this but the general guidelines or concepts should be as follows:

  • Know the data structure used by your engine
  • Open the incoming file and being able to parse and extract the needed data
  • Populate your structures or classes
  • Use your custom structures or classes to create game content (map data).

The first suggestion that I can give would be to read up on any and all documentation on the GML file format to know how the tags of the marked up language works then from there look to see if you can find any libraries that make it easy to read in a GML or XML file type and to generate C++ classes or structures, otherwise you will have to write both the file loader and gml(xml)parser with schema manually. Then from those structures being able to extract the data that you need and to pass them or store them into your engine's custom data structures. Then finally you should be able to use the stored data in your engine to generate the content that you want.

References

Books

Whitepapers

Tools - Some Free Some Not

Libraries

The information needed is out there; it just takes time and effort; good research and the ability to apply what you have read into an actual code base.