Skip to content
wardd64 edited this page Oct 11, 2018 · 5 revisions

Unity Faction

Special thanks to Rafalh, for help with reverse engineering Redfaction files, such as RFL, VPP, V3D and VBM. See his original work on OpenFaction.

Currently finished

  • Reading and unpacking VPP files
  • Reading RFL files (Redfaction levels)
  • Reading V3D files (Redfaction 3D models)
  • Reading VBM files (Redfaction animated textures)
  • Reading tbl files (Redfaction Data tables)
  • Creating UID lookup functionality
  • Building static geometry
  • Building liquids
  • Generating materials, including animated and scrolling materials
  • Building lights
  • Calculating room bounds
  • Building skyboxes
  • Detecting level hardness
  • Building movers and moving geometry
  • Building clutter
  • Building items
  • Building triggers
  • Building push and climbing regions
  • Building events
  • Building particle and bolt emitters
  • Building ambient sounds
  • Building decals
  • Basic player controls, including interactions with all items above
  • Included custom shaders for special Redfaction material effects
  • Provided replacement textures and models for missing assets
  • Advanced scene building utilities
  • Automatic wav file repairer (re-export to Unity readable format)
  • Fine tuned player movements
  • Most commonly used event functionality

In progress

  • Geomodding
  • Improving triangulation algorithm
  • Building entities
  • Including vehicle functionality
  • Multiplayer support
  • Advanced decal placing

Guide

Say that you have a Unity project, and you wish to make a scene that contains your Red Faction map...

  1. Download Unity Faction and merge the assets folder with the folder of your project.
  2. Now that Unity Faction is installed, you should see a new menu option "UnityFaction" at the top of the Unity editor.
  3. Open this menu and select "Import RF Source", now navigate to your Red Faction folder, the one that contains the .exe and some vpp files. After selecting it, Unity Faction will import all default Red Faction assets into Unity, so that they can be used appropriately.
  4. Do UnityFaction > Unpack VPP to unpack the level file you wish to import. This will export all the contents of the file so we can use them in UnityFaction. Put the contents in a folder where you can find them.
  5. Now, do UnityFaction > Build Level, navigate to the RFL file that was unpacked in the previous step.
  6. This should have opened an editor window in Unity. In this screen, you can view general data about the contents that was read from the file. Assuming that your scene is empty, you will see a button that says "Make root". If the root is already in the scene, skip one step.
  7. Make a root object for your Redfaction level. Note that this will only work if there is no other root object active in the scene. At the time of writing there is no support for having multiple Redfaction levels in one scene.
  8. Once the root is available, you will see options for building the level into the scene. The build options tab shows you parameters that are used when building, as well as separate build buttons that can be used to build the level step by step. The big, "Build all" button will perform all of these at once, using the same options.
  9. After building take a look at the console and see if any warnings or error messages popped up. There are a few known exceptions that UnityFaction cannot handle by itself, these problems will be reported in the console.
  10. Modify the scene in Unity in whatever way you please.

Additional info

In order to facilitate building large projects with loads of different UnityFaction scenes, a few helper functions are available. Here is a quick overview:

UF Function Effects
Build Level (RFL) Main RFL build function. Reads an RFL file and opens LevelBuilder window to guide you trough building the level into your Unity Scene. For more details see the guide above.
Export Selected Mesh Takes whatever you have selected and exports it to a 3D model file.
Rebuild UF Scenes Select a folder that contains the scenes you made with UnityFaction. Each scene should contain an active UFLevel with at least a PlayerInfo object built into it. The function will go over all these scenes, rebuild each level and automatically calculate lighting. This may take a while, but prevents you from having to rebuild all the levels manually after an update, or to wait and calculate lighting in one level after the other.
Convert V3D Reads a V3D file and exports it to a unity readable prefab. V3D files containg 3D models, such as weapons, clutter, characters and items. V3D files include "V3D", "V3M" and "V3C".
Convert VBM Reads a VBM file and exports it to a unity readable material. VBM files contain animated textures. These are implemented In UnityFaction with a special shader that scrolls over each frame. For this reason, the material requires a texture with all the VBM frames side by side.
Unpack VPP Reads the contents of a VPP file and exports everything into the selected folder. The files are automatically processed where necessary.
AutoUnpack Unpacks all VPP files in a given directory and automatically puts them in folders with the same names.
Import RF Source Used to import dependencies from the origin Red Faction files. Point towards your redfaction directory and this function will automatically extract all necessary files from the VPP's there.
Repair wav Imports and re-exports a wav file using an encoding that Unity can read. Red Faction wav files are encoded using "ADPCM", which can be read and exported effectively using the NAudio plugin.

Clone this wiki locally