Achx format

From vchelaru/FlatRedBall · View interactive version

Achx format is an AI agent skill from the GitHub repository vchelaru/FlatRedBall. The .achx/.achj animation file formats and their save/runtime split. Triggers: .achx, .achj, AnimationChainListSave, AnimationChainSave, AnimationFrameSave, ToAnimationChainList, FromXElement, ParseJson.

How to use this skill

Skill file

.achx Animation File Format

.achx is the XML serialization of an AnimationChainListSave. It describes texture-flip animations: a list of chains, each a list of frames, each frame naming a texture + UV/pixel coordinates + timing (and, more recently, optional per-frame color). See the AnimationChainList file docs and the runtime API.

The save ↔ runtime split (the core thing to internalize)

There are two parallel class trees — a serialized "Save" tree and a runtime tree — and you convert between them. Don't confuse the two.

| Save (.achx, Content/AnimationChain/) | Runtime (Graphics/Animation/) |

|---|---|

| AnimationChainListSave ([XmlType("AnimationChainArraySave")]) | AnimationChainList |

| AnimationChainSave ([XmlRoot("AnimationChain")]) | AnimationChain |

| AnimationFrameSave | AnimationFrame |

Landmines

Glue editor side

Glue registers an .achj AssetTypeInfo from OfficialPlugins/AnimationChainPlugin/Managers/AssetTypeInfoManager.cs (GetAchjAti), only when the project's FileVersion is at least GluxVersions.AchjAnimationFiles or it is FRB source-linked, because the generated load code is identical and an older engine only fails at runtime. Every other .achx hook (FileHelper.DoesFileReferenceContent, ContentParser.GetNamedObjectsIn, the referenced-texture scan in MainAnimationChainPlugin, FileChangeManager, Animation Editor launch) lists .achj beside it. .achj is read-only in Glue: the engine can't write it, so the in-Glue editor tab and the New File window stay .achx-only.

Per-frame color (signpost)

Frames carry optional nullable tint: Red/Green/Blue/Alpha and a color operation. The .achx/Save side stores 0–255 ints and an editor-flavored op enum; the runtime side stores 0–1 floats and FlatRedBall.Graphics.ColorOperation, with mapping done in AnimationFrameSave.ToAnimationFrame. Applied to the Sprite in Sprite.UpdateToAnimationFrame (ApplyAnimationFrameColor). Read the source there for the exact channels, identity-on-null rules, and op mapping.

Keyframe interpolation (signpost)

Frames carry optional Skip{Offset,Color}Keyframe and {Offset,Color}Interpolation/Easing fields. Shapes add the same for offset, plus size on rectangles and circles and points on polygons. Graphics/Animation/KeyframeEvaluator.cs evaluates them (EvaluateOffset, EvaluateColor, EvaluateShape, EvaluateShapePoints). Sprite applies only offset and color (ApplyKeyframeInterpolation); shape values are returned for the caller to apply. A new shape field goes in the shape save (Content/Math/Geometry/*Save.cs, Content/Polygon/PolygonSave.cs), AnimationFrameSave.ShapeCollectionSaveFromXElement and ParseShapesJson.

Key files

| File (Engines/FlatRedBallXNA/FlatRedBall/) | Purpose |

|---|---|

| Content/AnimationChain/AnimationChainListSave.cs | .achx/.achj root; FromFile, ToAnimationChainList, manual load, ParseJson |

| Content/AnimationChain/AnimationChainSave.cs | one chain; ToAnimationChain, FromXElement |

| Content/AnimationChain/AnimationFrameSave.cs | one frame; ToAnimationFrame, FromXElement, color map |

| Graphics/Animation/AnimationFrame.cs | runtime frame |

| Sprite.cs | UpdateToAnimationFrame — where a frame is applied to a Sprite |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.