Skip to content

Commit 932adde

Browse files
authored
feat: unreal streaming example 'Floppybots' (#10)
1 parent 510b609 commit 932adde

File tree

285 files changed

+8233
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+8233
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
AccessModifierOffset: -2
2+
AlignAfterOpenBracket: BlockIndent
3+
AlignConsecutiveAssignments: false
4+
AlignConsecutiveDeclarations: true
5+
AlignEscapedNewlines: Left
6+
AlignOperands: DontAlign
7+
AlignTrailingComments: false
8+
AllowAllArgumentsOnNextLine: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: None
13+
AllowShortIfStatementsOnASingleLine: WithoutElse
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterDefinitionReturnType: None
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: true
18+
AlwaysBreakTemplateDeclarations: Yes
19+
BinPackArguments: false
20+
BinPackParameters: false
21+
BraceWrapping:
22+
AfterClass: false
23+
AfterControlStatement: false
24+
AfterEnum: false
25+
AfterFunction: false
26+
AfterNamespace: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
AfterExternBlock: false
30+
BeforeCatch: false
31+
BeforeElse: false
32+
IndentBraces: false
33+
SplitEmptyFunction: false
34+
SplitEmptyRecord: false
35+
SplitEmptyNamespace: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakBeforeBinaryOperators: None
38+
BreakBeforeBraces: Custom
39+
BreakBeforeInheritanceComma: false
40+
BreakBeforeTernaryOperators: true
41+
BreakConstructorInitializers: BeforeComma
42+
BreakConstructorInitializersBeforeComma: false
43+
BreakStringLiterals: true
44+
ColumnLimit: 80
45+
CompactNamespaces: false
46+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
47+
ConstructorInitializerIndentWidth: 2
48+
ContinuationIndentWidth: 2
49+
Cpp11BracedListStyle: true
50+
DerivePointerAlignment: false
51+
DisableFormat: false
52+
ExperimentalAutoDetectBinPacking: false
53+
FixNamespaceComments: true
54+
IncludeBlocks: Preserve
55+
IncludeIsMainRegex: "(Test)?$"
56+
IndentCaseLabels: true
57+
IndentPPDirectives: AfterHash
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
InsertBraces: true
61+
JavaScriptQuotes: Leave
62+
JavaScriptWrapImports: true
63+
KeepEmptyLinesAtTheStartOfBlocks: false
64+
MacroBlockBegin: ""
65+
MacroBlockEnd: ""
66+
MaxEmptyLinesToKeep: 1
67+
NamespaceIndentation: None
68+
PackConstructorInitializers: NextLine
69+
PenaltyBreakAssignment: 10
70+
PenaltyBreakBeforeFirstCallParameter: 30
71+
PenaltyBreakComment: 10
72+
PenaltyBreakFirstLessLess: 0
73+
PenaltyBreakString: 10
74+
PenaltyExcessCharacter: 400
75+
PenaltyReturnTypeOnItsOwnLine: 350
76+
PointerAlignment: Left
77+
ReflowComments: true
78+
RequiresClausePosition: OwnLine
79+
SortIncludes: false
80+
SortUsingDeclarations: true
81+
SpaceAfterCStyleCast: false
82+
SpaceAfterLogicalNot: false
83+
SpaceAfterTemplateKeyword: false
84+
SpaceBeforeAssignmentOperators: true
85+
SpaceBeforeCtorInitializerColon: true
86+
SpaceBeforeInheritanceColon: true
87+
SpaceBeforeParens: Never
88+
SpaceBeforeRangeBasedForLoopColon: true
89+
SpaceInEmptyParentheses: false
90+
SpacesBeforeTrailingComments: 1
91+
SpacesInAngles: Never
92+
SpacesInContainerLiterals: false
93+
SpacesInCStyleCastParentheses: false
94+
SpacesInParentheses: false
95+
SpacesInSquareBrackets: false
96+
SeparateDefinitionBlocks: Always
97+
Standard: Latest
98+
TabWidth: 2
99+
UseTab: ForContinuationAndIndentation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_size = 4
7+
indent_style = tab
8+

unreal-cpp-floppybots/.gitignore

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Visual Studio 2015 user specific files
2+
.vs/
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
22+
# Compiled Static libraries
23+
*.lai
24+
*.la
25+
*.a
26+
*.lib
27+
28+
# Executables
29+
*.exe
30+
*.out
31+
*.app
32+
*.ipa
33+
34+
# These project files can be generated by the engine
35+
*.xcodeproj
36+
*.xcworkspace
37+
*.sln
38+
*.suo
39+
*.opensdf
40+
*.sdf
41+
*.VC.db
42+
*.VC.opendb
43+
44+
# Precompiled Assets
45+
SourceArt/**/*.png
46+
SourceArt/**/*.tga
47+
48+
# Binary Files
49+
Binaries/*
50+
Plugins/**/Binaries/*
51+
52+
# Builds
53+
Build/*
54+
55+
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
56+
!Build/*/
57+
Build/*/**
58+
!Build/*/PakBlacklist*.txt
59+
60+
# Don't ignore icon files in Build
61+
!Build/**/*.ico
62+
63+
# Built data for maps
64+
*_BuiltData.uasset
65+
66+
# Configuration files generated by the Editor
67+
Saved/*
68+
69+
# Compiled source files for the engine to use
70+
Intermediate/*
71+
Plugins/**/Intermediate/*
72+
73+
# Cache files for the editor to use
74+
DerivedDataCache/*
75+
76+
# Clangd
77+
.cache
78+
compile_commands.json

unreal-cpp-floppybots/.vsconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.Net.Component.4.6.2.TargetingPack",
5+
"Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64",
6+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
7+
"Microsoft.VisualStudio.Component.Windows10SDK.22621",
8+
"Microsoft.VisualStudio.Workload.CoreEditor",
9+
"Microsoft.VisualStudio.Workload.ManagedDesktop",
10+
"Microsoft.VisualStudio.Workload.NativeDesktop",
11+
"Microsoft.VisualStudio.Workload.NativeGame"
12+
]
13+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env pwsh
2+
3+
# This is an example batch file for building your Ecsact system implementations
4+
# with Emscripten. In a more sophisticated setup you will likely use a build
5+
# system such as bazel, cmake, zig, etc.
6+
7+
param (
8+
[Parameter(Mandatory)] $ProjectDir
9+
)
10+
11+
if (${env:UE-ZenSubprocessDataPath}) {
12+
Write-Host "Detected live coding enabled"
13+
Write-Host "Skipping system impl re-build"
14+
exit 0
15+
}
16+
17+
$ErrorActionPreference = 'Stop'
18+
19+
if (-not $env:EMSDK) {
20+
if (Test-Path -Path "C:\emsdk\emsdk_env.ps1" -PathType Leaf) {
21+
(. C:\emsdk\emsdk_env.ps1) 2> $null
22+
}
23+
24+
if (-not $env:EMSDK) {
25+
throw "Unable to find the Emscripten SDK installed on your system"
26+
}
27+
}
28+
29+
$EcsactFiles = @(
30+
"$ProjectDir/Source/Floppybots/Floppybots.ecsact"
31+
)
32+
33+
$Sources = @(
34+
"$ProjectDir/SystemImpls/EcsactSystemImpls.cpp"
35+
)
36+
37+
$GeneratedOutDir = "$ProjectDir/SystemImpls/generated"
38+
39+
# TODO: don't hard set generated sources
40+
$GeneratedSources = @(
41+
"$ProjectDir/SystemImpls/generated/Floppybots.ecsact.systems.cc"
42+
)
43+
44+
$EcsactInc = (ecsact config include_dir)
45+
46+
ecsact codegen $EcsactFiles `
47+
--plugin=cpp_header `
48+
--plugin=systems_header `
49+
--plugin=cpp_systems_header `
50+
--plugin=cpp_systems_source `
51+
--outdir=$GeneratedOutDir
52+
53+
emcc -v
54+
55+
mkdir -Force "$ProjectDir/Binaries" | Out-Null
56+
57+
$WasmOutputFilePath = "$ProjectDir/Binaries/SystemImpls.wasm"
58+
59+
Write-Host "Building $WasmOutputFilePath ..."
60+
61+
# NOTE: PURE_WASI=1 removes emscripten_* functions that are not compatible with the Ecsact SI Wasm host
62+
emcc -std=c++20 --no-entry -I"$EcsactInc" -I"SystemImpls/generated" `
63+
-s ERROR_ON_UNDEFINED_SYMBOLS=0 `
64+
-s WASM=1 `
65+
-s STANDALONE_WASM=1 `
66+
-s PURE_WASI=1 `
67+
-O3 `
68+
-Wno-js-compiler `
69+
-o $WasmOutputFilePath `
70+
$Sources `
71+
$GeneratedSources
72+
73+
if (-not $?) {
74+
throw "emcc exited with code ${LastExitCode}"
75+
}
76+
77+
78+
Write-Host "Uploading $WasmOutputFilePath to Ecsact Net ..."
79+
80+
# NOTE: pwsh doesn't have built in ini parsing, but this seems to work okay-ish for this config
81+
$EcsactNetConfig = Get-Content "$ProjectDir/Config/DefaultEcsactNet.ini" | Where-Object { !$_.StartsWith('[') } | ConvertFrom-StringData
82+
83+
# TODO: We shouldn't have to set the project ID everytime. Instead ecsact-net subcommands should accept the project ID as an option
84+
# ecsact-net config set project_id $EcsactNetConfig.ProjectID;
85+
# ecsact-net system_impls replace $WasmOutputFilePath;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[/Script/Ecsact.EcsactSettings]
2+
bEnableBuild=False
3+
CustomEcsactRuntimeLibraryPath=Binaries/Win64/EcsactRuntime.dll
4+
BuildReportFilter=None
5+
+Recipes=rt_entt
6+
+Recipes=async_reference
7+
+Recipes=serialize_reference
8+
+Recipes=si_wasmer
9+
Runner=Custom
10+
CustomRunnerClass=None
11+
bAutoCollectBlueprintRunnerSubsystems=True
12+
+RunnerSubsystems=/Game/EntityMass/BP_EcsactEntityMassSpawner.BP_EcsactEntityMassSpawner_C
13+
+RunnerSubsystems=/Game/Blueprints/BP_EcsactPlayerSpawner.BP_EcsactPlayerSpawner_C
14+
+RunnerSubsystems=/Game/Blueprints/LevelLoadEcsactSubsystem.LevelLoadEcsactSubsystem_C
15+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
[/Script/EcsactNetEditor.EcsactNetSettings]
4+
EndpointPrefix="http://localhost:51051"
5+
ProjectID=67047b0f95a3782070685d12
6+
NodeId=67047d57f3dd594aab300d73
7+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[/Script/EcsactNetWasm.EcsactNetWasmSettings]
2+
+SystemImplWasmFiles=(FilePath="Binaries/SystemImpls.wasm")
3+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[UnrealEd.SimpleMap]
2+
SimpleMapName=/Game/FirstPerson/Maps/FirstPersonExampleMap
3+
4+
[EditoronlyBP]
5+
bAllowClassAndBlueprintPinMatching=true
6+
bReplaceBlueprintWithClass= true
7+
bDontLoadBlueprintOutsideEditor= true
8+
bBlueprintIsNotBlueprintType= true
9+
10+
[/Script/AdvancedPreviewScene.SharedProfiles]
11+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ContentBrowser]
2+
ContentBrowserTab1.SelectedPaths=/Game/FirstPerson

0 commit comments

Comments
 (0)