# Space Rocks 3D!

**URL:** https://forum.makecode.com/t/space-rocks-3d/6334
**Category:** Show & Tell
**Tags:** game, featured-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:** 19
**Page:** 7

<div class="post-metadata">

### Author: ![Sonicblaston](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sonicblaston/32/19164_2.png) [@Sonicblaston](https://forum.makecode.com/u/Sonicblaston)
#### Post date: [June 20, 2022, 4:52pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/121 "2022-06-20T16:52:11Z")

</div>

> [@ggiscool](#):
>
> > [@GameGod](#):
> >
> > > [@UnsignedArduino](#):
> > >
> > > Great game BTW! Wish my brain was big enough to make something like this…
> > 
> > Same here!
> 
> same here

Same here

---

<div class="post-metadata">

### Author: ![Sonicblaston](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sonicblaston/32/19164_2.png) [@Sonicblaston](https://forum.makecode.com/u/Sonicblaston)
#### Post date: [June 20, 2022, 7:54pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/122 "2022-06-20T19:54:23Z")

</div>

I just got like three quotes inside of each other 😅 🤣

---

<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: [June 20, 2022, 9:35pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/123 "2022-06-20T21:35:59Z")

</div>

> [@xavvvvvv](#):
>
> You Should Add Color Settings.

It’s a bit tricky since I wanted smooth grayscale shading and Arcade only has a 16-color palette, so I went with black&white for the game. I tried a different palette in the Carrier 3D demo, that uses 8 shades of gray and 8 other colors for variety. I don’t currently have plans to modify Space Rocks 3D further though as far as weapons or graphics are concerned…

---

<div class="post-metadata">

### Author: ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)
#### Post date: [July 1, 2022, 4:13pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/124 "2022-07-01T16:13:57Z")

</div>

> [@kwx](#):
>
> t’s running the same source code on hardware as on the simulator, it doesn’t have any hardware-dependent conditionals. It is using fixed-point math using the Fx8 library…

After many hours of unsuccessfully trying to debug this, I just posted an issue over at pxt-arcade about this _Floating Point Exception_ specific to the Raspberry Pi for this game:

> <https://github.com/microsoft/pxt-arcade/issues/4847>
>
> \*\*Describe the bug\*\*
> When compiling for and running @klausw's advanced 3D game,… \_Space Rocks 3D!\_ on a Raspberry Pi, it crashes with the error message "Floating Point Exception".
> 
> The game works well in the simulator, and has been tested without any errors \[on both the PyGamer and the Meowbit\](https://forum.makecode.com/t/space-rocks-3d/6334/118), indicating that this probably is an error specific to MakeCode's implementation on the Raspberry Pi and not the game code itself, akin to @nopid's \[recently fixed error in the Raspberry Pi(RPi) implementation of the namespace setting\](https://github.com/microsoft/pxt-arcade/issues/3812#issuecomment-1137197195).
> 
> Further supporting that the error is in the compilation itself for the RPi, is the game author's testimony that the game code does not include any floating point operations at all.
> 
> I have found that on Posix systems, C++ normally emits \_Floating Point Exceptions\_ unrelated to floating point operations, and that the exception is thrown rather on conditions of \[FE\_DIVBYZERO, FE\_INEXACT, FE\_INVALID, FE\_OVERFLOW, FE\_UNDERFLOW and FE\_ALL\_EXCEPT\](https://en.cppreference.com/w/cpp/numeric/fenv/FE\_exceptions).
> 
> Further, I have tried debug the game gode by guarding against any obvious \_divide-by-zero\_ or overflow conditions(\`tan(90)\` etc.), to no avail and I have now reached the limits of my competence and depleted all ideas I had for pinpointing the error further. I do not master fully the nuances of integer sizes etc. on the RPi, or where to search for this bug in the pxt compiler code, but all (my) clues seem to lead in this direction.
> 
> I really hope the MakeCode team or some bright individuals in the community(like @nopid) can figure out and rectify the difference between the RPi implementation and the implementations for the Web simulator, the PyGamer and the Meowbit, so that this and other future equally advanced 3D games will run also on the RPi!
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Go to https://arcade.makecode.com/beta/?nolocalhost=1&compile=rawELF&hw=rpi#pub:57095-73027-58575-13726 and download as .elf for general RPi or uf2 for the MakeCode Raspberry Pi image.
> \_\_NB!: Very important to download from the beta version of MakeCode Arcade, since the production version is still haunted by the \[Segmentation Fault error from the RPi implementation of the Settings namespace\](https://github.com/microsoft/pxt-arcade/issues/3812).\_\_
> 2. Load the game onto the device and run it.
> 4. Observe black screen and see the \_Floating Point Exception\_ error
> 
> \*\*Expected behavior\*\*
> Game running equally well on the RPi as in the web simulator and on the PyGamer and the Meowbit.
> (In the same spirit of e.g. @jwunderl's "...should probably not crash on hardware (unless it's somehow a valid error, in which case simulator should crash to match hardware :))" in \[this issue with some similarities\](https://github.com/microsoft/pxt-arcade/issues/4801#issue-1262188326).)
> 
> \*\*Screenshots\*\*
> n/a
> 
> \*\*Desktop (please complete the following information):\*\*
> See above
> 
> \*\*Smartphone (please complete the following information):\*\*
> n/a
> 
> \*\*Additional context\*\*
> n/a

I hope someone here or there could have a look at this and help squash the bug!

---

<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: [July 5, 2022, 5:56pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/125 "2022-07-05T17:56:54Z")

</div>

I was about to reply to your bug update in github, but I thought it would be more appropriate here instead of sidetracking the bug investigation in an issue tracker.

> And how does “everyone” seem to know stuff like that the integer numbers are 30-bit etc.? Apart from the obvious - being better and more experienced coders than I - do you have access to some other special tools to help, like well-commented code, system/code/uml diagrams, serious documentation, custom debuggers, blueprints, whatever? 😉

@mmoskal had given me pointers in this forum thread, i.e. [comment 25](https://forum.makecode.com/t/space-rocks-3d/6334/25) and [comment 30](https://forum.makecode.com/t/space-rocks-3d/6334/30). He also wrote an [article](https://www.microsoft.com/en-us/research/blog/rocket-fast-embedded-typescript-for-makecode-arcade/) and co-wrote this [detailed paper](https://www.microsoft.com/en-us/research/uploads/prod/2019/09/mplr19main-id10-p-41a6cf2-42682-final.pdf).

If you’re curious, you can also poke around in the game’s compiled output, see the Explorer \> Built submenu after selecting a target and downloading - see `binary.js` for a javascript intermediate representation (which still somewhat resembles the original source), or `binary.asm` for the ARM assembly (not particularly user friendly).

The core issue for me was to ensure that integer values stayed within the fast 2^30 range including all intermediate values. A nasty side effect is that things still work if that limitation is exceeded (or if the values aren’t integers), it just gets 100x slower on hardware due to falling back to software floating point math. I wrote some benchmarking code to pin down where time was being spent, that’s still accessible from the game’s menu.

---

<div class="post-metadata">

### Author: ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)
#### Post date: [July 7, 2022, 5:18pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/126 "2022-07-07T17:18:21Z")

</div>

Thanks again, @kwx! This was very useful information!

The first article was good and new to me, the second I have read, but apparently have to read again with other spectacles, since my focus when I read it was research on different ways of executing MCA games(simulator, VM/bytecode, MCU executables and other native executables etc.).

Still, as a pretty fresh student of debugging, I am struggling to establish the understanding of MCA game code in the editor vs. the compiled code and runtime, and ultimately the line number in the different pxt _libs_ files for linux where this bug probably might reside.

Even when i compile the rpi .elf with the ?dbg=1 flag, I cannot manage to get `gdb` to backtrace in any (for me) meaningful way on any of the threads, and a custom compilation of _strace_ with backtrace and `strace -f -k` is still pretty much Greek to me.

gdb:  
“Backtrace stopped: previous frame identical to this frame (corrupt stack?)”

But I am thankful for your hints about `binary.js` and `binary.asm` etc. in the Explorer \> Built submenu, which seem relevant and useful to explore further and try to understand.

But if there are no ready tools to debug within the link between the MCA code, the underlying _libs_ and source code and resulting executable file, guess I could try other Raspberrys and maybe the official distro to rule out if there’s actually something wrong with my own runtime environment, chop up your code into smaller modules, if possible, and see which parts trigger the SIGFPE etc.

But since this is not a compile time error, I think you are on to something, about the switch from integer to floating point during runtime, and that the math? _libs_ for RPi somehow experiences a buffer overflow somewhere. There are also hints at different forums, that the SIGFPE might be triggered by some incompatibility in type castings or assignments etc.

However frustrating this bug is on my level of programming expertise, I am in a way thankful, because the main reason for my interest in MCA(apart from the joy of seeing my son learning and creating and doing projects together with him _inside_ MCA), is the underlying pxt source code base, which is interesting enough to keep up motivation, and has enough learning challenges for many years to come in everything from C++(and other languages) programming, debugging, compilation to navigating and understanding bigger code bases etc.

Also a very nice community of people who just want to learn and create awesome stuff, help each other on the way and to make MCA better and better known. I only wish that the advanced community was a lot bigger, with more activity both in this forum and on GitHub, so that maybe the learning curve did not have to be this steep, hehe. But, the harder the nut, the more the learning(and maybe the harder the lesson learned and remembered), though… 😉

---

<div class="post-metadata">

### Author: ![EuJeen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/eujeen/32/12807_2.png) [@EuJeen](https://forum.makecode.com/u/EuJeen)
#### Post date: [August 2, 2022, 8:33pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/127 "2022-08-02T20:33:42Z")

</div>

Cool game with lots of amazing graphics! Awesome.

---

<div class="post-metadata">

### Author: ![cSquared](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/csquared/32/7676_2.png) [@cSquared](https://forum.makecode.com/u/cSquared)
#### Post date: [September 26, 2022, 5:20pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/128 "2022-09-26T17:20:09Z")

</div>

my high score on v0.15:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/95474d51a8c9dc406b8ddf1430282a0022fd597a.png)

---

<div class="post-metadata">

### Author: ![evil\_coding\_kitten](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/evil_coding_kitten/32/14552_2.png) [@evil\_coding\_kitten](https://forum.makecode.com/u/evil_coding_kitten)
#### Post date: [April 7, 2024, 11:01pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/129 "2024-04-07T23:01:53Z")

</div>

@kwx maybe add a way you can change the cock pits from all of the versions that you have like from v1 v2 v3 and all of the other versions.

---

<div class="post-metadata">

### Author: ![spectral](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spectral/32/18474_2.png) [@spectral](https://forum.makecode.com/u/spectral)
#### Post date: [October 1, 2024, 10:47pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/130 "2024-10-01T22:47:31Z")

</div>

hey, quick question! are you still working on this extended 3d engine or has it been archived?

---

<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: [October 2, 2024, 8:59pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/131 "2024-10-02T20:59:32Z")

</div>

I’m not currently working on it (or any other MakeCode Arcade project). I think the version in [Carrier 3D](https://forum.makecode.com/t/carrier-3d-unfinished-work-in-progress/10573) is the latest, but it isn’t really intended to be a general-purpose 3D engine since it has a fair number of idiosyncrasies, for example objects needing to be drawn in a back-to-front order.

---

<div class="post-metadata">

### Author: ![Abstract](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/abstract/32/31064_2.png) [@Abstract](https://forum.makecode.com/u/Abstract)
#### Post date: [April 13, 2026, 11:37pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/132 "2026-04-13T23:37:58Z")

</div>

I know that this is like, years late but this is an edit for **low-power arcade models** such as the educational one that’s usually associated with the Makecode Arcade.

It retains most of the functionality of the original game, just removing the comments and optional settings from the Javascript and r **emoved the Cockpit + Radar entirely.**

> **[Space Rocks 3D! (Retro Arcade Education Port)](https://arcade.makecode.com/17187-66238-70508-91618)**
>
> A port of "Space Rocks 3D!" that works on the ELECFREAKS Retro Arcade for Education.

---

<div class="post-metadata">

### Author: ![CodingGrizzlyBear](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codinggrizzlybear/32/14838_2.png) [@CodingGrizzlyBear](https://forum.makecode.com/u/CodingGrizzlyBear)
#### Post date: [April 14, 2026, 2:11am UTC](https://forum.makecode.com/t/space-rocks-3d/6334/133 "2026-04-14T02:11:50Z")

</div>

Cool! 👍 :monkey:

---

<div class="post-metadata">

### Author: ![raphayel](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@raphayel](https://forum.makecode.com/u/raphayel)
#### Post date: [May 6, 2026, 9:53pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/134 "2026-05-06T21:53:32Z")

</div>

i love this game

---

<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: [May 7, 2026, 2:03am UTC](https://forum.makecode.com/t/space-rocks-3d/6334/135 "2026-05-07T02:03:52Z")

</div>

Thanks! Make sure to check out the sequel also:

> [@\[Repost\] Space Rocks Revenge](https://forum.makecode.com/t/repost-space-rocks-revenge/31570):
>
> Can you win battles against waves of enemy spaceships? Your shield recharges between waves, but your hull doesn’t get repaired, so be careful. Early on you’ll face weaker ships, but the wave 6 opponent flies a ship identical to yours. From wave 7 on, you’ll get progressively more (but not quite as tough) enemies. Good hunting, and have fun! Using the radar is essential for situational awareness. It shows a 3D representation of ships around you. Each red dot is connected with a white stick to…

---

<div class="post-metadata">

### Author: ![AlexTheGoober63](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexthegoober63/32/35080_2.png) [@AlexTheGoober63](https://forum.makecode.com/u/AlexTheGoober63)
#### Post date: [May 7, 2026, 5:14pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/136 "2026-05-07T17:14:44Z")

</div>

WHY IS THIS GAME SO GOOd.

---

<div class="post-metadata">

### Author: ![raphayel](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@raphayel](https://forum.makecode.com/u/raphayel)
#### Post date: [May 7, 2026, 5:33pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/137 "2026-05-07T17:33:05Z")

</div>

i prefer the old one cus in the new, i literaly spend 300 minutes jut to spot the pod and dont even shoot it

---

<div class="post-metadata">

### Author: ![kirbob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kirbob/32/34880_2.png) [@kirbob](https://forum.makecode.com/u/kirbob)
#### Post date: [June 3, 2026, 11:38pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/138 "2026-06-03T23:38:51Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/c/bc73c970d5c4e771640c6324dffa581e581cbe47.png)

---

<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: [June 4, 2026, 10:20pm UTC](https://forum.makecode.com/t/space-rocks-3d/6334/139 "2026-06-04T22:20:50Z")

</div>

Wow, that looks like quite the stress test. Which wave is that?

[Previous page](https://forum.makecode.com/t/space-rocks-3d/6334.md?page=6)
