# Space Rocks 3D!

**URL:** <https://forum.makecode.com/t/space-rocks-3d/6334>\
**Category:** Show & Tell\
**Tags:** featured-game, game\
**Created:** [February 24, 2021, 3:59pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334 "2021-02-24T15:59:47Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)\
**Post date:** [February 26, 2021, 5:01am UTC](https://forum.makecode.com/t/space-rocks-3d/6334/33 "2021-02-26T05:01:24Z")

</div>

Here’s another new build:

> **[Space Rocks 3D (v3)](https://arcade.makecode.com/30723-27619-37263-59640)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Changes:

- Added a cockpit dashboard overlay by popular request.
- Asteroids now rotate!
- Moved the laser heat gauge to the dashboard, it’s now an energy meter that drops as you fire.
- Various updates to internals to save memory and fix renderer issues.

Please let me know in case you see any performance regressions, especially on hardware devices.

> [@2ndClemens](#):
>
> Works well on the Meowbit till level 4 where it gets quite slow. Crashes at level 5.

Would you be willing to check if it’s still crashing on Meowbit in this version? I’ve tried to reduce memory consumption.

> [@mmoskal](#):
>
> There may be a memory leak somewhere. I take it the profiling in the browser doesn’t show any new objects staying alive after each frame/level?

There are some smallish reallocations after each level. I’m using an array with reusable triangle data (trapezoids) to reduce the per-frame garbage collector churn. That array grows a bit for each new level, but it only has ~150 elements and generally doesn’t need to reallocate during levels. I’ve switched the data representation for the underlying trapezoids from numbers to bytes in a buffer which reduced the data size from 48 bytes to 8 bytes.

The overall memory usage seems to be holding steady around 40kB, but I’m not sure if that’s representative of what it looks like in hardware.

Out of curiosity, is there a way to force a RAM limit, for example making a PyGamer pretend it only has 96 kB? That would make it easier to verify that games still work on low-memory devices.

> [@mmoskal](#):
>
> The Fx module uses an abstract type and casting (which has no runtime cost) to keep this type-safe.

That is very cool, I clearly need to read up on advanced TypeScript. I wasn’t aware that it’s possible to make no-overhead abstractions like this. Thank you again for the feedback!

---

_[View the full topic](https://forum.makecode.com/t/space-rocks-3d/6334)._
