reinterpretcat / utymap

Highly customizable library for procedural world generation based on real map data
Apache License 2.0
958 stars 151 forks source link

Any thoughts on integrating this with the Unreal engine? #106

Closed daeilkim closed 7 years ago

daeilkim commented 7 years ago

I like how you've separated the logic from creating the meshes using OSM and its integration with Unity. Would you have any pointers on how this might work with the Unreal Engine?

reinterpretcat commented 7 years ago

Core library is responsible for data import from various formats into memory or persistent storage (files) and generate meshes using mapcss stylesheet. It is written using C++11 (+ some boost libs) and there is no dependency on Unity or any other game engine. So, this part is designed to be reusable.

The rest is how OSM data is received, how generated meshes are visualized and how application state is managed (e.g. load/unload tiles with game objects). This is written using C# with dependencies on Unity API. In theory, it's not difficult to remove these dependencies by providing additional level of abstraction to allow easy porting on other game engines which support C# 3.0. But each level of abstraction is not free from code maintenance point of view. That's why I decided not to do it in first place.

Alternative approach: reimplement/port UtyMap.Unity to Unreal Engine.

If you want to play a little bit with library and Unreal Engine take a look at this class and its usage: https://github.com/reinterpretcat/utymap/blob/master/unity/library/UtyMap.Unity/Maps/CoreLibrary.cs

You can try to build quick prototype to check how it's working in Unreal Engine with the following steps:

  1. Build core library for target platform
  2. Check the way how to call native code from Unreal Engine (in .NET/Mono is known as PInvoke)
  3. Prepare map data for some area you want to load or use from test assets (small part of Berlin)
  4. Copy mapcss
  5. Call core library's "configure" to specify index directory, addToStore to import map data, loadQuadKey to produce meshes for given quadkey (of course better to check usage examples)
  6. In mesh callback from native code, create Unreal Engine's game objects from mesh (see these classes: https://github.com/reinterpretcat/utymap/blob/master/unity/library/UtyMap.Unity/Maps/Data/MapTileAdapter.cs https://github.com/reinterpretcat/utymap/blob/master/unity/demo/Assets/Scripts/DemoModelBuilder.cs)
daeilkim commented 7 years ago

This is amazing. Thanks for that info.

I know this isn't the appropriate place to ask, but would you at all be interested in outside paid consulting work to make this a reality? If so, you can email me at daeil.kim@gm.slc.edu. I'll start probing into this more and really appreciate the quick response.