Inception & WebGL build
Decided to use the Extra Credits Game Jam 2019 to learn Unity DOTS and Unity.Physics (their new physics library). The Jam's theme "Connect" immediately suggested something Katamari Damarcy, World of Goo or similar to me but actual design is not set in stone yet.
I have all day Saturday and Sunday plus a few hours Friday morning and night to work on my entry so I'll allow a day or so for mostly learning and deciding what I might be able to make then a day on finishing that. If I come out the end with an incomplete non-game but better appreciation of DOTS and Unity.Physics, I'll be more than satisfied.
I'd downloaded the latest Unity 2019.1.4 and the ECS Samples project so spent my couple of hours Friday skimming the samples, browsing the source, reading the documentation and found a CharacterController sample that's a neat base. I figure I'll need it to run in the desktop and browser so tried builds. Desktop worked fine. WebGL build is really slow and, once done, failed to start with a memory error. Turns out the sample project set webGL.memorySize to 256m but Unity now uses WebAssembly and it has a different memory parameter that's not exposed in the Editor?!
WRONG: Editing the ProjectSettings.asset turned out not to be too hard:
<del> webGLEmscriptenArgs: -s WASM_MEM_MAX=512MB</del>
UPDATE: OK so I've edited above to show which part was wrong. Turns out one must create an Editor script with the memory parameter in. Thanks to that link, here's what I used successfully...ish (see below):
#if UNITY_EDITOR namespace UGS { [UnityEditor.InitializeOnLoad] public static class WasmMemConfig { static WasmMemConfig() { var maxHeapSize = 256*1024*1024; UnityEditor.PlayerSettings.WebGL.emscriptenArgs = string.Format("-s WASM_MEM_MAX={0} -s ALLOW_MEMORY_GROWTH=1", maxHeapSize); } } } #endif
Once done, however, it seems Unity.Physics doesn't actually work properly in WebGL build (at least with Firefox). I don't think I have time to investigate this but I've recorded videos and ought to log this as a bug after the jam. Here's it working in Editor and failing in Firefox:
EDIT 2: Rebuilt as a "development build" and check out the browser console only to find a rather obvious error spamming every frame:
NotImplementedException: The method or operation is not implemented. at Unity.Physics.JacobianHeader.Solve (Unity.Physics.MotionVelocity& velocityA, Unity.Physics.MotionVelocity& velocityB, Unity.Physics.Solver+StepInput stepInput, Unity.Collections.BlockStream+Writer& collisionEventsWriter, Unity.Collections.BlockStream+Writer& triggerEventsWriter) [0x00000] in <00000000000000000000000000000000>:0 (Filename: currently not available on il2cpp Line: -1) a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:3156:11 _JS_Log_Dump blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:3156 __Z19WebGLPrintfConsolev7LogTypePKcPi blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4258922 __ZL20InternalErrorConsolePKcz blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4124543 __Z40DebugStringToFilePostprocessedStacktraceRK21DebugStringToFileData blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1069669 __Z17DebugStringToFileRK21DebugStringToFileData blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1818814 __ZN9Scripting23LogExceptionFromManagedE21ScriptingExceptionPtriPKcb blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1874000 __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2415143 dynCall_iiii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4728342 invoke_iiii blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:16297 __ZL10ExecuteJobP14ManagedJobDataPFvPvS1_S1_S1_iEi blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:871838 __ZL26ForwardJobForEachToManagedP14ManagedJobDataj blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4165688 __ZN18JobBatchDispatcher26ScheduleJobForEachInternalER8JobFencePFvPvjES2_iPFvS2_ERKS0_ blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4200233 __Z29ScheduleManagedJobParallelForRK21JobScheduleParametersii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2265205 __Z47JobsUtility_CUSTOM_ScheduleParallelFor_InjectedR21JobScheduleParametersiiR8JobFence blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4110274 _JobsUtility_ScheduleParallelFor_Injected_mF58FBA1C2413E2A71702DD1E9312B0307A427A71 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4262532 _JobsUtility_ScheduleParallelFor_mD0B7FD9589FB242D9C4E21F93054C526FA6B1DBF blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:3981158 _IJobParallelForExtensions_Schedule_TisSolverJob_t76F3B11DEEB43DA0E7ECDB328A3DD1275CC5BCEC_mEB662B9B0220CBFEA127EBF1D0D43F1FC12A2424_gshared blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:3067304 __Z131IJobParallelForExtensions_Schedule_TisSolverJob_t76F3B11DEEB43DA0E7ECDB328A3DD1275CC5BCEC_mEB662B9B0220CBFEA127EBF1D0D43F1FC12A242451SolverJob_t76F3B11DEEB43DA0E7ECDB328A3DD1275CC5BCECii51JobHandle_tDA498A2E49AEDE014468F416A8A98A6B258D73D1PK10MethodInfo blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:3326083 _Solver_ScheduleSolveJacobiansJobs_m0D12FEADCEFEB8190731369951E04678AF4DF91C blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:860049 _Simulation_ScheduleStepJobs_mF19FD7B4D42823DF8F1950DFF08C90F865DB4EE9 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:515925 __ZN23InterfaceActionInvoker4I61SimulationStepInput_t1EB732E132B3FE934EB3D4E227208335DC1BC97E51JobHandle_tDA498A2E49AEDE014468F416A8A98A6B258D73D1PS1_S2_E6InvokeEjP11Il2CppClassP12Il2CppObjectS0_S1_S2_S2_ blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2870050 _StepPhysicsWorld_OnUpdate_mDDD9F79557170D95BE9297F559349DF489E21F9F blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:962865 __ZN16VirtFuncInvoker1I51JobHandle_tDA498A2E49AEDE014468F416A8A98A6B258D73D1S0_E6InvokeEjP12Il2CppObjectS0_ blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:3776065 dynCall_viiii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4687111 invoke_viiii blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:17567 _JobComponentSystem_InternalUpdate_m86BEFD7ACF8C3B6D62ECEAB854F1F8B19791BC71 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1805319 __ZN18VirtActionInvoker06InvokeEjP12Il2CppObject blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4560482 _ComponentSystemBase_Update_m006B42B5406DCB2EC12E23F9C242D842CFA0BB5B blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4684786 dynCall_vii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4831989 invoke_vii blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:17247 _ComponentSystemGroup_OnUpdate_m26B237E703EF64AAAA6D539D14A80DA7B8BF2254 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1763841 __ZN18VirtActionInvoker06InvokeEjP12Il2CppObject blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4560482 dynCall_vii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4831989 invoke_vii blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:17247 _ComponentSystem_InternalUpdate_mB54CF99988286D23BAADD821C47494AA69C1E850 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2729270 __ZN18VirtActionInvoker06InvokeEjP12Il2CppObject blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4560482 _ComponentSystemBase_Update_m006B42B5406DCB2EC12E23F9C242D842CFA0BB5B blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4684786 _DummyDelegateWrapper_TriggerUpdate_mCD23D9DDE01C50C4AE3F1E73F1EFC7CB3F0E9C63 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4417426 _UpdateFunction_Invoke_m947E91D565C20FCCD7681BBD18998152C70EF0A6 blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2385748 __Z65RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017PFvvEPK10MethodInfoPvPS4_ blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4601930 dynCall_iiiii blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4672923 invoke_iiiii blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:16387 __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:3220513 _il2cpp_runtime_invoke blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4508847 __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4027864 __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2415120 __Z17ExecutePlayerLoopP22NativePlayerLoopSystem blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2428800 __Z17ExecutePlayerLoopP22NativePlayerLoopSystem blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:2428779 __Z10PlayerLoopv blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1973077 __ZL8MainLoopv blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:1883122 dynCall_v blob:null/8c4a7066-faa5-4d74-a8f3-c902c880f8c5:4851599 browserIterationFunc blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:8906 runIter blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:9008 Browser_mainLoop_runner blob:null/a99238ae-a0c7-4c1f-94d5-d2b4322ec7ec:8944
I'd hazard that some level of stripping has removed some rather vital functionality. With time we could figure out how to force retention of the Unity.Physics code and hopefully it'd fix the problem. Maybe when I have more time :)
For now, I've already burnt 4 hours on this. Guess my entry will be download-only!
Onwards, to the Learning!
Connect the Unity (ECS) DOTS (for ExtraCredits Jam 2019)
An Extra Credits Jam 2019 entry focusing on learning Unity DOTS
Status | Prototype |
Author | Arakade |
Tags | 3D, connecttheunitydots, extragamejam, Unity |
More posts
- Final physics OnCollision flowJun 12, 2019
- ECS & Unity.Physics order diagramJun 08, 2019
- ECS Unity.Physics: Contacts, The Right Way (full OnCollisionEnter(Collision) ana...Jun 06, 2019
- Post-jam next stepsJun 05, 2019
- Post Jam: An empty EntityQuery in OnCreate() disables your systemJun 04, 2019
- Monday night: Joint add or setJun 04, 2019
- Sunday afternoonJun 04, 2019
- Saturday night: Implementing DOTS Unity.Physics OnCollisionEnter() only for cert...Jun 02, 2019
- Saturday afternoon Unity.Physics and DOTS samples strife (after late start)Jun 01, 2019
- Friday nightJun 01, 2019
Leave a comment
Log in with itch.io to leave a comment.