// ------------------------------------------------------------
// ChaosLib - Last Chaos Library (Alpha, under construction)
// Written in .NET 5 | C# 9.0
// ------------------------------------------------------------
// ChaosLib.D3D 3D Utilites
// ChaosLib.MAP Game Data Mapper
// ------------------------------------------------------------
- Binary Importer
BM
Last Chaos Mesh (Version 16 & 17)BM
Serious Engine 1.10 Mesh (Version 11 & 12)BS
Last Chaos SkeletonBA
Last Chaos AnimationBAE
Last Chaos Animation EffectTEX
Last Chaos Texture
- Binary Exporter
BM
Last Chaos Mesh (Version 17)BM
Serious Engine 1.10 Mesh (Version 12)BS
Last Chaos SkeletonBA
Last Chaos AnimationBAE
Last Chaos Animation EffectTEX
Last Chaos Texture (Uncompressed)
- ASCII Exporter
AM
Mesh 0.1AS
Skeleton 0.1AA
Animation 0.1AAL
Animset List
- OBJ Exporter
OBJ
Mesh (with UV) (this format does not support weight maps which are needed for animations)
- GLTF Exporter
GLTF/GLB
Mesh (without weight maps) (if .png textures exists in saving directory they will be packed into .glb file)
- Binary Importer
LOD
MobAll (NPC)LOD
ActionLOD
TitleLOD
MonsterComboBIN
LevelGuideLOD
ItemExchangeDTA
Help (help1)DTA
MapBIN
ArmorPreviewWTR
WorldTerrain (Version 19 & 20)SAT
ServerAttributeMapSHT
ServerHeightMap
- Binary Exporter
LOD
MobAll (NPC)LOD
ActionLOD
TitleLOD
MonsterComboBIN
LevelGuideLOD
ItemExchangeDTA
Help (help1)DTA
MapBIN
ArmorPreview
- Mapped with database
LOD
NPCLOD
ActionLOD
TitleLOD
MonsterComboLOD
ItemExchangeDTA
Help (help1)
- Rotation in animation is unstable, quaternion correction needed
- Skeleton should be child->parent sorted before exporting
ChaosAsset chaosAsset = new ChaosAsset();
var dataObject = chaosAsset.Import(AssetType.Animation, "besurel.ba", AssetDataType.Binary);
chaosAsset.Export(AssetType.Animation, dataObject.Animations[0], "attack01.aa", AssetDataType.ASCII);
ChaosAsset chaosAsset = new ChaosAsset();
var dataObject = chaosAsset.Import(AssetType.Skeleton, "besurel.bs", AssetDataType.Binary);
chaosAsset.Export(AssetType.Skeleton, dataObject, "besurel.as", AssetDataType.ASCII);
ChaosAsset chaosAsset = new ChaosAsset();
var dataObject = chaosAsset.Import(AssetType.Mesh, "besurel.bm", AssetDataType.Binary);
chaosAsset.Export(AssetType.Mesh, dataObject, "besurel.obj", AssetDataType.OBJ);
ChaosAsset chaosAsset = new ChaosAsset();
var texture = chaosAsset.Import(AssetType.Texture, "besurel.tex", AssetDataType.Binary);
Bitmap bmp = texture.BitmapFrames[0]; // non animated textures are exported as Frame 0
bmp.Save("besurel.png", ImageFormat.Png);
ChaosMap chaosMap = new ChaosMap();
bool colorizeAttributes = true;
var dataObject = chaosMap.Import(ContentType.WorldTerrain, ContentDataType.Binary, "Dratan.wtr", colorizeAttributes);
// save attributes as merged bitmap
Bitmap bmpMerged = dataObject.AttributeBitmap.Layers.Merged;
bmpMerged.Save("attribute-combined.png", ImageFormat.Png);
ChaosMap chaosMap = new ChaosMap();
bool colorizeAttributes = true;
var dataObject = chaosMap.Import(ContentType.WorldTerrain, ContentDataType.Binary, "Dratan.wtr", colorizeAttributes);
// save single attribute
Bitmap bmpUnwalkable = dataObject.AttributeBitmap.Layers.MATT_UNWALKABLE;
bmpUnwalkable.Save("attribute-unwalkable.png", ImageFormat.Png);
// sat contains only raw attribute bytes, there is no header defining version or map size so we need to do it manually
dynamic settings = new ExpandoObject();
settings.Width = 3072;
settings.Height = 3072;
settings.IsNew = true; // sat version
settings.SeparateLayers = true; // whether create only merged bitmap or also separated layers
var dataObject = chaosMap.Import(ContentType.ServerAttributeMap, ContentDataType.Binary, "Dratan_3072_3072_0_1F.sat", settings);
// save single attribute
Bitmap bmpUnwalkable = dataObject.Layers.MATT_UNWALKABLE;
bmpUnwalkable.Save("attribute-unwalkable.png", ImageFormat.Png);
// save all merged attributes
Bitmap bmpMerged = dataObject.Layers.Merged;
bmpMerged.Save("attribute-combined.png", ImageFormat.Png);
MATT_WALKABLE
MATT_UNWALKABLE
MATT_PEACE
MATT_FREEPKZONE
MATT_WAR
MATT_STAIR_UP
MATT_STAIR_DOWN
MATT_PRODUCT_PUBLIC
MATT_PRODUCT_PRIVATE
- Karmel0x - his knowledge and helping hand