Rigs-of-rods: Compatibility with terrains with missing otc file

Created on 29 Nov 2018  路  14Comments  路  Source: RigsOfRods/rigs-of-rods

Try to load a terrain with missing otc file:

[RoR|Terrain] Error reading main *.otc file, message: 'FileNotFoundException: Cannot locate resource Houston2013.otc in resource group General. in ResourceGroupManager::openResource at /home/babis/Downloads/ror-dependencies/Source/ogre/OgreMain/src/OgreResourceGroupManager.cpp (line 698)', type: <Ogre::Exception>.

Example terrain: http://www.mediafire.com/file/nn36bdj9bo99khv/Traxxas_Stadium_Freestle_4.zip/file

It would be nice if this will work again, like older RoR versions (pre 0.4.7)

enhancement needs discussion

Most helpful comment

That's not a bug

If like 200 maps work in 0.4.6, but don't work in 0.4.8 then it is a bug. No matter how fucked up the old code was.

All 14 comments

We already had this issue, I thought I fixed it... https://github.com/RigsOfRods/rigs-of-rods/issues/1437

Nope, and it probably affects a lot (if not all) sim monsters terrains

Expected behavior: Map should load
Current behavior: A nice imgui error message

None of these maps work with our current code: http://sim-monsters.com/files/

Example error message:

[RoR|Terrain] Error reading main *.otc file, message: 'FileNotFoundException:
Cannot locate resource Houston2013.otc in resource group General.

Allright, but in this "Traxxas Stadium" map specifically, the OTC file is not missing, it's just named .cfg. That's not a bug 馃槅

That's not a bug

If like 200 maps work in 0.4.6, but don't work in 0.4.8 then it is a bug. No matter how fucked up the old code was.

Very good point. Look, I don't mean to break old content just because it's a mess, I just don't want to mix _actual backwards compatibility_ with _tolerance to whatever glitch appears in the content_.

In this case, specifically, the terrn2 file says GeometryConfig = Houston2013.otc but the fie is really "Houston2013.cfg", which is apparently a conversion mistake (old terrn format used .cfg here IIRC)

so renaming Houston2013.cfg to Houston2013.otc should work?

@tritonas00 Absolutely

It doesn't:
[RoR|Terrain] Error reading page config *.otc file, message: 'FileNotFoundException: Cannot locate resource Houston2013-page-0-0.otc in resource group General. in ResourceGroupManager::openResource at /home/babis/Downloads/ror-dependencies/Source/ogre/OgreMain/src/OgreResourceGroupManager.cpp (line 698)', type: <Ogre::Exception>. [RoR|Terrain] Empty Heightmap provided in OTC, please use 'Flat=1' instead

Instead creating just an empty file Houston2013.otc works:
otc

I just don't want to mix actual backwards compatibility with tolerance to whatever glitch appears in the content.

I agree, but not having an .otc file seems to be a very common glitch.

* Disabling the terrain geometry altogether is not supported, I may change that in the future.

I think it's time to change that.

OK, let's see - this TraxxasStadium terrain is broken, filename is wrong. We have 2 ways of dealing with it:

  1. Report error and refuse to load a broken terrain. Makes sense to me. Users want to know they're using broken stuff and request it be fixed.
  2. Load the terrain anyway, likely wrong. Makes no sense to me - then RoR will appear broken and we'll be requested to "fix" it further.

It would be nice if this will work again, like older RoR versions (pre 0.4.7)

Are you positive this was tolerated? In that case let's support it again. But we must log a warning "missng .otc, continuing without!" so that the modder who created/ported the terrain won't tear her hair.

We already do 1. The problem is its just not only one map, we talk about all sim monsters content here...
And they have a lot of maps

It worked before (they say in their forum) so it should work on the latest ror version

2 would be the best solution: load the map as written by its author and tell him to fix asap

or if you dont want people to upgrade to 0.4.8 leave it as is (1)

OK then, let's see:

The old parser simply ignored failure to load .otc file: https://github.com/RigsOfRods/rigs-of-rods/blob/2d8546df3f1196fb7f7093ea79a557d70e1af279/source/main/terrain/TerrainGeometryManager.cpp#L196, leaving m_terrain_config empty. Then it read values from there, using defaults if not specified: https://github.com/RigsOfRods/rigs-of-rods/blob/2d8546df3f1196fb7f7093ea79a557d70e1af279/source/main/terrain/TerrainGeometryManager.cpp#L262

@ulteq It'll be faster if you patch this... just fill in the defaults if reading the .otc fails here: https://github.com/RigsOfRods/rigs-of-rods/blob/master/source/main/terrain/TerrainGeometryManager.cpp#L288. Alternatively you can put them directly to the class: https://github.com/RigsOfRods/rigs-of-rods/blob/master/source/main/terrain/TerrainGeometryManager.cpp#L288

just fill in the defaults if reading the .otc fails

I tried that yesterday, but it didn't work for some reason. I can try again later today.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

4x4convoy picture 4x4convoy  路  6Comments

tritonas00 picture tritonas00  路  9Comments

ghost picture ghost  路  7Comments

ghost picture ghost  路  7Comments

DirtGamer301 picture DirtGamer301  路  11Comments