|
1 | 1 | <article> |
2 | | - <h1>Ecsact Runtime access</h1> |
3 | 2 | <section> |
4 | | - |
| 3 | + <h1>Ecsact Runtime in Unreal</h1> |
| 4 | + <p> |
| 5 | + Since Unreal uses C++ natively, the |
| 6 | + <a routerLink="/docs/runtime">Ecsact runtime API</a> can by used |
| 7 | + implicitly in an Unreal project. That being said the |
| 8 | + <a routerLink="/start/unreal">Ecsact Unreal plugin</a> |
| 9 | + builds on top of the Ecsact API to fit Unreals development patterns and |
| 10 | + styles. Additionally the Ecsact Unreal plugin sets up your C++ includes so |
| 11 | + that you can find the Ecsact Runtime headers that came with your |
| 12 | + <a routerLink="/start">Ecsact SDK installation</a>. |
| 13 | + </p> |
| 14 | + <h2 id="getting-started">Getting Started</h2> |
| 15 | + <p>All you have to do to get started using the Ecsact runtime API is:</p> |
| 16 | + <ul> |
| 17 | + <li><a routerLink="/start">Install the Ecsact SDK</a></li> |
| 18 | + <li> |
| 19 | + <a routerLink="/start/unreal">Install the Ecsact Unreal Plugin</a> |
| 20 | + </li> |
| 21 | + <li> |
| 22 | + Add the <code>Ecsact</code> module to your <code>*.Build.cs</code> as a |
| 23 | + dependency |
| 24 | + </li> |
| 25 | + </ul> |
| 26 | + |
| 27 | + <code-block-variation class="m-0 rounded-md mt-3"> |
| 28 | + <pre |
| 29 | + codeBlockVariationOption |
| 30 | + optionTitle="ExampleModule.Build.cs"><code prism language="csharp"> |
| 31 | + using UnrealBuildTool; |
| 32 | + public class ExampleModule : ModuleRules {{'{'}} |
| 33 | + public Example(ReadOnlyTargetRules Target) : base(Target) {{'{'}} |
| 34 | + // ... |
| 35 | + PublicDependencyModuleNames.AddRange(new string[] {{'{'}} |
| 36 | + // ... your other dependencies ... |
| 37 | + "Ecsact", |
| 38 | + {{'}'}}); |
| 39 | + {{'}'}} |
| 40 | + {{'}'}} |
| 41 | + </code></pre> |
| 42 | + </code-block-variation> |
| 43 | + </section> |
| 44 | + |
| 45 | + <section> |
| 46 | + <h2 id="building-the-runtime">Building The Runtime</h2> |
| 47 | + <p> |
| 48 | + The easiest way to build the Ecsact runtime in an Unreal project is to |
| 49 | + enable the Ecsact build system in the Ecsact plugin settings. From there |
| 50 | + you can specify what |
| 51 | + <a routerLink="/docs/extend/build-recipe">build recipes</a> you want. If |
| 52 | + you don't know what a build recipe is, that's okay! For simple |
| 53 | + functionality just select <code>rt_entt</code> and if you want Wasm |
| 54 | + support also add <code>si_wasmer</code>. |
| 55 | + </p> |
| 56 | + <div class="flex flex-col-reverse 2xl:flex-row items-center gap-8 py-2"> |
| 57 | + <div> |
| 58 | + <p> |
| 59 | + After you've done that the Ecsact Unreal plugin should watch for any |
| 60 | + changes to your <code>.ecsact</code> files in your |
| 61 | + <code>Source</code> directory and re-build the runtime for you. |
| 62 | + </p> |
| 63 | + |
| 64 | + <p> |
| 65 | + If you want to manually trigger a re-build you can go to |
| 66 | + <code |
| 67 | + >Tools <span class="i24">arrow_right</span> Ecsact |
| 68 | + <span class="i24">arrow_right</span> Re-build Runtime</code |
| 69 | + >. |
| 70 | + </p> |
| 71 | + <p> |
| 72 | + Make sure you watch out for errors with your |
| 73 | + <code>.ecsact</code> files in the Output Log! |
| 74 | + </p> |
| 75 | + </div> |
| 76 | + <a href="/assets/unreal/unreal-setup-03.png"> |
| 77 | + <img class="max-w-lg" src="/assets/unreal/unreal-setup-03.png" /> |
| 78 | + </a> |
| 79 | + </div> |
| 80 | + </section> |
| 81 | + |
| 82 | + <section> |
| 83 | + <h2 id="using-the-runtime">Using The Runtime</h2> |
| 84 | + <p> |
| 85 | + We recommend using the Unreal specific APIs when using any unreal |
| 86 | + functionality. |
| 87 | + </p> |
| 88 | + <ul> |
| 89 | + <li><a routerLink="/start/unreal/runner">Ecsact Runner</a> for Unreal</li> |
| 90 | + <li> |
| 91 | + <a routerLink="/start/unreal/subsystems">Ecsact Subsystems</a> for |
| 92 | + Unreal |
| 93 | + </li> |
| 94 | + </ul> |
| 95 | + <p> |
| 96 | + However sometimes you need to get into the nitty gritty. In that case you |
| 97 | + can include any of the Ecsact runtime headers in your Unnreal module that |
| 98 | + depends on the <code>Ecsact</code> Unreal plugin module. |
| 99 | + </p> |
| 100 | + <code-block-variation class="m-0 rounded-md mt-3"> |
| 101 | + <pre |
| 102 | + codeBlockVariationOption |
| 103 | + optionTitle="Unreal C++"><code prism language="csharp"> |
| 104 | + #include "ecsact/runtime/core.h" // this should just work! |
| 105 | + </code></pre> |
| 106 | + </code-block-variation> |
| 107 | + </section> |
| 108 | + |
| 109 | + <section> |
| 110 | + <h2 id="system-impls">System Implementations and Unreal</h2> |
| 111 | + <p> |
| 112 | + <a routerLink="/docs/system-impl">System implementations</a> are |
| 113 | + implemented as normal in an Unreal project. That's another way to say that |
| 114 | + there isn't any high level Unreal specific API in regards to compiling and |
| 115 | + building Ecsact system implementations. |
| 116 | + </p> |
| 117 | + <p> |
| 118 | + The current recommended way to build systems is with |
| 119 | + <a routerLink="/start/tutorials/cpp-to-wasm">Wasm</a> or the C function |
| 120 | + <code>ecsact_set_system_execution_impl</code> at runtime. |
| 121 | + </p> |
| 122 | + <p> |
| 123 | + We do plan to eventually allow you to create Ecsact systems with the |
| 124 | + Unreal Build tool as a dynamic Unreal module. Subscribe to the |
| 125 | + <a |
| 126 | + href="https://github.com/ecsact-dev/ecsact_unreal/issues/23" |
| 127 | + _target="_blank" |
| 128 | + ><span class="i24">open_in_new</span> Github tracking issue</a |
| 129 | + > |
| 130 | + for updates. |
| 131 | + </p> |
5 | 132 | </section> |
6 | 133 | </article> |
0 commit comments