UE2 - UT2kX UC2 - StaticMesh decopmpilation

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
UC2 - StaticMesh decompilation

OK Guys... Unreal2 Golem is done now it's time for UC2 - yep, Unreal Championship 2... I'm working on UC2Decompiler - script export is almost done, but I need some help with StaticMesh decompilation. I mean, I have all needed data, but don't know how to link MeshTri with MeshVert to produce exportable data - probably to .psk (extention will be changed to .psm, but format will remain the same) .
If someone can explain to me correlations between those two (and maybe material stuff too) I will be grateful.
 
Last edited:
  • Like
Reactions: Niuva

meowcat

take a chance
Jun 7, 2001
803
3
18
What exactly do you mean? Any idea of what kind of data it is? (list of integers or floats etc.)

The reason I ask is that I assume if you've already made the other exporter then you know the .psk format. Myabe your question was aimed at others (I'm just tossing out a few ideas...)

In most of the other model conversion stuff I've written for milkshape3D, tri lists were usually sets of 3 integers that were the indices into the list vertices (and obviously the vertices were just 3 float structs, though the static mesh data may also have another float (or maybe 3 ints for "color") corresponding to a "weight" variable used for mesh painting, I don't know exactly). I'd also expect some sort of UV list (with an index as to which vert corner it is for) kind of like what is used in the .ASE file format.
 
Last edited:

dr.flay

Dr.Flay™
Sep 19, 2011
410
10
18
53
Kernow, UK
yourunreal.wordpress.com
Are my ears believing my eyes ?
You are porting the slash-fest of UC2 into 2K4 ?
:eek:
XXXXX....

... uuum, I mean a brief and embarrassing man-hug :lol:

I think you should look at http://www.forums.chaoticdreams.org/viewtopic.php?f=8&t=6632

As far as I can see, UC2 was a natural extension of the Chaos melee system.
Both your current work may overlap, and both your experience would be useful.

I imagine it would be most practical to bolt onto the current v3.81, as the code is available to those that ask.
"Azarael" asked in the IRC room for permission, and is now balancing the Chaos-melee for a new release.

Any improvements either way can be incorporated into a new Chaos update and UC2.

Does that sound good ?
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
Thanks guys, but:

@meowcat: this is not about .psk or other any other format to export (.psk I can write with eyes closed...) - it's about format written in .usx (to be clear: UC2 StaticMesh format is different from standard used in UE2.5. Tomorrow I will give you guys some sample of code and UC2 SM format.

@dr.flay: It's not conversion - only decompiler/exporter for UC2 stuff like script, static meshes, textures and so one...
 
Last edited:

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
Here is the dump of some StaticMesh.


// Sample: CIN_Tech_pod.org_mid_console
//-----------------------------------------------------
SectionCount = 2;

0:
Unknown = 1;
TListOffset = 0;
VListOffset = 0;
VertMax = 485; <- (485 + 3) / 4 = 122
TriCount = 302;
TrisMax = 667; <- 667 + 2 = 669

1:
Unknown = 1;
TListOffset = 669;
VListOffset = 122;
VertMax = 129;
TriCount = 6;
TrisMax = 7;

EdgeCount = 171;

0:
Point0; <- 3*Float
Point1; <- 3*Float
ListId; <- 0 or 1
ListOffset0; <- IDMax < WedgeCount ( - 2 )
ListOffset1; <- IDMax < TriangleCount ( - 3 or 4 )

TriangleCount = 307;

0:
V0; <- VertId
V1; <- VertId
V2; <- VertId
SectionId; <- MaterialId

//-----------------------------------------------------

There is no FMeshVert or FMeshUV data written - at some point these two must be calculated from given data - how to do this..?
Any help will be appreciated.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Since you'd already written the exporter I kind of figured you had the .psk format down cold :)

The excerpt you posted above, is that kind of a header output? Do you have the raw binary file available to look at? The mention of 'WedgeCount' sounds like it might have to do with the UV coords (Hoppe's wedge reference in the source file for animated meshes). Could they have lumped the 3 Floats for the vertices in with 2 floats for the UV coordinate, and then a couple of bytes for material IDs or other values, so that a total vertex memsize was something like 6 floats all lumped together?
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
I've checked both Points and in most of case they're points in space - I mean, i.e. in Plane they are all the same:
Point0: -9.0, 2.4, 4.2
Point1: 9.0, 2.6, -4.2

I have an idea: what if Point0 and Point1 is only a collection of six floats and V0, V1, V2 is used to construct the vector (vertex). No idea for UV...
Later, will post the Plane sample with raw data.


As for "animated meshes" - StaticMesh inherit UPrimitive...
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
Sorry for the delay...
Code:
CreateExport 8: StaticMesh -> Plane

  [COLOR="red"]UObject.Serialize -> Position: 530903[/COLOR]
  bSkipProperties: 0
  FPropertyTag.Position: 530904
    PropertyName: Materials
    ItemName: 0
    Type: 9
    Size: 2
    ArrayFlag: False
    ArrayIndex: 0
    DataSize: 26
  bEndOfProperty: True Count: 1
  ParentId: 0

  [COLOR="red"]UPrimitive.Serialize -> Position: 530941[/COLOR]
  BoundingBox: -9.8497 2.0295 -4.5407 9.8497 2.6271 4.5407
  Raw: 5F 98 1D C1 54 E3 1 40 6A 4D 91 C0 5F 98 1D 41 68 22 28 40 6A 4D 91 40 

  BoundingSphere: 0.0 2.3283 0.0 10.86091
  Raw: 00 00 00 00 DE 02 15 40 00 00 00 00 4B C6 2D 41


  [COLOR="red"]UStaticMesh.Serialize -> Position: 530981[/COLOR]
  SectionCount: 1
  0:
    TListOffset: 0
    VListOffset: 0
    VertMax: 15
    TriCount: 8
    TrisMax: 20

    Raw: 01 00 00 00 00 00 00 00 0F 00 08 00 14 00 

  BBox (6*4): -9.8497 2.0295 -4.5407 9.8497 2.6271 4.5407
  Raw: 5F 98 1D C1 54 E3 01 40 6A 4D 91 C0 5F 98 1D 41 68 22 28 40 6A 4D 91 40 

  Origin (3*4): 9.8497    0.2988   4.5407
  Raw: 5F 98 1D 41 50 FC 98 3E 6A 4D 91 40

  Normal (3*4):  0.1015259 3.34672  0.2202304
  Raw: D4 EC CF 3D AA 30 56 40 11 84 61 3E

  EndOfBlock: 1
  Raw: 01 00 00 00

  UnknownData (20):
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    DE 02 15 40

  UnknownFloat (4): 0.0
  Raw: 00 00 00 00

  SMProperty (13*4):
    01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
    01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
    00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00
    00 00 00 00

  Unknown0Count (4): 3
    0:
      Point0: -9.8497 2.0295 -4.5407 
      Point1:  9.8497 2.6271  4.5407 
      GroupIndex: 0
      ListOffset0: 1
      ListOffset1: 2

      Raw: 5F 98 1D C1 54 E3 01 40 6A 4D 91 C0 5F 98 1D 41
           68 22 28 40 6A 4D 91 40 00 00 00 00 01 00 02 00 
    1:
      Point0: -9.8497 2.0295 -4.5407 
      Point1:  9.8497 2.6271  4.5407 
      GroupIndex: 1
      ListOffset0: 4
      ListOffset1: 0

      Raw: 5F 98 1D C1 54 E3 01 40 6A 4D 91 C0 5F 98 1D 41
           68 22 28 40 6A 4D 91 40 01 00 00 00 04 00 00 00
    2:
      Point0: -9.8497 2.0295 -4.5407 
      Point1:  9.8497 2.6271  4.5407 
      GroupIndex: 1
      ListOffset0: 4
      ListOffset1: 4

      Raw: 5F 98 1D C1 54 E3 01 40 6A 4D 91 C0 5F 98 1D 41
           68 22 28 40 6A 4D 91 40 01 00 00 00 04 00 04 00

  Unknown1Count (4): 8
    0:
      V0: 0
      V1: 1
      V2: 2
      SectionIndex: 0

      Raw: 00 00 01 00 02 00 00 00

    1:
      V0: 12
      V1: 13
      V2: 14
      SectionIndex: 0

      Raw: 0C 00 0D 00 0E 00 00 00

    2:
      V0: 4
      V1: 5
      V2: 6
      SectionIndex: 0

      Raw: 04 00 05 00 06 00 00 00

    3:
      V0: 8
      V1: 9
      V2: 10
      SectionIndex: 0

      Raw: 08 00 09 00 0A 00 00 00

    4:
      V0: 4
      V1: 6
      V2: 7
      SectionIndex: 0

      Raw: 04 00 06 00 07 00 00 00

    5:
      V0: 8
      V1: 10
      V2: 11
      SectionIndex: 0

      Raw: 08 00 0A 00 0B 00 00 00

    6:
      V0: 0
      V1: 2
      V2: 3
      SectionIndex: 0

      Raw: 00 00 02 00 03 00 00 00

    7:
      V0: 12
      V1: 14
      V2: 15
      SectionIndex: 0

      Raw: 0C 00 0E 00 0F 00 00 00

  UnknownInt: 14
  UnknownByteAtEnd: 0 [COLOR="Red"]<- if successful, always 0[/COLOR]

[COLOR="Red"][B]SerialSize: 400 -> ReadedSize: 400[/B][/COLOR]
This was supposed to be a simple plane... As you see, there is no unread data. If you want, I can dump more SM and post download link.
 

NoBigDeal

New Member
Jun 28, 2014
4
0
1
Sorry for bumping an old thread, but any news on the topic? I'm interested too.

OffTopic:
I can't understand - UC2 is like a tabu - anywhere I ask about, immediately I walk on a wall of silence. This game is almost 10 years old, so maybe it's time to stop keeping it in secret.
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
Could they have lumped the 3 Floats for the vertices in with 2 floats for the UV coordinate, and then a couple of bytes for material IDs or other values, so that a total vertex memsize was something like 6 floats all lumped together?
Can you tell me how it's done exactly (code snippet will be useful) or point to part of source code which is responsible for decode this?

Sorry for bumping an old thread, but any news on the topic? I'm interested too.
Sorry, but nothing new ... As you already know, people do no want to cooperate. :(

This looks familiar. You know the UCBP mod is still alive right?
It's not about the UC2 content (maps, models etc.), it's about the gameplay - I want to port UC2 gameplay to a newer version of UE.

People please, help me with this ...
 
Last edited:

Unreal4Eva

BioHazard!
May 19, 2009
230
0
16
Gameplay such as the style of movements, implementing the UC2 HUD, rewite the Adrenalin system, implementing the UC2 style melee? Sounds cool, keep us updated.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Hi VendorX, for the data you posted above (with the raw data) could you post a few orthogonal screenshots of the mesh from within the map editor (if that is possible) from the x, y, and z axis? I'd like to compare the data you posted against how the mesh appears when centered on the origin.

How did you know what some of those data sets were? (like the bounding box and bounding sphere)

And was this a plane or a cube? (I'm trying to work out what the set of 8 data points were)
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Very cool! Do you mind explaining some of it here (even if vaguely just to get an idea of how they format stuff)? Was it mainly just an array of indices into an array of float or int pairs (maybe 16 bit ints or floats for the UVs since they typically are trying to conserve memory on the consoles...)

I was going to ask if any of the meshes in UC2 were similar to other UT games (possibly the same meshes) so I could compare the two.
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
These six floats are just Collision Primitive, the real SM data (Points, UVs etc.) was split and stored in different .xpr packages.

Off Topic:
It's a shame, despite fact that there is so many great minds here, no one (except meowcat - btw: thanks for trying ...) was even trying to help. Moreover, I'm sure that some of these 'minds' knew exactly UC2 package structure and how to read it - so thanks for no help ...
... history likes to repeat it self - the same was with the Golem. Strange thing is, that when solution to the problem was found, everyone want it on a plate ... Jeez, people, what happened with cooperation, sharing of information ..? In the end, this is an old game - considered as abandonware - exchange of information certainly will does not hurt anyone.

... why I'm still here ... this forum is dying ...
 
  • Like
Reactions: Niuva

AlCapowned

Member
Jan 20, 2010
239
15
18
I don't think more than a few BU know and understand file formats (I certainly don't). I think that a forum with a lot of people who specialize in model/file formats like Xentax would be a good place to ask for help. It may not have been helpful for me, but maybe you would have better luck there.

Thanks again for all of your hard work.
 

VendorX

Member
Aug 2, 2010
231
6
18
BXL/Paris
Yeah, I know Xentax but the problem is that they do warez and I will not support this kind of forum (donation is mandatory to stay their member).

@meowcat:
As for Xbox optimisation: Each texture carry multiple data streams for each geometry, where it was used. So, loading a geometry takes much less time because its data is already in the memory - in other words: in case of missing texture, there will be missing part / section of geometry.
It's like Precaching in UE2.5 but much more effective.
 
Last edited:
  • Like
Reactions: Niuva