Universal Fighting Engine: A Deep Dive into its Features
The Universal Fighting Engine (UFE) is a powerful toolset designed to streamline the development of 2D and 2.5D fighting games within the Unity engine. Born from a deep passion for martial arts cinema, UFE aims to provide developers with the necessary tools to recreate the excitement and strategic depth of classic fighting games. This article explores the core features of UFE, examining its capabilities and how they empower developers to create unique and engaging fighting game experiences.
A Passion Project Rooted in Martial Arts Cinema
The genesis of UFE lies in a lifelong fascination with martial arts films. The vision was to create a platform where diverse fighting styles, such as Jeet Kune Do, Drunken Boxing, Shaolin Hung Gar, and Wing Chun, could clash in a single game. This passion has driven the development of UFE, resulting in a tool that caters specifically to the needs of fighting game development.
Core Features and Functionality
UFE offers a wide array of features designed to simplify the creation of complex fighting game mechanics. Here's a detailed look at some of the engine's key components:
Universal Fighting Engine version updates
The Universal Fighting Engine is constantly being updated and improved. The developers are constantly making changes between versions as the project progresses. Here are some of the changes that have been made:
- Added new utils class: UFEInput.
- Animation Mapper improved.
- Refactored unique Id.
- Fixed Pause Menu incorrectly being loaded from the wrong reference.
- Added new Connection Screen before Network Options.
- Collision system refactored.
- Debug Mode: Start Game Immediately removed.
- Added option to switch between Mecanim's mirror functionality or scale flipping for when a character is on the right side under Character Editor.
- Added option to use FixedUpdate for input reading (instead of the classic Update) under Global Editor → Advanced Options.
- Removed UNet libraries from main scripts folder.
- Fixed issue with move's auto-rotation option.
- Added a new option to Projectiles: Limit Multicasting.
- Added new option to Inputs: Force Axis Precision.
- Ability to add your own custom Input Manager class. Usage example can be found under UFE\Engine\Scripts\Input\GUIControlsInterface.cs.
- New option under Global -> Advanced: Lock Z Axis.
- Changed how wallbounce distance works when bouncing off camera.
- Fixed UFE Input Setup.
Character Assists: Expanding Combat Possibilities
The Character Assists feature allows players to summon another character during a battle to execute a move. This adds a layer of strategic depth, as the summoned character can be hit alongside the caster, or even used in conjunction with the caster to create extended combos. The possibility of summoning multiple characters simultaneously for cinematic moves further enhances the visual spectacle.
Read also: Body, mind, and community through yoga
Multi-Gauge Support: Customizing Resource Management
UFE's multi-gauge support empowers developers to implement a variety of power gauges, allowing for intricate resource management systems. This flexibility enables the creation of unique character abilities and strategic decision-making based on gauge levels.
Expanded Root Motion Options: Enhancing Animation Control
The expanded root motion options within the Move Editor provide greater control over character movement and animation. This allows for more fluid and responsive character actions, contributing to a more polished and professional feel.
Projectile Control: Limiting Multicasting
The new option to limit multicasting for projectiles provides developers with precise control over projectile behavior, optimizing performance and preventing potential issues related to excessive projectile spawns.
Input Precision: Forcing Axis Precision
The ability to force axis precision for inputs allows for finer control over character actions, ensuring responsiveness and accuracy in player commands.
Custom Input Manager: Tailoring Input Systems
UFE allows developers to implement their own custom Input Manager class, providing ultimate flexibility in tailoring the input system to their specific game requirements. An example of usage can be found under UFE\Engine\Scripts\Input\GUIControlsInterface.cs.
Read also: Behind the scenes of TRANSFORMERS: The Ride – 3D
Z-Axis Locking: Creating a Traditional 2D Experience
The new option to lock the Z-axis under Global -> Advanced settings allows developers to constrain movement to a traditional 2D plane, ensuring a classic fighting game experience.
Collision System and Hitbox Management
One of the key elements that makes UFE easy to prototype is the guided transform hitbox system, meaning you only need to tell it where the joints are and UFE will take care of the rest. To solve this, Map Recorder runs and stores the position maps (and delta displacements) of all identified hitbox on every frame of animation throughout the character's moveset, saving them in Fix64 format (deterministic). Map Recorder is located at UFE\Engine\MapRecorder.unity.
UFE Netcode: Enabling Smooth Online Battles
UFE Netcode is the second iteration of the network system for UFE. It allows the game to run online matches in a smooth lag-free environment thanks to its native rollback mechanics and deterministic physics. The new Rollback netcode is available on UFE 2 PRO and UFE 2 Source. UFE Netcode lets you use a combination of both Frame Delay and Rollback to achieve the best possible result for your game, both in visual and gameplay.
Rollback Netcode: Minimizing Latency
Rollback is a technique in which a game is able to return to a previous frame, change the outcome of an event (say, an input), and return to the current frame, all in a span of a single frame of animation. This allows a game to catch up with whatever concurrent event instead of waiting for both clients to sync up. The subject can be extensive and have been topic of several games for years (often referred as GGPO). Although most of us would prefer our games running at 0 frame delay, depending on your configurations rollbacks can be heavy on the CPU, and a constant attempt to jump time can have notable frame skips. You can adjust the frame delay under the Frame Delay Options.
Conversion Between UFE 1 and 2
This tutorial is meant for conversion between UFE 1 and 2. UFE 2.0 was developed with backwards compatibility in mind. Several processes were created specifically to deal with converting large amounts of data at once. A prototype of your project with the new netcode can be created in less then an hour if you know what you are doing. One of the key changes made to the code is the use of Fixed Point (Fix64), a format that replaces all uses of float throughout the code. To run the auto update, right click on one of your UFE files (Global , Character or Move) from the project tab and select “UFE 2.0 → Update All Definitions”. Next up is the HitBoxes' radius, rectangles and offsets. Because these values are recorded under the prefab itself we need to do this from the Character Editor. This will assign the Fix64 variables with their floats relatives inside each of the hitboxes. Now, under the Moveset, toggle 'Use Animation Maps'. In order to have the client-server accessibility you need to download Photon Unity Networking and create your own Photon Account. You can also set a variety of connection options with the Photon Server Settings such as protocol used, hosting type and search by separated search regions. And that is it! If you haven't missed any of the steps your game should be ready to be tested online. Remember to backup your project before replacing files and pay close attention to any customization you have done to the code.
Read also: Universal Life vs. Whole Life: A Comparison
Animation and Deterministic Simulation
The Animation Recorder tracks the animations based on what is listed on the character asset. Don't forget to toggle 'Use Animation Maps' under the Character Editor after recording your animations. In a deterministic simulation, the code must result the same on both clients at the end of every single frame, so UFE needs to control whenever a game objects is instantiated or destroyed so it knows if an object should or shouldn't be there. destroyTimer - How long (in frames) will the object last for.
Object Spawning and Variable Tracking
Besides controlling object spawns we also need to keep track of certain custom variables in our code. Let's say you have a custom script called VaseScript.cs on a game object called Vase. Once that is in place you can spawn this game object using UFE.SpawnGameObject (such as the code example above) and place the trackers onto the variables of your choice. The rule of thumb for deciding which variable to track comes down to its use as a constant. Notice we only use the [RecordVar] attribute to track the variables that can change during gameplay. Weight doesn't need to be tracked because it's assumed that value is persistent. Also, notice we are using UFEFixedUpdate instead of FixedUpdate and UFEBehaviour instead of MonoBehaviour. One additional feature UFE offers is the native manual tracking. By default, all UFE variables that needs to be tracked are not tracked using RecordVar, but instead a set of structs designed to copy and store any changes to the core fields and properties. This method minimizes CPU usage by a large margin, and its recommended that you use this process for large amounts of data and dependency on low tier hardware (such as mobiles).
Important Considerations
Make sure you have no 'self-destruct' scripts attached to your particle effects. UFE needs to control the spawn and despawn of every GameObject.
Asset Store and Payhip Updates
Asset Store: Under Unity, click on Window → Package Manager. Find your UFE version and click “download”, then “import”. If you are seeing errors or file conflicts that means some files might have changed. Payhip: Use the same link that was provided when you first purchased the product to download this update. All versions: Under
Upgrading
For those who have made their own variables to the editor tools, another important tool in the conversion arsenal is the UFE Upgrader (\UFE\Editor\UFEUpgrade.cs) used on Step 1. This script gathers all legacy variables (floats/vectors) throughout subsequential assets and assign their values to their new respective related types. Codewise you can see that every old declaration has now a “relative” below its cast with the prefix “_”.
tags: #universal #fighting #engine #features

