FPS Engine
Last updated
Was this helpful?
Last updated
Was this helpful?
Important: Emerald AI 2024 v1.1.2 or higher is required for FPS Engine support.
(FPS Engine 1.1 or Lower Only) To add support for FPS Engine, users will need to import the FPS Engine Integration package. This can be found under Emerald AI>Integrations>FPS Engine.
Important: If you are using FPS Engine version 1.2 or higher, you will need to use the UnityPackage file below. If you do not use the proper version, you will have errors.
After you have imported, you will have a scene to test with an example FPS Engine player. This is located under Integrations>FPS Engine>Demo Scenes>FPS Engine Integration. This scene will have an Emerald AI demo AI that will attempt to fight an example FPS Engine player. You will be able to target, damage, and kill the demo AI. It will also be able to damage and attack the FPS Engine player. There will be a pistol weapon the player can use to fight the demo AI.
Included with the integration packages are two scripts. These scripts are bridge scripts that allow Emerald AI and FPS Engine to send damage to each other.
The FPSEngineAIBridge script should go on your AI, if you want it to receive damage from an FPS Engine player. It will automatically take the health values from your AI's Emerald Health Component. You can do this by searching for the FPSEngineAIBridge script and dragging it onto your AI.
Important: If you do not have a FPSEngineAIBridge script on your Emerald AI agent, it will not be able to receive damage from the FPS Engine Player.
It is important that you properly setup your AI's Tag and Layer. For this tutorial, and the example FPS Engine integration scene, the Enemy Tag and Enemy Layer was used. These are the tags and layers included with FPS Engine. However, you are free to use the ones for your project, just make sure that you have set these up through your AI's Detection Component.
Since the AI are using the Enemy layer, the Enemy layer needs to be added to every AI's Detection Component to allow them to be properly detected.
Important: Not properly setting up your AI's Tags and Layers, as well as setting their layer to the AI's Detection Layer, can cause AI to not be properly detected. Also, ensure you set your Player Unity Tag to Player, which is the default tag that FPS Engine Players come with.
The FPSEnginePlayerBridge script should go on your Player (within the FPS Controller), if you want it to receive damage from an Emerald AI agent. It will automatically take the health values from your FPS Engine player. You can do this by searching for the FPSEnginePlayerBridge script and dragging it onto the FPS Controller>Player>Player object.
Important: Not assigning the FPSEnginePlayerBridge script or not assigning it to the proper object will cause issues with the FPS Engine player receiving damage. Ensure this is done correctly. This should be the Player object with all of the FPS Engine scripts on it.
Until FPS Engine adds the Player layer to its included layers, it is recommended that you add the Player layer to your project's layers. Next, assign the Player layer to your FPS Engine's Player object.
Next, add the Player layer to every AI's Detection Layers within the Detection Component.
Important: Not properly assigning the Player layer to each AI's Detection Layers can cause detection issues. Ensure you do this step and ensure that the Player does not use the Default layer (which is done by FPS Engine on the included demo player).
This concludes the tutorial. Test your FPS Engine Player and AI to ensure everything works correctly. If something doesn't work, go through the tutorial to ensure no steps were missed. You can also test the included FPS Engine example scene to see how everything was set up. Feel free to reach out on if you need assistance.