Copying City Assets to Company Code

From Blue Mars Developer Guidebook

Jump to: navigation, search
There are security restrictions on this article

Back to Tutorials

Contents

Overview

This tutorial will cover the necessary steps to transfer city asset files from one company code to another using the Asset Browser in the City Editor. This scenario can occur if a developer has begun work on a city without registering a company code, and when the company code is registered it differs from the one that the developer has been using. In this mock example, a developer began working on a city in the company directory called ABC, but upon registering the company name, the developer found out that ABC was already taken. The developer decided to register under another company name, say XYZ, but now their city file (.cry) will not have access to assets in their test company directory, namely ABC. Saving the previous city into the new company directory will result in errors due to missing asset files. This is where the Asset Browser comes in handy for copying files over to a new directory, and updating the references in those files. The files updated by the Asset Browser include:

.cgf: Updates the reference to the .mtl used by the .cgf.
.mtl: Updates the texture file paths used by the material.
Note: When copying asset files (.cgf, .mtl, .dds or .tif) to a new location using the Asset Browser, all of the files need to be copied to the new directory in one drag and drop operation. So, if a .cgf file is drug and dropped into the Asset Browser without including the .mtl and texture files referenced by the material, then the .cgf will still reference the old material file location. This is why it is important to save all asset files in a Common directory in the root of the level\YourCompanyID\ directory. Then the Common directory can be drug and dropped into the Asset Browser and all file path references will be updated in the .cgf and .mtl files.

Save City To New Company Directory

  • Once the new company id has be registered, the first step is to save the test .cry level to the new company directory. In this example, the developer is saving:
Game\Levels\ABC\ABC_MyTestCity.cry
TO
Game\Levels\XYZ\XYZ_LiveCity.cry
  • Opening XYZ_LiveCity.cry will result in missing asset files, so we need to copy over the asset files from the old company directory to the new one.

Copy Asset Files Using Asset Browser

  • In the City Editor, open the Asset Browser.

File:CityEditor AccessingAssetBrowser.jpg

  • Navigate to the directory of the newly registered company code.

File:AssetBrowser NavigateToNewDirectory.jpg

  • In an explorer window, navigate to the directory of the test company code.

File:AssetBrowser ExploreToOldDirectory.jpg

  • Drag and drop the directory containing the asset files to the Asset Browser.

File:AssetBrowser DragAndDropToNewLocation.jpg

  • Close the City Editor.

Now the asset files are located in the new company code directory, but the new .cry file is still referencing the assets' old .cgf file locations. This operation just updated the references for the .mtl texture file locations and the .cgf files references to materials.

Updating .cry File Asset References

Once the asset files have been transfered to the new company code directory, the .cry file needs to be updated with the new location of the .cgf asset files.

  • Close the City Editor if it is open.
  • Extract the contents of .cry file to a new folder.

File:UpdatingCryFile ExtractToNewFolder.jpg

Note: If the extract option is not available as displayed in the image above, then create a new folder, open the .cry file with an archiving application like winrar or 7zip and copy the level.editor_xml file found in the .cry file archive to the new folder.

The extracted content contains a file called level.editor_xml that has the file path references for the .cgf files placed in the level. This file needs the .cgf file path references updated to point to the new company code assets directory (Levels\XYZ\Common). To update the references:

  • Open the level.editor_xml file in a text editing program

File:UpdatingCryFile EditWithTextEditor.jpg

  • Do a find and replace and save the file.

File:UpdatingCryFile FindAndReplaceOldRef.jpg

Note: Sometimes the file references use "\" in the path name instead of "/", so please be aware and check for both types of file paths.
  • Now the updated level.editor_xml needs to be placed back into the .cry file to overwrite the level.editor_xml file that contains the old asset file locations' references.

File:UpdatingCryFile OpenCRYArchive.jpg File:UpdatingCryFile ReplaceLevelEditorXML.jpg

  • Opening the XYZ city file should correctly load the asset files, but there may have been assets located on an external layer. In this case, the layer file will also need to be updated as well.

Updating External Layer Files

  • If a layer in the level is set to External, then the .lyr file for this layer must have it's asset file path references updated as well.
  • Copy the Layer directory from the old company code's city directory to the new directory.

File:UpdatingLYRFiles CopyLayersDir.jpg

  • Close the City Editor if it is open.
  • Navigate to the .lyr file(s), open with a text editor, use find and replace to quickly update the references and save the .lyr file.
  • Opening the .cry file should result in all of the asset files loaded and placed in the correct location in the city.
Note: Terrain texture files will have to be re-generated or imported in the level after it has been saved into the new company directory.



Back to Tutorials

Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools