.ter file

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

.ter file

Post by Fiodis »

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.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: .ter file

Post by Teancum »

There is no program to directly edit .ter files. It's done in concert with several other files using ZeroEdit.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: .ter file

Post by Fiodis »

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?
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: .ter file

Post by AceMastermind »

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.
User avatar
ANDEWEGET
Ancient Force
Ancient Force
Posts: 1266
Joined: Tue Apr 01, 2008 8:42 am
Location: Germany
Contact:

Re: .ter file

Post by ANDEWEGET »

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...
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: .ter file

Post by Fiodis »

Thanks Ande, that was just what I needed. :)
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: .ter file

Post by AceMastermind »

Riley's table was for SWBF *.ter files but will apply to SWBF2 except this:

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.
for SWBF2 *.ter files this value is 22 instead of 21.

Source:
forums/viewtopic.php?p=328708#p328708
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

.ter file format

Post by Fiodis »

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?
User avatar
minilogoguy18
Master Bounty Hunter
Master Bounty Hunter
Posts: 1512
Joined: Wed Nov 09, 2005 11:12 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: .ter file

Post by minilogoguy18 »

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
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: .ter file

Post by Marth8880 »

It all depends on the hardware your machine is running.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: .ter file

Post by Fiodis »

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?
I wish I knew. :( I've been getting that dreaded runtime error since I got a fresh install of Win7 some three or four years ago.
Hidden/Spoiler:
Thanks to the staff for merging this, btw. I was hesitant to bump an old thread.
User avatar
ANDEWEGET
Ancient Force
Ancient Force
Posts: 1266
Joined: Tue Apr 01, 2008 8:42 am
Location: Germany
Contact:

Re: .ter file

Post by ANDEWEGET »

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.
User avatar
minilogoguy18
Master Bounty Hunter
Master Bounty Hunter
Posts: 1512
Joined: Wed Nov 09, 2005 11:12 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: .ter file

Post by minilogoguy18 »

Why not just try to reinstall the mod tools running the .exe in winxp compatibility mode?
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: .ter file

Post by lucasfart »

minilogoguy18 wrote:Why not just try to reinstall the mod tools running the .exe in winxp compatibility mode?
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. :wink:
Marth8880 wrote:It all depends on the hardware your machine is running.
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.

But we're getting offtopic now. Back to terrain files. :wink:
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: .ter file

Post by Fiodis »

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.
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.
ANDEWEGET wrote:If I was at home Id draw a pic but Im in france now...
Let me see if I've got it right...
Hidden/Spoiler:
Image
All the data for all those extra vertices outside what you see in the editor and in-game is part of the height blocks, and water blocks and texture blocks and everything? So the terrain file is some four thousand times larger than it needs to be? Why would there be all that wasted filesize?
User avatar
ANDEWEGET
Ancient Force
Ancient Force
Posts: 1266
Joined: Tue Apr 01, 2008 8:42 am
Location: Germany
Contact:

Re: .ter file

Post by ANDEWEGET »

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.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: .ter file

Post by Teancum »

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:
Image
Post Reply