Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

Converters!

The general place to discuss MOD''ing Freelancer!

Post Sun Aug 14, 2005 5:56 am

Teeheehee,

post edited.. seems some people do not want to heed advice...

Evangel - Consider this a warning - You will not be told again....

Harrier

Moderator - The Lancers Reactor



Edited by - harrier on 8/14/2005 5:02:10 PM

Post Sun Aug 14, 2005 6:39 am

OK, well... erm... my questions would be:

1. Do you have this thing working with dummy content yet? If not... well, then who cares about a converter... if yes, let's see some screenshots. I've read at least 2 posts from people claiming that they were going to build one of these (so... no, this is not a new idea, but one that nobody's delivered).

2. If it's working aside from being able to import/export CMPs... then why not make converting the CMPs to .X something that users have to do in advance? I mean, it's not like it's hard to convert to .X with MS3D... and .X is pretty useless format for anything aside from a viewer like you're talking about- most modelers don't support it, so there's never been much demand for such a converter. So why make such a conversion step a stumbling block- just get the rest of it working, prove that it works by building working THNs that we can test as a community with some simple CMPs (say, a few colored spheres that we can animate, with a special shape for the camera/POV and a special set of shapes for NPC/Trent/Ships + motion paths and a working timeline editor + object menu + script output menu / console), and then release it with documentation and the sample materials... and you're done.

3. If viewing CMPs is super-vital for some reason, then I think you're going to need the help of Louva-Deus, Sshan and/or Colin Sandby- these three have done more than just about anybody in terms of building viewer/converter code for this file format. They're all EOA members, and ... not to put too fine a point on this ... you've already managed to annoy one of them by not being forthright about what you wanted to build here. Plus if you really knew what you were getting into and who's who around here, you'd already know who these guys were... which makes me doubt that you have the rest of this built yet, but... I'd be as delighted as anybody to see a visual animation program for THNs, so I'll give you the benefit of the doubt here.

So... there ya go... a helpful and complete answer. Now you just have to prove you're not full of hot air, and show us some code and screenshots from your app. in action Basically, the last two guys who talked this up never actually did anything ... and you have yet to release a project here, so I'm kind've hoping you're not just another blowhard, but proof is in the pudding.

And Evangel, how many times do people have to warn you outright that you're not allowed to pull that stuff here? Sheesh...

Post Sun Aug 14, 2005 8:08 am

Someone shoot Evangel.

Alright, the reason i need a cmp importer is so when i load up a THN file, i can also load up the object m0dels. This way i don't have to use dummy m0dels. The program is still in production, Although i'm not entirely sure i can make the 3D view, i'm absolutly positive i can make the list view, tree view, and advanced view, all of which will be helpful in creating a THN. Heres some of the code i'm using to access a THN file (it only loads the scene type, but the other types are soon to follow):

Option Explicit
Dim inttemp As Integer
Dim STrtemp As String

Public NUM_SCENE As Integer
Public NUM_COMPOUND As Integer
Public NUM_PSYS As Integer
Public NUM_CAMERA As Integer
Public NUM_LIGHT As Integer
Public NUM_MONITER As Integer
Public NUM_MOTION As Integer
Public NUM_MARKER As Integer

Public Sub ReadTHN(Path As String)
Dim iff As Integer, blnok As Boolean, strname As String, intbox As Integer

iff = FreeFile()

'reset variables
NUM_SCENE = 0
NUM_COMPOUND = 0
NUM_PSYS = 0
NUM_CAMERA = 0
NUM_LIGHT = 0
NUM_MONITER = 0
NUM_MOTION = 0
NUM_MARKER = 0
inttemp = 0
intbox = 0

Open Path For Input As #iff
'get duration
Line Input #iff, STrtemp
STrtemp = Replace(STrtemp, "duration=", vbNullString)
THNFile.Duration = STrtemp

'Get rid of blank line
Line Input #iff, STrtemp

'Get Entities
Do Until blnok = True
'Take care of 2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp

'Store Name
Line Input #iff, strname
strname = Replace(strname, "entity_name=", vbNullString)
strname = Trim(strname)


'Get Type
Line Input #iff, STrtemp
STrtemp = Replace(STrtemp, "type=", vbNullString)
STrtemp = Trim(STrtemp)

Select Case STrtemp
Case "SCENE":
NUM_SCENE = NUM_SCENE + 1

'get Props
With THNFile.Entities(inttemp).Scenes(NUM_SCENE)
.type = STrtemp

Line Input #iff, STrtemp
.Template = STrtemp

Line Input #iff, STrtemp
.Lightgroup = STrtemp

Line Input #iff, STrtemp
.Sortgroup = STrtemp

Line Input #iff, STrtemp
.UserFlag = STrtemp

'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp

'pos values
Line Input #iff, STrtemp
.SpatialProps.pos.Value1 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.pos.Value2 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.pos.Value3 = STrtemp

'3 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp

'orient values
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value1 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value2 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value3 = STrtemp

'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value1 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value2 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value3 = STrtemp

'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value1 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value2 = STrtemp

Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value3 = STrtemp

'3 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp

'up and front values
Line Input #iff, STrtemp
.Up = STrtemp

Line Input #iff, STrtemp
.Front = STrtemp

'useless line
Line Input #iff, STrtemp

'ambient values
Line Input #iff, STrtemp
.Ambient.Value1 = STrtemp

Line Input #iff, STrtemp
.Ambient.Value2 = STrtemp

Line Input #iff, STrtemp
.Ambient.Value3 = STrtemp

'useless line
Line Input #iff, STrtemp
End With
Case "COMPOUND":
Case Else:
intbox = MsgBox("Unknown Entity Type " & Chr(34) & STrtemp & Chr(34) & " Encountered in Entity " & (inttemp + 1) & " - " & strname, vbExclamation + vbApplicationModal + vbOKCancel, "Unknown Entry"

'if no, cancel THN file load
If intbox = 0 Then
WipeTHNvar
Exit Sub
End If
End Select

inttemp = inttemp + 1
Loop

'Get Events

Close #iff

End Sub

NOTE: This stupid forum takes out spaces x.x

And a screenie of the 3D interface (kudos to foxer for designing it):
Interface



EDIT: The other guys didn't deliever eh? Well i'll promise you i'll at LEAST get that advanced view working. That alone should make THN editing much easier.

Edited by - Blackhole2001 on 8/14/2005 10:44:22 AM

Please, if you are going to post pictures make them small, if they are large please post them as links as I've done above - Parabolix

Edited by - parabolix on 8/14/2005 5:07:36 PM

Edited by - Finalday on 8/15/2005 4:53:53 AM

Post Sun Aug 14, 2005 11:31 am

Erm, I hate to put a damper on things but that code isn't going to work for anything but a very specific type of thn file. You're ignoring lines in the middle of the file because they are "useless blank lines", but that will not be the case for many files. The order of thn files can be changed around completely, and often is: some of the files have the events section before entities, for example. Also, around half of the files have the constants substituted for their numerical values - you need to take this into account as well. The scripting language these files are written in (LUA) is very complex and you cannot simply assume the location of data. A good way of doing it is to work off the line's position in the object hierarchy, i.e. keep a record every time you traverse up or down a level.

You need to be a lot more flexible when reading these files - try looking at a wider range of examples to get the hang of it. I've been working on my own project on and off for the last 6 months or so, and I have a working editor/preview that supports a pretty wide range of objects, although admittedly in 2D. Let me know if you need any assistance with your project.

Post Sun Aug 14, 2005 1:44 pm

ah, sh*t, i looked at a bunch of THN files, and although i do know that each section for entities is predefined, i didn't know their locations could be swapped around... *sigh* that calls for a completely different setup. It was what i originally wanted to do, but i haven't figured out how to program it. Any ideas?

What are you programming it in? VB6 here.


Edited by - Blackhole2001 on 8/14/2005 2:47:15 PM

Edited by - Finalday on 8/15/2005 4:50:56 AM

Post Mon Aug 15, 2005 3:23 am

I'm using VB.NET myself, and I'm currently converting some of it over to C# .NET.

The best way that I've found to read the files is not line-by-line, but to read them as one long stream. Read the stream and keep track of each time you move up or down the object hierarchy (best way is to record encounters with {'s and }'s). You'll have to record the information you come across as you come across it, and then determine what to do with it when you reach the end of an object. The lines signalling entity/event type are not always near the start, in fact they're often right at the end of a section, so you can't read straight into a user-defined-type (as you're currently doing) since you often won't know what type it is.

Post Mon Aug 15, 2005 3:53 am

Blackhole2001, I have left you notes before, but aparently your not seeing them. Please uncheck your Add Sig box after the first post in a thread. Sig use is alowed only once pre thread and yours is redundent. I have edited lots of them out, so please comply with the rules.


Michael

Please read the Rules and Regs before posting. When in doubt, Search the Forums to find it out.
Looking for a mod or ship, check in Here
You have entered a "Flame Free" area, please extinguish all lights and secure all combustibles, Thanks!
Have you been to the Welcome to The Lancers Reactor Yet?
Portalive TS Server IP: 128.39.88.122 (TLR)
IBFourms

Post Mon Aug 15, 2005 12:14 pm

ouch, i never saw that finalday... sorry ><

i won't do that anymore. Just don't kill me ok? :-/

vb.net? Ah, i also use that. It was having issues converting my VB6 project so i had figured i might as well just finish it in VB6. In this case, we might as well team up, cause 1 program is better than 2.

Any help you need?

Post Tue Aug 23, 2005 8:48 am

This project is sounding more credible now, will have to keep an eye on it.

Return to Freelancer General Editing Forum