Jump to content
mcegla

Importing real-world database directly to game environment

7 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hey, everyone!

First of all, I would like to thank the entire simtropolis community, and especially B0former for his tutorials. And now getting to the point…

I’ve been working for some time (with some codding help from my friend) on modification that uses .xml(gml) files to create in-game objects. The goal was to create whole city / village / whatever with single press of the mouse button, even if it won’t be perfect at first.

I’ve seen stuff like Cimtographer (and rebuild), Terrain Generator, Rainfall, and it’s been quite a helpful reading (though I did not understand everything).
This is how it looks right now (it already takes around 1,5 min to generate everything):

screen.jpg.f05341ab513bc7761748d35dd18ddc3d.jpg

,as you probably can see it has some problems (where are the building?, why so flat? etc.), and I would like to ask you some questions connected to some of them:
1.    Do you know is there a possibility to successfully use System.Xml.Linq inside of the game / Unity? (from 25 lines parser blow out to 25000 because of this little thing)
2.    I have access to 1x1m DTM (digital terrain model), but I can’t use it fully – 1081x1081 etc., do you know about any way to bypass that limitation (though I’ve heard that it might be hard to achieve)? (Any insight about import of DTM with code also appreciated)
3.    I do know how to place and delete most of the objects, but there are 2 things that don’t like to cooperate with me: deletion of net segments (roads) and water sources, any help appreciated.
4.    I’ve been testing and trying to use other mods like: Plop the Growables, No Abandonment, Disable Zone Check to stop code placed growables from disappearing; no success so far (Guess I need to read into and maybe incorporate it some way). Is there working solution? 
5.    TBH any tips and tricks, connected in some way to objects placement.
 


I'm currently working on buildings placement and that DTM import, but it still needs some polishing.

Thanks! :)
 

  • Like 1

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Hey! One thing you might want to look at is MoveIt! Export/Import function. it also uses xml and places down large amounts of networks.

I think regarding the terrain, 1081 is just the resolution it has and there is no way to make it more detailed.

I guess you could just write your own extension methods that replicate LINQ. Not sure if it is possible to use it.

  • Like 1

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Thanks!

    12 hours ago, boformer said:

    Hey! One thing you might want to look at is MoveIt! Export/Import function. it also uses xml and places down large amounts of networks.

    I think that i've seen Moveit! though i might skipped it somehow. I'll have a look.

    12 hours ago, boformer said:

    I think regarding the terrain, 1081 is just the resolution it has and there is no way to make it more detailed.

    Well, that's disappointing but not unexpected :|

    12 hours ago, boformer said:

    I guess you could just write your own extension methods that replicate LINQ. Not sure if it is possible to use it.

    I'll stick with auto-generated models of those gml files for now, but I guess if it ever will be released, I should try and do it that way.

    btw small update (all buildings created mostly with same object... I'm writing dictionary for it, I use only base game + 2 first dlc models for now):

    testing.jpg.e1f97c8c1e348e6e0a15f04d2026e95d.jpg

    • Like 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Update: 2700 lines later dictionary was created :P (also some smaller classes added)

    Screens (already in game, not in map editor - as small sources were added for swamps etc.):

    20191004004533_1.jpg.9c4526a36ccc891847ff78ad3c95da42.jpg

    20191004003003_1.jpg.20cc3155ef590437c23f9cd6a20853fc.jpg

    Probably some texturing of fields, rocks, plazas is needed... I don't know how to do it yet.

    I don't know if I'll import data about bridges etc., might try ... (it's not a lot of work, but update method or smth for segments is not existing)

    DTM - WIP

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Update: it kinda works :)
    Thanks to my friend DTM is now imported directly during run time (RAM usage up to 8GB, as 1m DTM is pretty big :|), though it miiight not be the best way to do it.
    Problem is … I don’t know how async works in here (as if I know anything about async), and I can’t load it at the same time … maybe other button just for it?

    Resources (NaturalResourceManager) added as textures, but it’s not enough as pavement etc. should be also placed … I just couldn’t make it work with that TerrainManager/Modify, and used prop pavement which looks silly, as it is placed over any other objects :|

    Fences were eating props / nets (with use of “Privacy Fence” asset) like crazy I needed to limit their range to 7 squares.

    All this time I was using Polish BDOT10k (.xml/gml) and PUWG 1992 (coordinate system). After I clear and refactor this code (it’s a mess) I’ll place some github repo link here or smth. If anyone would like to use it, it’ll still need to be customised to your own .xml structure / coordinate system (ofc if you won’t use Polish ones).

     

    Ortophoto from geoportal.gov.pl WMTS service and DTM inserted manually for comparison:

    Spoiler

    comparison.jpg.1c64aa333a3ca3aed663fdd87fcb222d.jpg

    Picture with river regulated manually after loading: 

    Spoiler

    regulatedRiver.jpg.158b6f935c692362a995d53fae3c0cbf.jpg

    some errors:

    Spoiler

    DTM data not existing:

    DTM.jpg.8eb09535971286a957c4a065f489334a.jpg

    Models colliding:

    5da473bcda913_modelscolision.jpg.4a50cacf84ed5f8a66471eccb178c059.jpg

    Placing objects with their front to closest road it's not always a good idea:

    5da473c04955f_nearroadplacingbugs.jpg.26b09c58ab6e6ea3473728d32be470a7.jpg

    Road flickering:

    5da473c28baef_roadflickering.jpg.9f3823696c6df6e9a92113e377c5201d.jpg

    5da473c513479_somemoreflickering.jpg.ef02aaee093895916297dbd75b75e71c.jpg

    Silly texture:

    texture.jpg.86e54942656ec303233e15fd3f3fc713.jpg

     

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    I made a 2-stage button and it works.

    I'll not release it on steam; as it's probably buggy and unoptimised (as I tested it only on one area).

    Repo: https://github.com/mcegla/GeodataLoaderPL-test

    as i said before this version needs "Privacy Fence" asset: https://steamcommunity.com/sharedfiles/filedetails/?id=1394735871

    I made some (excessive) comments, on my parts of code ... sorry :|

    just one more screen: 

    20191018133543_1.jpg.9d9dc3be6af05bf805467e585234ecb4.jpg

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    As I said in other thread, I have basically rewritten whole mod. Updated/Rewritten version is now on github (https://github.com/mcegla/GeodataLoaderPL-test) It can be used in game and in map editor, but placed in game and not zoned, buildings will disappear.

    I will soon release it on steam workshop :) I just wish that i had some more data for testing :/ Anyway I hope that my new version will be useful for someone, as TDB (BDOT10k) might soon be available for free.

    New screen without fog etc.:

    16062020.jpg.7f020dfbae83d80b8e83c656d5c6827d.jpg

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections