-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlittle-cosmos.html
508 lines (508 loc) · 34.1 KB
/
little-cosmos.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0">
<title>Little Cosmos · Joe Binns</title>
<link rel="stylesheet" href="styles.css">
<link id="shortcuticon" rel="shortcut icon" href="../images/jb.svg">
</head>
<body>
<div class="model-preview">
<overlay>
</overlay>
<canvas class="webgl">
</canvas>
</div>
<div class="padding logo-wrapper">
<logo>
<a href="/" class="gradient-multiline-invert">
<h1>
<span>
Joe
<br>
Binns
</span>
</h1>
</a>
</logo>
</div>
<div class="interface">
<menu class="padding">
<optHide>
<div style="width: 100px;">
</div>
<itemAlt>
<div class="tr" style="height: 24px;">
<div class="td">
<a class="hyperimage" href="mailto:hello@joebinns.com" target="_blank"><img id="mail" src="images/mail_box_optimised.svg" alt="email" width="20" height="20"></a>
<a class="hyperimage" href="https://www.linkedin.com/in/joe-binns/" target="_blank"><img id="linkedin" src="images/linkedin_box_optimised.svg" alt="LinkedIn" width="20" height="20"></a>
</div>
</div>
<div class="tr" style="height: 24px;">
<div class="td">
<a class="hyperimage" href="https://github.com/joebinns" target="_blank"><img id="github" src="../images/github_box_optimised.svg" alt="GitHub" width="20" height="20"></a>
<a class="hyperimage" href="https://joebinns.itch.io/" target="_blank"><img id="itchdotio" src="../images/itchdotio_box_optimised.svg" alt="itch.io" width="20" height="20"></a>
<a class="hyperimage" href="https://www.youtube.com/@joebinns95/" target="_blank"><img id="youtube" src="../images/youtube_box_optimised.svg" alt="YouTube" width="20" height="20"></a>
</div>
</div>
</itemAlt>
<item>
<div class="tr" style="height: 24px; position:relative; top: 6px">
<div class="td">
<a class="hyperlink lowercase" href="./about">about</a>
</div>
</div>
<div class="tr" style="height: 24px; position:relative; top: 6px">
<div class="td">
<a class="hyperlink lowercase" href="../documents/cv/cv-joe-binns.pdf">curriculum vitae</a>
</div>
</div>
</item>
</optHide>
</menu>
<div class="top right" style="z-index: 20; padding: 30px;">
<a class="hyperimage" href="/" ><img id="back" src="../images/back.svg" alt="back" width="40" height="40"></a>
</div>
</div>
<div class="content">
<project>
<h1 class="section">
Little Cosmos
</h1>
<div class="table project-metadata">
<div class="tr">
<item class="td">
<h3>
Links
</h3>
<info>
<p>
<a class="hyperimage" href="" target="_blank" style="display: none;"><img id="websiteProj" src="../images/globe_box_optimised.svg" alt="website" width="20" height="20"></a>
<a class="hyperimage" href="" target="_blank" style="display: none;"><img id="githubProj" src="../images/github_box_optimised.svg" alt="GitHub" width="20" height="20"></a>
<a class="hyperimage" href="" target="_blank" style="display: none;"><img id="steamProj" src="../images/steam_box.svg" alt="Steam" width="20" height="20"></a>
<a class="hyperimage" href="" target="_blank" style="display: none;"><img id="switchProj" src="../images/switch_box.svg" alt="Nintendo Switch" width="20" height="20"></a>
<a class="hyperimage" href="https://abramshanna.itch.io/little-cosmos" target="_blank"><img id="itchdotioProj" src="../images/itchdotio_box_optimised.svg" alt="itch.io" width="20" height="20"></a>
<a class="hyperimage" href="https://youtu.be/fFb1iS1EkoQ?si=gvdOasdCJ-iFVPjj" target="_blank"><img id="youtubeProj" src="../images/youtube_box_optimised.svg" alt="YouTube" width="20" height="20"></a>
<a class="hyperimage" href="" target="_blank" style="display: none;"><img id="documentProj" src="../images/document_box.svg" alt="document" width="20" height="20"></a>
</p>
</info>
</item>
<item class="td">
<h3>
Dates
</h3>
<info>
<p>
May 2023 — June 2023
</p>
</info>
</item>
</div>
<div class="tr">
<item class="td">
<h3>
Team
</h3>
<info>
<p>
<a class="hyperlink" href="/">Myself</a>, Gameplay Programmer
<br>
<a class="hyperlink" href="http://joakimkarbing.net/">Joakim Karbing</a>, UI Programmer
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/abramshanna/">Hanna Eriksson</a>, Level Designer & Gameplay Designer
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/arvidrongedal/">Arvid Rongedal</a>, Level Designer & Audio
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/eliana-b-parada-235535239/">Eliana Parada</a>, UI Designer
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/arthur-wezeman-sotheygavemethiskindofpowernowdidtheyquestionmark/">Arthur Wezeman</a>, QA
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/blair-bergman-499302196/">Blair Bergman</a>, Product Owner & Technical Artist
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/hjalmar-berg-b0938324b/">Hjalmar Berg</a>, Environment Artist
<br>
<a class="hyperlink" href="https://www.linkedin.com/in/krist%C3%ADn-gu%C3%B0mundsd%C3%B3ttir-72b8091b5/">Kristín Guðmundsdóttir</a>, Character Artist
<br>
</p>
</info>
</item>
<item class="td">
<h3>
Languages
</h3>
<info>
<p>
Unreal Engine 5
<br>
C++
<br>
Python
<br>
Perforce
</p>
</info>
</item>
</div>
</div>
<div class="document">
<h3>
Trailer
</h3>
<div class="video-block">
<div class="video-wrapper">
<iframe frameborder="0" width="100%" height="100%" src="https://www.youtube.com/embed/fFb1iS1EkoQ?loop=1&playlist=fFb1iS1EkoQ" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen>
</iframe>
</div>
<iframe height="167" frameborder="0" src="https://itch.io/embed/2136039?dark=true" style="margin-bottom:10px; width: 100%;">
<a href="https://abramshanna.itch.io/little-cosmos">
Little Cosmos by Futuregames
</a>
</iframe>
</div>
<details>
<summary>
Arbitrary Gravity Character Controller
</summary>
<p>
Adding arbitrary gravity support to Unreal's character would require major overhauls to its movement component.
I therefore opted to design and create a bespoke character controller from the ground up.
As a starting point, I ported from Unity and redesigned an old physics-based character controller of mine.
Working off a concept I was already comfortable with allowed me to rapidly lay down the foundation for Little Cosmos for the rest of the team;
this was crucial in a fast-paced and otherwise unfamiliar working environment.
The physics-based character controller approach came with some additional benefits specific to our platformer, such as supporting force-based gravity.
</p>
<div class="video-block">
<table>
<caption><u>Final version of the arbitrary gravity character controller.</u></caption>
<tr><td>
<video autoplay muted loop>
<source src="../videos/planet-hopping.mp4" type="video/mp4">
</video>
</td></tr>
</table>
</div>
<!--
<details>
<summary>Player Pawn</summary>
<div id="player-pawn-h">
<p>PlayerPawn.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FPlayer%2FPlayerPawn.h%23L22-L220&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="player-pawn-cpp">
<p>PlayerPawn.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FPlayer%2FPlayerPawn.cpp%23L18-359&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<details>
<summary>Player Physics Actor</summary>
<div id="player-physics-actor-h">
<p>PlayerPhysicsActor.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FPlayer%2FPlayerPhysicsActor.h%23L14-L296&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="player-physics-actor-cpp">
<p>PlayerPhysicsActor.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FPlayer%2FPlayerPhysicsActor.cpp%23L13-L460&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
-->
</details>
<details>
<summary>
Sub-Stepping Tick
</summary>
<p>
Being my first time working with physics at the core of the player experience in Unreal, I entered the project largely negligent of the implications that may come from applying physics outside a fixed timestep.
The issue was largely unseen until the final stretch of development.
As the map got filled to the brim, we found framerate began to drop;
with this drop came an unpredictable and grossly inaccurate physics simulation.
Being made aware of the problem with only a couple of days of development remaining meant that quick thinking would need to come to the rescue.
With insufficient time to implement an optimal solution, such as a substep tick function, I opted to use a fixed frame rate of 60 fps.
With some QA and profiling, we were able to identify framerate drops to be most drastic when 'looking up' at large sections of the level.
The artists were then able to quickly identify which particle effects and shaders were least performant and remedy the problem.
In the final build, we all achieved a consistent 60 fps, free from hiccups.
</p>
<div class="video-block">
<table>
<caption><u>Applying physics on tick at ~30 fps (left), applying physics on tick at ~60 fps (right).</u></caption>
<tr><td>
<video autoplay muted loop>
<source src="../videos/unlocked-framerate.mp4" type="video/mp4">
</video>
</td></tr>
</table>
</div>
<p>
Since wrapping up Little Cosmos, I've been independently developing the systems used.
The first priority in doing so was to experiment with using a sub-stepped tick for applying physics.
See the results below for yourself!
For those interested in learning more about this topic, here are some excellent resources I came across whilst creating my own sub-stepping tick in Unreal:
<a class="hyperlink" href="http://www.aclockworkberry.com/unreal-engine-substepping/">Giuseppe Portelli (Theoretical)</a>,
<a class="hyperlink" href="https://mansisaksson.com/view/ue4-substepping/">Måns Isaksson (Practical)</a>.
</p>
<div class="video-block">
<table>
<caption><u>Applying physics on a sub-stepped tick at 30 fps (left), applying physics on a sub-stepped tick at 60 fps (right).</u></caption>
<tr><td>
<video autoplay muted loop>
<source src="../videos/substepping-tick.mp4" type="video/mp4">
</video>
</td></tr>
</table>
</div>
<details>
<summary>Substep Tick Interface</summary>
<div id="substep-tick-interface-h">
<p>SubstepTickInterface.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FSubstepTick%2FSubstepTickInterface.h%23L8-L29&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="substep-tick-interface-cpp">
<p>SubstepTickInterface.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FSubstepTick%2FSubstepTickInterface.cpp%23L6-L31&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
</details>
<details>
<summary id="any-shape-you-like">
'Any Shape You Like' Gravity
</summary>
<p>
From researching Mario Galaxies approach to gravity, I learnt that Nintendo used discrete regions of gravity fields placed around the level.
Whilst this worked for a large company like Nintendo on a game with many years of development, I was a little sceptical about limiting our gravity fields to certain regions.
What if the player escapes all regions of gravity, or multiple regions are overlapping?
As our team lacked a dedicated level designer, I instead opted for an approach that was more programmatic, less demanding on designers and frankly, more interesting for me.
</p>
<div class="video-block">
<table>
<caption><u>
Any Shape You Like
</u></caption>
<tr><td>
<video autoplay muted loop>
<source src="../videos/any-shape-you-like.mp4" type="video/mp4">
</video>
</td></tr>
</table>
</div>
<details>
<summary>Gravity Sampler Component</summary>
<div id="gravity-sampler-component-h">
<p>GravitySamplerComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FGravitySamplerComponent.h%23L11-L66&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="gravity-sampler-component-cpp">
<p>GravitySamplerComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FGravitySamplerComponent.cpp%23L8-L138&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<!--
<details>
<summary>Editor Gravity Sampler Component</summary>
<div id="editor-gravity-sampler-component-h">
<p>EditorGravitySamplerComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FEditor%2FEditorGravitySamplerComponent.h%23L12-L20&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="editor-gravity-sampler-component-cpp">
<p>EditorGravitySamplerComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FEditor%2FEditorGravitySamplerComponent.cpp%23L8-L20&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
-->
<details>
<summary>Gravity Component</summary>
<div id="gravity-component-h">
<p>GravityComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FGravityComponent.h%23L10-L27&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="gravity-component-cpp">
<p>GravityComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FGravityComponent.cpp%23L7-L40&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<p>
Calculating the direction of gravity for a position in the vicinity of a spherical planet is just a matter of calculating the vector from the sample position to the centre of the planet.
But consider a non-spherical planet, such as a cube.
Our gamified expectation is that the direction of gravity will be at a normal to the planet's surface.
However, what happens when we are not on the surface, but somewhere 'above'?
Even if we are able to determine the nearest point on the surface, we will experience dramatic changes in certain situations —
particularly for shapes with sharp corners.
</p>
<div class="video-block">
<table style="width:100%;">
<caption><u>Using surface normals</u></caption>
<tr style="width:100%;">
<td style="width:25%;"></td>
<td style="width:50%; padding-left: 20px; padding-right: 20px;">
<img id="normals" src="../images/little-cosmos/normals-light.svg" style="width: 100%; height: auto;">
</td>
<td style="width:25%;"></td>
</tr>
</table>
</div>
<p>
We're close to a solution, but not quite there.
Let's backtrack and consider what other measurements might be useful to us.
Gravitational force is a vector comprised of both direction and magnitude.
In reality, gravity's magnitude is determined as a function of the masses of the bodies involved and the distance between those masses.
That distance is often simplified to be the distance between the centre of the planet and the other body.
Whilst physics is a wonderful starting point, we must break physics in order to make something extraordinary.
I propose that a more useful measure of distance for a platformer with a variety of planet shapes and radii is the distance to the surface of the planet.
For instance, take the case of hopping from a planet with a large radius to one with a small radius.
Intuitively, the large planet should be the main effector until your jump has reached a height of roughly half the distance between the planet's surfaces, at which point the main effector should become the smaller planet.
If we wanted to adjust this switching point, we could simply assign a 'mass' value to the planets by which their influences could be scaled.
</p>
<div class="video-block">
<table style="width:100%;">
<caption><u>Midpoint between centres (left), midpoint between surfaces (right).</u></caption>
<tr style="width:100%;">
<td style="width:50%; padding-right: 20px;">
<img id="centers" src="../images/little-cosmos/center-distance-light.svg" style="width: 100%; height: auto;">
</td>
<td style="width:50%; padding-left: 20px;">
<img id="surfaces" src="../images/little-cosmos/surface-distance-light.svg" style="width: 100%; height: auto;">
</td>
</tr>
</table>
</div>
<p>
A common computational technique for finding the distance to the surface of a shape is signed distance functions, typically limited to shaders.
By representing planet's shapes using signed distance functions, we are able to determine the distance to surface of any given planet.
Furthermore, computationally differentiating the signed distance function gives us an approximation of the direction to the nearest planet's surface.
Approximations can be scary, but I found the error of the approximation to be completely insignificant with even first order, runtime suitable methods of calculation.
And that's it!
Just find the signed distance function of a shape and form a planet of any shape at will.
Thankfully, <a class="hyperlink" href="https://iquilezles.org/articles/distfunctions/">Inigo Quilez</a> has compiled an assortment of signed distance functions for our choosing.
</p>
<div class="video-block">
<table style="width:100%;">
<caption><u>Using the signed distance function</u></caption>
<tr style="width:100%;">
<td style="width:25%;"></td>
<td style="width:50%; padding-left: 20px; padding-right: 20px;">
<img id="sdf" src="../images/little-cosmos/sdf-light.svg" alt="sdf" style="width: 100%; height: auto;">
</td>
<td style="width:25%;"></td>
</tr>
</table>
</div>
<details>
<summary>Gravity Field Component</summary>
<div id="gravity-field-component-h">
<p>GravityFieldComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FGravityFieldComponent.h%23L8-L50&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="gravity-field-component-cpp">
<p>GravityFieldComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FGravityFieldComponent.cpp%23L8-L100&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<details>
<summary>Box Gravity Field Component</summary>
<div id="box-gravity-field-component-h">
<p>BoxGravityFieldComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FFields%2FBoxGravityFieldComponent.h%23L12-L34&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="box-gravity-field-component-cpp">
<p>BoxGravityFieldComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FFields%2FBoxGravityFieldComponent.cpp%23L7-L50&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<details>
<summary>Cylinder Gravity Field Component</summary>
<div id="cylinder-gravity-field-component-h">
<p>CylinderGravityFieldComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FFields%2FCylinderGravityFieldComponent.h%23L12-L35&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="cylinder-gravity-field-component-cpp">
<p>CylinderGravityFieldComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FFields%2FCylinderGravityFieldComponent.cpp%23L7-L55&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<details>
<summary>Sphere Gravity Field Component</summary>
<div id="sphere-gravity-field-component-h">
<p>SphereGravityFieldComponent.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FFields%2FSphereGravityFieldComponent.h%23L12-L31&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="sphere-gravity-field-component-cpp">
<p>SphereGravityFieldComponent.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FFields%2FSphereGravityFieldComponent.cpp%23L7-L48&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
<!--
<details>
<summary>Gravity Oriented Actor</summary>
<div id="gravity-oriented-actor-h">
<p>GravityOrientedActor.h:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPublic%2FGravity%2FEditor%2FGravityOrientedActor.h%23L11-L44&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
<div id="gravity-oriented-actor-cpp">
<p>GravityOrientedActor.cpp:</p>
<script src="https://emgithub.com/embed-v2.js?target=https%3A%2F%2Fgithub.com%2Fjoebinns%2Flittle-cosmos-code%2Fblob%2Fmain%2FSource%2FSpacetimeGame%2FPrivate%2FGravity%2FEditor%2FGravityOrientedActor.cpp%23L8-L57&style=github-dark&type=code&showBorder=on&showLineNumbers=on&showFullPath=on&showCopy=on"></script>
</div>
</details>
-->
<br>
</details>
<details>
<summary>
Baked Gravity Fields
</summary>
<p>
Whilst gravity was calculated at runtime in Little Cosmos, I also experimented with baking the calculation into vector fields;
you can find a prototype for this application <a class="hyperlink" href="https://github.com/joebinns/vector-field-generator/releases/tag/0.1.0">here</a>.
The approach may be beneficial beyond just performance gains!
The exported vector field file type is the same used by Unreal for particle systems and the chaos physics system;
there's certainly more to be explored!
</p>
<div class="video-block">
<table style="width:100%;">
<caption><u>Vector Field Generator application</u></caption>
<tr style="width:100%;">
<td style="width:20%;"></td>
<td style="width:60%; padding-left: 20px; padding-right: 20px;">
<img src="../images/little-cosmos/vector-field-generator.png" alt="vector field generator" width="100%" height="100%">
</td>
<td style="width:20%;"></td>
</tr>
</table>
</div>
</details>
</div>
</project>
<ul class="portfolio-pieces">
<li>
<a id="njuma" href="./njuma" class="gradient-multiline">
<h2>
<portfolio-prefix>
<date>next project</date><br>
<badge>🏅🏡</badge>
</portfolio-prefix>
<portfolio-title>Njuma</portfolio-title>
</h2>
</a>
</li>
</ul>
</div>
<p class="copyright-notice">
Copyright © 2021-2025 Joseph Alexander Binns. All rights reserved.
</p>
<div class="tint-overlay max"></div>
<div class="tint-overlay min"></div>
<script type="importmap"> {
"imports": {
"three": "https://unpkg.com/three/build/three.module.js",
"gltf-loader": "https://unpkg.com/three/examples/jsm/loaders/GLTFLoader.js",
"pass": "https://unpkg.com/three/examples/jsm/postprocessing/Pass.js",
"effect-composer": "https://unpkg.com/three/examples/jsm/postprocessing/EffectComposer.js",
"shader-pass": "https://unpkg.com/three/examples/jsm/postprocessing/ShaderPass.js",
"bloom-pass": "https://unpkg.com/three/examples/jsm/postprocessing/BloomPass.js"
}
}
</script>
<script type="module" src="src/DocumentDarkMode.js"></script>
<script type="module" src="src/DocumentDarkModePage.js"></script>
<script type="module" src="src/DocumentDarkModeMeta.js"></script>
<script type="module" src="src/LittleCosmos.js"></script>
</body>
</html>