Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: Template extractor for building templates  (Read 3634 times)

0 Members and 1 Guest are viewing this topic.

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Template extractor for building templates
« on: June 05, 2020, 10:48:48 AM »

Well, at least one of you guys uses some of my programs, so here is an other one. This extracts the buildings templates used with autopop to populate a map from the final map. So its something like a autopop reverser. You may edit these extracted templates and use them to populate an other map. I wrote this when i made the curved road version of the moded Singapure map when i noticed i had to add some villages to the Singapure island. Instead creating them manually from the scratch i preferred to extract the templates for the existing villages. The prog looks like this:



The result looks like this:



This is a extracted city1 (Slot 17) template from my SWIEurope map. The original template i made with the CityBuilder.

The result with many maps may be a little bit disapointing. There are a lot of very poorly populated maps, where even not every of the 8*8 texture tiles are used, so the prog can not refill the texture completely. Or there may be a lot of overlaying objects but not much objects left when you change the progs parameters to prevent this. In this case the map maker changed the positions of many objects or added many objects manually, so there is no template used really. But even a poorly filled template is better than starting with an empty one ;-)

This works like this:

Put the map_t.tga of the map you want to extract into the same directoy as the prog. The same with the complete maps buildings file from the extracted actors.static. Name this file outBuildings.txt if named otherwise. Install the texture thats population you want to extract as texture within the City0 slot (16) of the autopop map.

Run the prog. At the prompts type in:

"Slot number": The loads.ini texture number you want to extract, e.g. "17" for the City1 slot. Slot numbers start with 0. 

"Same object at x multiple positions at least": Only objects are extracted, that appear x times at least at the same relative position of the maps texture. The idea here is: The map maker may have added or exchanged objects at some places, so these appear only once at a textures position, e.g. objets of an airport or a train station. These objects would not be usefull as template objects. Start with a value of 1 and check the result, often 2 may work best. The template above i extraxted with 3, but this will work fine only with very well populated or really big maps.

Plates are never extracted.

Clearing zone meter (Radius): Deletes an extracted object, if there is an other object within the given radius. This is to prevent overlayed objects when objects where manually shifted or exchanged in a map a little bit (This is influenced by the multiple positions factor also, of course). A value of 4 may work well often. There are also maps, where objects are piled up twice or even more or many objects overlap.

Finally the prog shows how many objects where found for every of the 8*8 tiles of the texture. This allows to precheck the results when changing the parameters.

This is made for 1600 Meter * 1600 Meter textures, but meanwhile i'm not shure if there really are other ones at all?

The prog works quite well, but you better test some parameters. Use the created inBuildings(SlotNr.).txt to create an actors.static for the autopop map. You will have to edit it in every case.

This link is updated to V1.2.
You may download the program here (15 KB):

https://www.mediafire.com/file/zsps6plwjyq5zw9/TemplateExtractor.7z/file
Logged

UberDemon

  • UberDemon/danzigzag
  • Modder
  • member
  • Offline Offline
  • Posts: 1378
Re: Template extractor for building templates
« Reply #1 on: June 06, 2020, 12:18:18 AM »

Ah man,

I don't know how to mod maps but this looks like something that is AWESOME!  I downloaded just on principle.

Quick question, and if you feel this belongs in a PM, let me know, but is there a way to programmatically extract the locations of cities and taxi patterns on runways from the map files?  I have tried to decipher the map files and I am not sure where that info is.  Reason I ask is that I am updating my mission generator files to support BAT and would love to have something that programmatically could, say have a taxi takeoff pattern based on the info in the maps... I figure since I can see that in FMB, there is a way to see that programmatically...  since you can populate the maps programmatically, this has to be possible.

Anyway, I am going to check your prog out.  Thank you for your work.
Logged
Best Regards, UberDemon/danzigzag, Get UQMG at SAS BAT Mission area.  www.uberdemon.net no longer exists.  (** Alienware Aurora R7 / i7-8700 3.20GHz / 16GB RAM / Win 10 x64 / NVIDIA GeForce GTX 1080 **)

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Template extractor for building templates
« Reply #2 on: June 06, 2020, 10:53:19 AM »

When a map is loaded, the actors.static is loaded of course, but i don't know where these values are stored an how to get them. I also don't know how to read a maps actors.static in one of the sfs archieves. So i don't know how to get the values at the fly ;-(

The approximately position of named citys is in the maps text.txt. But this are the positions of the cities names that show up in a map and not of the cities positions themselfs. These ar not directly stored anywhere, i think.

The airport positions are in the maps static.actors. When using my actors tool to expand these you get the starting and landing points ("Ground" object in the full map builder) in the inRunwayPoints.txt. The other positions are in the inAiportWays.txt, as the beginning and end of a runway and the points inbetween where the planes leave the runway as RunwayWay ("Runway" object), the taxi ways as TaxiWay ("Taxi" object) and the parking ways as ParkingWay ("Stay" object). The problem might be the mission generater would need these data for every map.

One idea to get a position might be to place a special object at the wanted position in the mission builder, also this must be placed manually, and get the position from a mission file.

Hope you solve this somehow. Interesting idea, i'll wait for it!
Logged

UberDemon

  • UberDemon/danzigzag
  • Modder
  • member
  • Offline Offline
  • Posts: 1378
Re: Template extractor for building templates
« Reply #3 on: June 06, 2020, 02:43:03 PM »

Hey, thanks, that is more info that knew about.  I am currently writing an automated initialization creator/converter to bring UQMG up to BAT standards, it is a long process, I'll then start taking a closer look at the map data.  Again thank you.
Logged
Best Regards, UberDemon/danzigzag, Get UQMG at SAS BAT Mission area.  www.uberdemon.net no longer exists.  (** Alienware Aurora R7 / i7-8700 3.20GHz / 16GB RAM / Win 10 x64 / NVIDIA GeForce GTX 1080 **)

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Template extractor for building templates
« Reply #4 on: June 07, 2020, 09:03:32 AM »

When looking to the code again, i found and fixed a flaw in the function that deletes overlaying objects.

So the link in the first post is updated to V1.1 now. The prog works even better now :)
Logged

vonOben

  • Modder
  • member
  • Offline Offline
  • Posts: 922
  • Wer den Tod fürchtet, hat das Leben verloren.
    • vonOben's Flight Sim Mods
Re: Template extractor for building templates
« Reply #5 on: June 08, 2020, 01:06:20 AM »

Hi Nowekat

Many thanks for the new Template extractor!  ]thumbsup[

There is in fact a similar tool made 10 years ago by zipzapp called "Town texture file extractor V1.2 (Autopop inverter)", but I've never used it.

Info and download here:
https://allaircraftsimulations.com/showthread.php?tid=70426&highlight=Town+texture+file+extractor+V1.2

Best regards

vonOben
Logged
vonOben's Flight Sim Mods  http://vonoben.free.fr/ Twenty Years online January 3, 2022!

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Template extractor for building templates
« Reply #6 on: June 08, 2020, 10:15:53 AM »

I reprogrammed that like some other tools. I started with an other idea but finally ended in a copy, although the results differ. I assume the original programm just reads the objects and not how often they are used at the same relative position on a texture. On the other hand i found, that this multiple position system alone extracts only a very few objects with many maps. So finally i made a mixed system. But this is still useless with some maps, when many of the objects are moved manually or the map was populated in several steps. Nevertheless i think it will be usefull in some cases.
Logged

vonOben

  • Modder
  • member
  • Offline Offline
  • Posts: 922
  • Wer den Tod fürchtet, hat das Leben verloren.
    • vonOben's Flight Sim Mods
Re: Template extractor for building templates
« Reply #7 on: June 11, 2020, 02:44:53 AM »


This works like this:

Install the texture thats population you want to extract as texture within the City0 slot (16) of the autopop map.


Hi Nowekat

I didn't quite understand what you meant by this:
"Install the texture thats population you want to extract as texture within the City0 slot (16) of the autopop map."

I only copied the map_t.tga and the outBuildings.txt to the Template extractor folder and the result did look like the image below.
The border of map_t.tga is the red square and there are no objects in the lower part and in the top there are objects outside the border.

Perhaps I did something wrong?  :-[

A small note:  When I run the TemplateExtractor1.1.exe the window says Template Extractor 1.0, but I assume it's the 1.1 version anyway.



Best regards

vonOben


Logged
vonOben's Flight Sim Mods  http://vonoben.free.fr/ Twenty Years online January 3, 2022!

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Template extractor for building templates
« Reply #8 on: June 12, 2020, 11:17:30 AM »

I never noticed such objects outside the square. Seems you are not using the original setting for the autopop map, so the square may be shifted? It also has not the shape it should have. The water should be that ugly black water texture usually in slot 28 (Water0 = water/water.tga). This is smaller than the rest of the textures. You may try this and also the original autopop map_t.

If you extract e.g. a slot 17 texture and this is it linked as  land/summer/Berlin/MidCity.tga in the maps load.ini you extract you must write this line into the slot City0 (ever this, never something else) of your autopop map. Then this texture will show up within the square and you will see if and how many objects fit the texture. You must close and restart the game completely after changing a texture slot.

But give me also an other try: I found a logical flaw, so i uploaded V.1.2 meanwhile. Well, these MS guys are at Windows version 800 or what ever, so thats not so bad, i hope ;-). This time i changed the version number.
Logged

vonOben

  • Modder
  • member
  • Offline Offline
  • Posts: 922
  • Wer den Tod fürchtet, hat das Leben verloren.
    • vonOben's Flight Sim Mods
Re: Template extractor for building templates
« Reply #9 on: June 13, 2020, 02:55:09 AM »

Hi Nowekat

I've used the Autopop templates posted by mandrill here:
https://www.sas1946.com/main/index.php/topic,30959.0.html

And you are correct the tile square was not in the same position but 1 pixel lower.
Now I have created a Empty1a folder with a edited Autopop map_T.tga (with RGB 12) and a edited load.ini but the result is the same as shown below.  o_O
It's a Country0 (RGB 12) texture I'm populating.

I think it would be helpful for new Objectset users if you could include a correct map_T.tga and describe how to set up the Objectset map to open it in the map builder (unlocked FMB).  ;)



Best regards

vonOben
Logged
vonOben's Flight Sim Mods  http://vonoben.free.fr/ Twenty Years online January 3, 2022!

Nowekat

  • Modder
  • member
  • Offline Offline
  • Posts: 152
Re: Template extractor for building templates
« Reply #10 on: June 13, 2020, 05:31:19 AM »

Looks much better now! The square is filled properly within its borders. I don't know where the red lines are coming from, but this red square is are still 200 meter to low.

You don't have to repaint the map_t for every slot. Leave the square in colour 16 (City0) and write the texture link you extract in this slot of the autopop map load.ini. You can use every texture there.

Are you shure, this is the texture thats buildings template you extract? The buildings seem not placed very well here. They also  look more like made for a city texture, not for a rural one. What map this this? Or if you use a multiple position factor of 1 there may be many objects that do not belong to the template, so try 2 or even more.

You are right, using the objectset needs to know the autopop.
Logged

vonOben

  • Modder
  • member
  • Offline Offline
  • Posts: 922
  • Wer den Tod fürchtet, hat das Leben verloren.
    • vonOben's Flight Sim Mods
Re: Template extractor for building templates
« Reply #11 on: June 13, 2020, 12:20:26 PM »

I made a red border on the tile, so I know where the edges are in map builder.  ;)
The objects are placed exactly as before, with no objects in the lower part and in the top there are objects outside the border.

Ok, now I understand what you meant by colour 16 (City0).

It's the correct tile, I've used multiple position 1 and clearing zone meter 0.

How does the Template extractor handle the blending zones between different textures?
Those misplaced buildings belong to those blending zones.
Logged
vonOben's Flight Sim Mods  http://vonoben.free.fr/ Twenty Years online January 3, 2022!
Pages: [1] 2   Go Up
 

Page created in 0.04 seconds with 27 queries.