Export ComponentTips, basic knowledge
How to create and export a component from MaxFile requirementsBot components are loaded dynamically into the game. So you need only place the required files into the components folder, and the game will automatically load it.
The general structure for files is:
Components\mycomponent.txt Components\myfolder\mycomponent.gmf Components\myfolder\maps\...bmp...tga -> associated textures for this component The text file is the key required file that causes the game to try to load a component. It contains path information to find the gmf as well as other important data. See the Component File Format page for details on this data.
Max RequirementsRigid BodiesMust have a rigid body collection with the necessary rigid bodies for your component. Some components have only one rigid body. Others have one rigid body with several primitives. Others have two rigid bodies constrained together.
The master rigid body must be positioned and oriented with NO transform. This means at the origin with no rotations.
Attachment pointsThere must be at least one point helper object with user data in it defining an attachment point. See the Component Attaching page for details on this format. You can have more than one attachment point if your component can be attached in multiple orientations or can have other objects attach to it.
The orientation of this helper point is critical. The positive local Y axis must point away from the object. Think of it as a plug that will fit into the receiving socket of whatever the object is attaching to.
Additionally, if the component can be attached to the baseplate of the chassis, the attach point must be outside of the collision body so that, when attached, there is no intersection with the chassis.
StylesYou can export multiple styles of a single component (variable lengths, sizes, orientations, etc). The most fundamental way to do this is to export separate gmf's, one for each style. Then define the styles in the text file. There is also a Max script plugin with a new helper object that can facilitate this. The plugin is also helpful for storing component data in Max so you don't need to create the text file by hand, unless there are unique items required in it.
RA2 Component Helper PluginThis is a scripted plugin that extends the Dummy helper. It stores data about this component (name, description, filenames, other data) and automatically exports both the text file(s) and gmf(s) for one or more styles.
To use it, create an instance of this dummy in the scene anywhere, and modify the properties shown in the rollout panels. It is best to set up a default export directory (C:\RA2Components for example) and then always export your components here. Many of the rollout controls correspond to the data needed in the text file.
You will need a selection set defining your exported objects (do not include the helper dummy in this selection set). The first rollout in the helper panel is the export rollout which has a dropdown to choose your export selection set and a button to do the exporting. Click it and your text file, gmf, and maps will all be placed in your export directory. You then just copy these things to the RA2 components folder.
AI bot components won't really need styles since the player won't use these components. But some AI components might be worth using as player components, too. If you want to create styles, the helper object can have style names added to a list. It then will export corresponding frames for each style: frame 0 is the first style, frame 1 is the second style, etc. So you can animate vertices of an object to create several sizes of it. The helper can't export different meshes for each style, so if your objects change per style, you'll need to set up the text file by hand.
Note that the whole process is rather fragile and it is rare that you export
a component perfectly the first time. Always test your component after exporting.
|