# Integrating SF into your project

Let's talk about integrating SF into your own project. You might have already started a project, but like the way SF handles the various different systems included. This guide will take you through migrating, and enabling all that SF has to offer.

***

{% stepper %}
{% step %}
### Migrating SF into your project

With a fresh copy of Story Framework opened, right-click on the main Story Framework folder, and navigate over to the "Migrate" option. From here, select the directory of the "Content" folder inside your project.

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2F9UCn1N8XXz5bT0IelhrT%2FMigrate.png?alt=media&#x26;token=f53a7ee2-f02b-48b1-a579-d1b90489032d" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
### Modifying your player controller

Story Framework utilizes a player controller blueprint for its functionality. So if your project does not have one yet, you would need to create one. If you already have this class, open it up and add and attach the following components shown here, (This our found by simply searching for them in the Components hierarchy)

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2F2uk7fBpuGrvCNtN4I8Ds%2FComponentsController.png?alt=media&#x26;token=a92539b5-8a49-45fa-86b0-e824d32ba107" alt=""><figcaption></figcaption></figure></div>

Then, we need to implement the `SFPlayerControllerData_BPI` blueprint interface into our player controller by heading over to the "Class Settings" section towards the top of your blueprint, and adding said interface.

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FeIBLrGOpHMIbI1S2w4Uy%2FInterface.png?alt=media&#x26;token=28abaa56-322b-4097-827e-d01fe0506797" alt=""><figcaption></figcaption></figure></div>

With this interface now implemented, open up the `Get SF Components` interface function in the bottom left of your blueprint, and add those previously added actor components to their respective references.

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FwvuXfF3bo45jPQxIBzJd%2FInterfaceFunc.png?alt=media&#x26;token=b2b4e27c-1fae-4046-88b8-8e627b41f759" alt=""><figcaption></figcaption></figure></div>

Then, we can add SF's Player Camera Manager class from inside the "Class Defaults" section towards the top of your blueprint.

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FTtWKsJ2K4xU0swoBBtvN%2FPCMController.png?alt=media&#x26;token=c95c38a5-5547-43d0-9d85-26c91ddff908" alt=""><figcaption></figcaption></figure></div>

Finally, we need to copy over all of SF's input actions from our Story Framework project, into your player controller blueprint inside your own project (You would remove the `Generic Movement` graph if you have your own character movement solution already setup).

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2F0fGkFOpyaS8syEufgxrI%2FInputsController.png?alt=media&#x26;token=fa4cfaad-e3c9-46b6-944d-819caae772e2" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
### Modifying your player character

Now that we have setup our player controller, we now need to make some slight adjustments inside your player character blueprint.  Inside your player character blueprint, we need to replace your current camera component with the `SFDefaultCamera_CC` camera component (Should be attached to a spring arm component for smoother camera movement and extra control).

<figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FsCbU3jHtNGIGAmEqLTeO%2Fimage.png?alt=media&#x26;token=bd8a3474-c2b5-45ae-bc7e-0584d8b4d7c4" alt=""><figcaption></figcaption></figure>

This is a common approach to handling a camera system, the only difference is SF's camera component includes a few neat functions that get utilized for certain camera actions.
{% endstep %}

{% step %}
### On Begin Play logic

A few things must be defined on the`BeginPlay` event in any blueprint of your choice. For future reference, I would advise doing this in either the player controller, or player character blueprint.\
\
We need to add SF's input mapping to the player, which can be done by using the `Update Input Mapping Context` function. (If you already have an input mapping, you would either need to migrate over your current inputs to SF's `SFGameplay_IMC` input mapping context, or remove your own input mapping entirely).

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FocLHh6mc1aJYSEMlDYQr%2FInputMapping.png?alt=media&#x26;token=01a9f52e-9552-4d06-bce4-baf12fa44e26" alt=""><figcaption></figcaption></figure></div>

Then, we can add the `Auto-Save` function from the `SFSaveManager_AC` actor component here too (This is optional).

<div align="left"><figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FV2VGmKssuVNFowdhPvZa%2FAutoSaveFunc.png?alt=media&#x26;token=0252bc12-ee58-446e-a313-1a47a6a05a5a" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
### Game Instance

Finally, if you'd like to utilize SF's save system, you will need to add SF's game instance to your project from within the project settings.

<figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FmlgEDFnbyHEOSMYn4YfO%2FGameInstance.png?alt=media&#x26;token=126daf8d-aaf8-4f09-adbd-2528613e851b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
### Character Restrictions (If not using SF's movement)

SF restricts things like movement and camera rotation at specific times. These restrictions should also be set up on your players Movement and Look inputs if you'd like some of SF's systems to work as intended. This restrictions use the `SF Movement Condition` function for movement limitations.

<figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2FOjTjWg0rdtMtcrTteo8H%2FMovementRestrictions.png?alt=media&#x26;token=f1c328ff-edc2-4417-b6e1-b60801381849" alt=""><figcaption></figcaption></figure>

And finally, we can copy the `SF Camera Look Conditon` graph from SF, and connect it up off of your "Look" input.

<figure><img src="https://3388235609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYeqvDsstN2ZNva2Lkl7%2Fuploads%2F9glJTsX6yxvC6D8mpNmc%2FLookRestrictions.png?alt=media&#x26;token=95b9732b-b027-41cc-99c8-6d0e7622cc03" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
