Mass Battle Frameworkv1.20.0

Authoring & Baking

UNIT AUTHORING PIPELINE

Agent Creator / Unit Assembly → bake → Niagara system + AgentConfig

两种烘焙模式 Two Bake Modes

一个单位在游戏里能被画出来,靠的是一组由编辑器工具生成的资产:静态网格、材质实例、动画纹理、Niagara 系统、渲染器蓝图、单位配置资产。这些资产不用手工拼——Mass Battle Agent Creator 面板一次 Generate 就全部产出。

A unit becomes drawable through a set of tool-generated assets: static mesh, material instances, animation textures, a Niagara system, a renderer Blueprint and a unit config asset. You do not assemble them by hand — one Generate on the Mass Battle Agent Creator panel produces the whole set.

烘焙模式不是你要选的开关:面板会根据模型源自动推导出当前模式。源是骨骼网格时走 Standard;源是装配模板时走 Advanced。你只需要决定这个单位要不要换装,模式会跟着源落到正确的一边。

The bake mode is not a switch you set — the panel derives it from the model source. A skeletal mesh source bakes Standard; an assembly template source bakes Advanced. You only decide whether the unit needs outfit variation; the mode follows the source.

Standard

一份模型进去,一组产物出来。适合单模型、无换装的单位:一个单位一套网格、一张图集或两者兼有,配一套动画。每条渲染带可以分别选骨骼、顶点或图集方式;图集不做像素烘焙,像素来自你的图集。One model in, one product family out. For units with a single model and no outfit variation: one mesh, one atlas or both, plus one animation set. Each render band can pick bone, vertex or atlas drawing on its own; atlas bands never bake pixels — the pixels come from your atlas.

Advanced

给可换装的单位用:把 Unit Assembly 面板搭好的多部件模板烘成一个系统里多个部件、每个部件多个版本的产物。游戏里同一兵种可以穿出许多种搭配。For units that vary outfit: bakes a multi-part template built in the Unit Assembly panel into several parts in one system, each with several versions. One unit type then appears in many outfits in game.

模式Mode 你提供You provide 产物形态What comes out 适合Fits
StandardStandard 按渲染带准备骨骼网格和/或图集 + 八组动画A skeletal mesh and/or an atlas covering the render bands + the eight animation buckets 一个部件、一个版本的完整单位A complete unit: one part, one version 普通兵种、载具、建筑、2D / 像素风Plain troops, vehicles, buildings, 2D and pixel-art looks
AdvancedAdvanced Unit Assembly 模板蓝图(部件、版本、组合)A Unit Assembly template Blueprint (parts, versions, combinations) 多部件多版本的完整单位A complete unit: several parts, several versions each 需要换装、混搭的兵种Troops that must vary outfit or gear

第一次烘焙 Your First Bake

打开方式:菜单 Window → Tools → Mass Battle Agent Creator,或关卡编辑器工具栏上的同名片按钮。面板自上而下是 Generate / Clear 一行、工具入口一行(Assembly / Mesh Prep / Sprite Prep / Tool Box)、Show Substeps 与它展开的子步骤卡(Advanced 下这两项隐藏——复合烘焙没有子步骤)、详情视图,以及底部的日志区。你要填的东西都在详情视图里,它按四组陈列:0.RenderProfile(单位配置清单、资产名、生成路径)、1.RenderBands(渲染带表)、2.RenderSources(模型源)、3.GeneratedAssets(上次烘焙的产物)。当前烘焙模式由模型源推导,不在这些字段里手选。

Open it from Window → Tools → Mass Battle Agent Creator, or the button of the same name on the level editor toolbar. Top to bottom the panel holds the Generate / Clear row, the tool-entry row (Assembly / Mesh Prep / Sprite Prep / Tool Box), Show Substeps with the sub-step card it expands (both hidden in Advanced — the composite bake has no sub-steps), the details view, and the log dock at the bottom. Everything you fill in lives in the details view, grouped four ways: 0.RenderProfile (the Agent Config list, asset name, generate path), 1.RenderBands (the band table), 2.RenderSources (the model source) and 3.GeneratedAssets (what the last bake produced). The bake mode is derived from the model source — it is not one of the fields you pick.

每组各管一件事。0.RenderProfile 最上面是 Agent Config 清单:这次烘焙要写哪些单位配置。清单可以填一份,也可以填多份——第一份非空条目是主配置,面板从它还原设置;烘焙时配方与全部动画/配置字段会写进清单里的每一份,所以共用同一套美术资产的几个单位能一次重烘、保持一致。清单留空也可以:Generate 会在生成路径下按资产名新建一份配置,并把配方写进去。

Each group owns one concern. The top row of 0.RenderProfile is the Agent Config list: which unit configs this bake writes. The list takes one entry or several — its first non-null entry is the primary, the config the panel restores its setup from; at bake the recipe and every animation/config field are written into every listed config, so several units sharing one set of art assets stay in step through a single re-bake. The list may also be left empty: Generate then creates one config under the generate path and records the recipe into it.

上次的设置怎么记回来:记在单位配置里。每份 Agent Config 都带一份烘焙配方——资产名、搜索与生成路径、渲染带表、模型源、sprite 图集源、actor 类。每次成功 Generate 结束都会把当前设置写进清单里每一份配置并各自保存;下次把同一份配置填回清单,面板就照主配置的配方还原,不用重填一遍。网格侧的烘焙输入(采样率、UV 通道、纹理尺寸等)与图集帧率不在配方里:它们写在模型源资产(ATT)和图集资产(ATA)上,每次烘焙直接从资产读。

How your setup comes back: it is stored in the unit config. Every Agent Config carries a bake recipe — asset name, search and generate paths, render band table, model source, sprite atlas source and actor class. At the end of every successful Generate the current setup is written into every listed config and each one is saved; fill the same config back in later and the panel restores itself from the primary config's recipe, with nothing to re-type. Mesh-side bake inputs (sample rate, UV channels, texture sizes and so on) and the atlas frame rate are not in the recipe: they live on the model-source asset (ATT) and the atlas asset (ATA), and every bake reads them from there.

烘焙要复制的模板与产物母材质在设置页里改:Editor Preferences → Plugins → MassBattle,值按项目、按用户保存。这页分五组——Localization、UI、Bake Templates、Slot Atlas、Sprite;与烘焙相关的只有后三组:Bake Templates 装每次烘焙都会复制的 Niagara 系统模板与渲染器蓝图模板,Slot Atlas 是槽位图集烘焙的产物母材质,Sprite 是 sprite 单位材质实例的父材质(图集自带母材质时不生效)。这四项都有出厂默认值,新工程不改也能开箱烘焙。相关 API:MassBattleEditorSettings · MassBattleBakeTemplatePaths。

The templates and output master materials a bake duplicates are edited on the settings page: Editor Preferences → Plugins → MassBattle, stored per project and per user. It splits into five categories — Localization, UI, Bake Templates, Slot Atlas and Sprite; only the last three concern baking: Bake Templates holds the Niagara system template and renderer Blueprint every bake duplicates, Slot Atlas is the output master material of the Slot Atlas bake, and Sprite is the parent for a sprite unit's material instance (unused when the atlas carries its own master). All four entries ship with factory defaults, so a fresh project bakes out of the box without touching them. Related API: MassBattleEditorSettings · MassBattleBakeTemplatePaths.

面板上的字段 Fields on the panel

字段Field 默认值Default 说明Notes
Agent Config 一个空槽One empty slot 0.RenderProfile 的第一行。填这次烘焙要写的单位配置;第一份非空条目是主配置,决定面板还原哪套设置。留空则由 Generate 在生成路径下自建一份。The first row of 0.RenderProfile. Lists the unit configs this bake writes; the first non-null entry is the primary and decides which setup the panel restores. Leave it empty and Generate creates one config under the generate path.
Asset Name — 所有生成资产共用的名字。填 HumanSoldier,就得到 SM_HumanSoldier、NS_HumanSoldier、AgentConfig_HumanSoldier 等一整套。The name every generated asset shares. Enter HumanSoldier and you get the whole family — SM_HumanSoldier, NS_HumanSoldier, AgentConfig_HumanSoldier and so on.
Generate Path 源目录下的 Gen_<名字>Gen_<name> beside the source 生成资产落地的目录。部件级产物进 P<n> 子目录,单位级产物(系统、渲染器、配置)留在根目录。Where generated assets land. Part-level products go into a P<n> subfolder; unit-level products (system, renderer, config) stay at the root.
Mesh Asset — 2.RenderSources 的模型源资产(ATT):单网格管线的骨骼网格 + 分桶动画,或 Advanced 的装配模板,二选一,在 Mesh Prep 里填。有网格档或走 Advanced 时出现。The model-source asset (ATT) under 2.RenderSources: a skeletal mesh plus bucketed clips for the single-mesh pipeline, or an assembly template for Advanced — exactly one, authored in Mesh Prep. Appears with a mesh band or in Advanced.
Sprite Asset — 2.RenderSources 的图集资产(ATA):纹理 + 网格 + 逐桶帧区间,在 Sprite Prep 里预填。有档走图集渲染时出现。The atlas asset (ATA) under 2.RenderSources: the texture plus its grid and per-bucket frame ranges, prepared in Sprite Prep. Appears when a band renders through an atlas.
Actor Class — 2.RenderSources 的 Actor 档类,按蓝图选择。有 Actor 档时出现。The class an Actor band spawns, picked as a Blueprint, under 2.RenderSources. Appears with an Actor band.

1.RenderBands 的档位表与 3.GeneratedAssets 的产物行不在这张表里——前者见下方《渲染带》,后者见《产物落在哪》。

1.RenderBands's band table and 3.GeneratedAssets's output rows are not in this table — the first is covered under Render Bands below, the second under What Lands Where.

动画放哪里 Where animations go

动画按用途分八组:Idle / Move / Fall / Appear / Attack / Hit / Death / Other。每组最多 8 段,对应运行时的 8 个动画槽;Idle 与 Move 是循环底轨,其余是一次性播放的片段。填了哪几组,运行时就只会用哪几组——比如 Appear 留空,单位出生就没有出现动画。

Animations are grouped by purpose: Idle / Move / Fall / Appear / Attack / Hit / Death / Other. Each bucket holds up to eight clips, matching the eight runtime slots; Idle and Move are the looping base tracks, the rest play once. Only the buckets you fill are used at runtime — leave Appear empty and the unit simply has no spawn animation.

渲染带 Render Bands

档位表是一到五条渲染带,由近到远排列。每条带只配两件事:屏幕尺寸下界(占屏大于等于它时使用这条带,最后一条设为 0)与本带的渲染方式(骨骼、顶点或图集)。几何 LOD 不在这里选,动画混合层级由渲染方式决定、也不用手填。只有单位真的会随距离切换表现时才加带——一条带是常态。Advanced 固定走骨骼方式,逐档混排(含顶点与图集)属于 Standard。

The band table is one to five render bands, near to far. Each band carries just two things: a screen-size lower bound (the band applies when the projected screen size is at or above it; set the last band to 0) and that band's render mode (bone, vertex or atlas). Geometry LOD is not chosen here, and the animation blend level follows from the render mode — neither is hand-authored. Add a band only when the unit really switches representation with distance — one band is the common case. Advanced is always bone; per-band mixing (including vertex and atlas) belongs to Standard.

按 Generate 之后 What Generate does

Standard 的 Generate 是固定五步,进度窗会逐步显示:

Generate in Standard is a fixed five-step sequence, shown step by step in the progress window:

# 步骤Step 产出Produces
1转换静态网格与材质实例Convert static mesh & material instancesSM_<name> 与逐 LOD 逐槽的材质实例plus per-LOD, per-slot material instances MI_Vert_<name> (纯骨骼档则为(bone-only: MI_BoneCS_<name>))
2复制系统与渲染器并填槽Duplicate system & renderer, fill the slotNS_<name> · Renderer_<name>
3创建单位配置资产Create the unit data assetsAgentConfig_<name> · DA_<name>
4创建 VAT 纹理Create VAT texturesVAT_<name>_*
5动画烘焙(逐 LOD)Animation bake (per LOD)AnimDataTex_<name> 与填好内容的 VAT 纹理and the filled VAT textures

Standard 走图集渲染时,Generate 只装配渲染器 → 单位配置 → 图集材质实例,不碰像素。Advanced 则是一次复合烘焙,所有子阶段写进日志,进度窗只有一个驱动步。

When Standard draws through atlas bands, Generate only wires renderer → unit config → atlas material instance and never touches pixels. Advanced is a single composite bake whose sub-phases all report into the log; the progress window carries one driving step.

重烘是原位覆盖。再按一次 Generate 时,工具先扫描目标目录里已存在的生成资产,弹一个按类分组的确认窗。确认即以同样名字重写——引用不会断;取消则分毫不动。失败不会弹出分散的错误框,统一落到进度窗的失败终态与两处日志。

Re-baking overwrites in place. Press Generate again and the tool first scans the output folder for existing generated assets and shows one confirmation grouped by class. Confirm and they are rewritten under the same names — references stay intact; cancel and nothing is touched. Failures do not pop scattered error dialogs; they land as the progress window's failed state plus both logs.

换装:Unit Assembly Unit Assembly: Parts and Versions

要做出「同一兵种、许多种搭配」,先在一个专门的页签里搭装配模板,再用 Advanced 烘它。页签名是 Unit Assembly,从 Agent Creator 进入,也可以从 Window → Tools 单独打开。

To get "one troop type, many outfits", first build an assembly template in its own tab, then bake it with Advanced. The tab is Unit Assembly; open it from the Agent Creator, or on its own from Window → Tools.

部件Parts

单位由若干部件组成。每个部件是系统里一条独立的分支,也是搭配里一个可选的位置。部件有两种:Body(顶层、带蒙皮动画)与附件(刚体,挂在 Body 的某根骨骼的 socket 上)。A unit is made of parts. Each part is one independent branch in the system and one switchable slot in an outfit. There are two kinds: Body (top-level, skinned and animated) and Attachment (rigid, mounted on a socket of one of the Body's bones).

版本Versions

一个部件的每个版本就是一件具体的模型:几顶不同的头盔就是头盔部件的几个版本。每个版本在产物里独享一个渲染器,因此可以有自己的材质、贴图与姿态修正。Each version of a part is one concrete model: three helmets are three versions of the helmet part. Every version gets its own renderer in the output, so it can carry its own materials, textures and pose correction.

组合Combinations

组合是「每个部件各显示哪个版本」的具名快照。单位出生时定下一个组合,整局不变。可以用一张随机卡代替逐项指定,让同一兵种在场上自然穿出许多种搭配。A combination is a named snapshot of "which version each part shows". A unit picks one at spawn and keeps it for life. A random card can replace the explicit picks so one troop type naturally shows many outfits on the field.

搭一个模板 Building a template

模板的持久载体是一张蓝图资产(面板的 Save 写它,Load 读它)。保存后,每个部件版本都会以一个真实组件的形式出现在蓝图里,命名是 SK_<部件>_V<版本号>(骨骼版本是骨骼网格组件,静态网格版本是静态网格组件,命名空间相同);打开蓝图就能看到整具单位,也方便逐个核对。

A template persists as a Blueprint asset (the panel's Save writes it, Load reads it). After saving, every part version appears in the Blueprint as a real component named SK_<Part>_V<Index> — a skeletal mesh component for skeletal versions, a static mesh component for static ones, in the same namespace. Open the Blueprint to see the assembled unit and check each piece.

搭的顺序大致是:加一个 Body 部件 → 把骨骼网格拖成它的版本 → 再加下一个部件 → 给附件选父件与 socket → 摆位 → 录几个组合 → Save。摆位分两级:部件自己的占位符变换对该部件的所有版本生效;版本变换只影响那一个版本。挂件的变换是相对 socket 的。

The usual order: add a Body part → drop a skeletal mesh in as its version → add the next part → give attachments a parent part and socket → place them → capture a few combinations → Save. Placement has two levels: the part's own placeholder transform applies to all of its versions; a version transform affects only that one version. An attachment's transform is relative to its socket.

摆放时把缩放留在 1。摆位靠移动与旋转;混用缩放会让烘焙出的合并几何出偏差。

Keep scale at 1 while placing. Position and rotation are the intended tools; mixed scales skew the merged geometry the bake produces.

面板里还有一个进阶开关:随机卡用参与文本描述允许版本集,例如 0,2,5-7、all、none,留空等于全部版本。一张随机卡可以覆盖成百上千种搭配——这是"部件数 × 版本数"的组合爆炸唯一划算的表达方式。

One advanced switch lives in the panel: a random card describes allowed version sets as membership text — 0,2,5-7, all, none, empty meaning every version. One random card can cover hundreds of outfits — the only affordable way to express the combinatorial explosion of "parts × versions".

打组(Bake Group)解决另一件事:几个总是同穿同脱的部件(比如整套护甲),可以选中后右键 Group Selected Parts 并成一组。烘焙时一组只产出一个 emitter,组内每个在组合里出现过的版本元组合并成一份网格、占一个 renderer。合并只合几何——材质槽不合并,合并网格的槽是各成员槽的串接,每个源 section 仍拿自己的材质与骨骼参数。组名可以双击组徽章就地改,改名会带着整组一起改。

Bake groups solve a different problem: several parts that always come off the same rack (a whole armour set, say) can be selected and joined with Group Selected Parts. At bake a group produces one emitter, and every version-tuple that actually appears in a combination is merged into one mesh occupying one renderer. Only geometry is merged — material slots are not: the merged mesh's slots are the concatenation of its members' slots, so every source section keeps its own material and bone params. Double-click a group badge to rename it, and the whole group follows.

产物落在哪 What Lands Where

资产Asset 是什么What it is 谁用它Who consumes it
SM_<name> 转换出的静态网格,带逐 LOD 的材质槽The converted static mesh with per-LOD material slots 渲染器的网格槽The renderer's mesh slot
MI_Vert_<name> · MI_BoneCS_<name> 逐 LOD 逐槽的顶点材质实例;混合档另加每个源材质槽一份骨骼副本,纯骨骼档只有那一套。Per-LOD, per-slot vertex instances; mixed bands add one bone copy per source material slot, while a bone-only setup has just that one set. 网格的各个材质槽The mesh's material slots
VAT_<name>_* 逐 LOD 的动画纹理(骨骼或顶点)Per-LOD animation textures (bone or vertex) 材质实例The material instances
AnimDataTex_<name> 动画索引共用的一张数据纹理One shared data texture indexing the animation clips 材质实例The material instances
DA_<name> 烘焙数据资产:源网格、采样率、UV 通道、动画清单Bake data asset: source mesh, sample rate, UV channel, clip list 渲染器蓝图(渲染时取用)The renderer Blueprint, at render time
NS_<name> 复制并接线好的 Niagara 系统The duplicated, wired Niagara system 单位配置The unit config
Renderer_<name> 复制出的渲染器蓝图,已指向 DA_<名字>The duplicated renderer Blueprint, already pointing at DA_<name> 单位配置The unit config
AgentConfig_<name> 单位配置资产:渲染器类、LOD 表、哪些动画可用The unit config: renderer class, LOD table, which animations exist 你的生成逻辑 / 兵种设定Your spawn logic / unit definition

目录分类统一:单位级资产(系统、渲染器、单位配置)在 Generate Path 根下;部件级资产(静态网格、材质、VAT 纹理、烘焙数据资产)进 P<部件号> 子目录;Advanced 里跟随 socket 的刚体几何另进 Rigid 子目录。

The folder split is uniform: unit-level assets (system, renderer, unit config) sit at the Generate Path root; part-level assets (static mesh, materials, VAT textures, bake data asset) go into a P<index> subfolder; in Advanced the socket-following rigid geometry lands in a Rigid subfolder.

烘完怎么用 After the Bake

烘焙已经把这个单位需要的东西都接好了:单位配置里记着渲染器类与 LOD 表,渲染器里记着烘焙数据资产与材质,系统里记着一到多个部件分支。你要做的只有一件事——用这份单位配置生成你的单位,与配置任意兵种的参数没有区别。

The bake has already wired everything the unit needs: the unit config records the renderer class and LOD table, the renderer records the bake data asset and materials, the system records one or more part branches. All that is left is to spawn your units from that config — no different from configuring any other troop type.

改了模型、动画或装配模板之后重新 Generate 即可:名字不变、引用不断,关卡里已经摆好的渲染器实例会跟着更新;已经生成出去的单位则在下一次生成时用上新产物。

Changed a model, an animation set or the assembly template? Just Generate again: names stay, references hold, renderer instances already placed in the level pick up the change, and units spawned afterwards use the new assets.

边界 Boundaries

①一个装配单位的所有版本必须共享同一具骨架与同一套动画。这是它们能共用一份骨骼数据的前提。烘焙时若某个版本的骨架或动画集对不上,会直接报错中止,而不是产出一份播放时会错位的资产。

① Every version of one assembled unit must share the same skeleton and the same animation set. That is what lets them share one bone dataset. If a version's skeleton or clip set does not line up, the bake stops with an error instead of producing an asset that would play back wrong.

②父子只有两层。Body 可以有任意多个附件、挂在任意多个 socket 上;附件不能再挂附件。面板会拒绝更深的连接。

② Two levels of parenting only. A Body may own any number of attachments on any number of sockets; an attachment cannot own attachments. The panel refuses deeper links.

③ 图集渲染不缩放你的帧。每帧必须放得进格子;放不下会直接报错,不会悄悄拉伸。图集与帧区间都由你确定:可以直接给美术做好的图集并填列数行数,也可以把序列帧放进 Sprite Prep 按动画组登记、由烘焙合成图集——两种来源都不做缩放。

③ Atlas rendering never rescales your frames. Every frame must fit its cell; one that does not is an error, never a silent stretch. The atlas and the frame ranges are both yours to define: hand in an artist-made atlas plus its column and row counts, or register sequence frames by animation bucket in Sprite Prep and let the bake compose the atlas — neither route rescales anything.

④ 部件数与版本数决定系统的规模,打组能把它压下来。默认一个部件就是一条分支、一个版本就是一个 renderer;同穿同脱的部件打成一组合并几何后,整组只占一个 emitter。搭配的每一种可能仍要有一个版本存在——先砍不常用的版本,再把「总是一起换」的部件打成组。

④ Part and version counts set the system's size — and groups bring it down. By default one part is one branch and one version is one renderer; parts that always change together can be grouped, merging their geometry so the whole group occupies a single emitter. Every outfit variation still needs a version behind it — drop versions you rarely use first, then group the parts that always change together.