.ter file
Moderator: Moderators
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
.ter file
Does anyone know the format of the .ter file? It's getting rather annoying having to switch to a laptop for all my ZE mapping since ZE won't work on my Win7 machine. I see where it references the terrain textures, but beyond that I'm not sure where height data is stored, or texture data, or colors. I know a bit of C#, and I'm getting into SharpGL, so I thought I'd see if I couldn't write some program to quickly paint textures or raise small hills by editting the .ter file directly.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: .ter file
There is no program to directly edit .ter files. It's done in concert with several other files using ZeroEdit.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: .ter file
I know; I can't use ZE, and I want to try editing .ter files myself directly rather than going through ZE. Is that not possible because several other files must be modified as well, even if all I want to do is change terrain texture/height?
- AceMastermind
- Gametoast Staff

- Posts: 3285
- Joined: Mon Aug 21, 2006 6:23 am
- Contact:
Re: .ter file
If you want to find out where certain data is stored in the *.ter file just do a 'change>save>compare' to see where the file was modified after making changes using ZeroEditor.
- ANDEWEGET
- Ancient Force

- Posts: 1266
- Joined: Tue Apr 01, 2008 8:42 am
- Location: Germany
- Contact:
Re: .ter file
Riley did some research on .ter files:
http://ande.pytalhost.eu/ter_file_format.htm
It's not very extensive but it's a start.
If you get stuck feel free to ask. I'm not very good with C# but I know my way around bytes since I wrote the .msh exporter...
http://ande.pytalhost.eu/ter_file_format.htm
It's not very extensive but it's a start.
If you get stuck feel free to ask. I'm not very good with C# but I know my way around bytes since I wrote the .msh exporter...
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: .ter file
Thanks Ande, that was just what I needed. 
- AceMastermind
- Gametoast Staff

- Posts: 3285
- Joined: Mon Aug 21, 2006 6:23 am
- Contact:
Re: .ter file
Riley's table was for SWBF *.ter files but will apply to SWBF2 except this:
for SWBF2 *.ter files this value is 22 instead of 21.
Source:
forums/viewtopic.php?p=328708#p328708
Code: Select all
Offset | Data Type | Size (bytes) | Description
__________________________________________________________________________________
0x0004 | int | 4 | 32-bit integer, unknown purpose. This appears to always be a value of 21.Source:
forums/viewtopic.php?p=328708#p328708
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
.ter file format
I noticed that, but didn't pay much heed, though it confused me at first. Nice to know the rest of Riley's data is spot-on for BF2. 
EDIT
I posted a question last April about the BF2 .ter file format used by ZeroEditor, and Ande linked me to this very useful doc. However, I'm not quite sure I understand it perfectly. What exactly is the "total grid size" Riley talks about there? When I open a freshly created .ter file, it has a value of 1024, while the visible grid co-ordinates are (-64, -64) and (64, 64). The total "length" of the two axes would then be 64+64 = 128, meaning a 128 by 128 (meter?) map, with an area of 128^2 = 16384 square meters, right?
But then why is the total grid size 1024?
EDIT
I posted a question last April about the BF2 .ter file format used by ZeroEditor, and Ande linked me to this very useful doc. However, I'm not quite sure I understand it perfectly. What exactly is the "total grid size" Riley talks about there? When I open a freshly created .ter file, it has a value of 1024, while the visible grid co-ordinates are (-64, -64) and (64, 64). The total "length" of the two axes would then be 64+64 = 128, meaning a 128 by 128 (meter?) map, with an area of 128^2 = 16384 square meters, right?
But then why is the total grid size 1024?
- minilogoguy18
- Master Bounty Hunter

- Posts: 1512
- Joined: Wed Nov 09, 2005 11:12 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: .ter file
How is it that zeroeditor doesn't work for you but I'm on win7 x64 and it works just fine for me?
-
Marth8880
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: .ter file
It all depends on the hardware your machine is running.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: .ter file
I wish I knew.minilogoguy18 wrote:How is it that zeroeditor doesn't work for you but I'm on win7 x64 and it works just fine for me?
Hidden/Spoiler:
- ANDEWEGET
- Ancient Force

- Posts: 1266
- Joined: Tue Apr 01, 2008 8:42 am
- Location: Germany
- Contact:
Re: .ter file
Every terrain has a total map size units(which are pretty much metres)) defined at offset 0x00B0. This by default is 1024. In the editor/in game you only see the region defined by the visible grid coordinates(0x0008).
You could think of the visible grid coords as the uv coordinates for the map. The total grid size would be the texture.
The total grid size is larger than the visible grid coords so you could shift/enlarge the visible part of the terrain.
If I was at home Id draw a pic but Im in france now...
To maximize performance youd only render the parts in the visible grid region. 1024x1024 are quite a lot of verts.
You could think of the visible grid coords as the uv coordinates for the map. The total grid size would be the texture.
The total grid size is larger than the visible grid coords so you could shift/enlarge the visible part of the terrain.
If I was at home Id draw a pic but Im in france now...
To maximize performance youd only render the parts in the visible grid region. 1024x1024 are quite a lot of verts.
- minilogoguy18
- Master Bounty Hunter

- Posts: 1512
- Joined: Wed Nov 09, 2005 11:12 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: .ter file
Why not just try to reinstall the mod tools running the .exe in winxp compatibility mode?
- lucasfart
- Sith

- Posts: 1440
- Joined: Tue Feb 24, 2009 5:32 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Australia
Re: .ter file
The whole unworking ZE thing has been going on for years now. I don't know if you've seen THIS thread before, but I'm pretty sure he would have tried something along those lines.minilogoguy18 wrote:Why not just try to reinstall the mod tools running the .exe in winxp compatibility mode?
I also have the ZE problem, and I can tell you now it's not just a hardware problem. I had windows xp installed on this computer and ZE worked fine, albeit with the 3dAnalyze fix, and after updating to win 7 ultimate 64bit, it doesn't work. At all.Marth8880 wrote:It all depends on the hardware your machine is running.
But we're getting offtopic now. Back to terrain files.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: .ter file
Thanks, and yes, I've tried basically everything in that thread. The only way I can use ZE, as mentioned in the first post, is on my laptop, which is awkward and buggy as hell.lucasfart wrote:The whole unworking ZE thing has been going on for years now. I don't know if you've seen THIS thread before, but I'm pretty sure he would have tried something along those lines.
But we're getting offtopic now. Back to terrain files.
Let me see if I've got it right...ANDEWEGET wrote:If I was at home Id draw a pic but Im in france now...
Hidden/Spoiler:
- ANDEWEGET
- Ancient Force

- Posts: 1266
- Joined: Tue Apr 01, 2008 8:42 am
- Location: Germany
- Contact:
Re: .ter file
Yeah, thats right. The invisible data wont be munged so only the source is larger. Creating an algorithm which adds additional data to the file if the mapper wants a larger map is quite time consuming. Just adding a few megabytes to the source which is already many many gigs large isnt a big problem.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: .ter file
I'm a little late to the party, but I wanted to post this here as it'll be useful in future topics:
Hidden/Spoiler:

