// ------------------------------------------------------------
// 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
BMLast Chaos Mesh (Version 16 & 17)BMSerious Engine 1.10 Mesh (Version 11 & 12)BSLast Chaos SkeletonBALast Chaos AnimationBAELast Chaos Animation EffectTEXLast Chaos Texture
- Binary Exporter
BMLast Chaos Mesh (Version 17)BMSerious Engine 1.10 Mesh (Version 12)BSLast Chaos SkeletonBALast Chaos AnimationBAELast Chaos Animation EffectTEXLast Chaos Texture (Uncompressed)
- ASCII Exporter
AMMesh 0.1ASSkeleton 0.1AAAnimation 0.1AALAnimset List
- OBJ Exporter
OBJMesh (with UV) (this format does not support weight maps which are needed for animations)
- GLTF Exporter
GLTF/GLBMesh (without weight maps) (if .png textures exists in saving directory they will be packed into .glb file)
- Binary Importer
LODMobAll (NPC)LODActionLODTitleLODMonsterComboBINLevelGuideLODItemExchangeDTAHelp (help1)DTAMapBINArmorPreviewWTRWorldTerrain (Version 19 & 20)SATServerAttributeMapSHTServerHeightMap
- Binary Exporter
LODMobAll (NPC)LODActionLODTitleLODMonsterComboBINLevelGuideLODItemExchangeDTAHelp (help1)DTAMapBINArmorPreview
- Mapped with database
LODNPCLODActionLODTitleLODMonsterComboLODItemExchangeDTAHelp (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








