Marble Run

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

Post Reply
Mika Haarahiltunen
Posts: 3
Joined: Tue Jul 03, 2018 2:41 am

Marble Run

Post by Mika Haarahiltunen » Tue Jul 03, 2018 7:01 am

Hello!

Marble Run is an NES game that I've been working on for some time and I think it is about done. I have tested this only on the FCEUX emulator, so there may be some bugs...

The idea is to collect all items and go to the exit as fast as possible. The game features 5 levels and some pretty smooth physics. Achieving a 3-star grade requires some non-obvious maneuvering, so each level has a "View Demo" feature that shows an example of how to achieve it for that level.

The NTSC ROM image and some screenshots are included as attachments.
Attachments
marble_run.nes
(40.02 KiB) Downloaded 222 times
marble_run-0.png
marble_run-0.png (2.26 KiB) Viewed 3429 times
marble_run-1.png
marble_run-1.png (1.58 KiB) Viewed 3429 times
marble_run-2.png
marble_run-2.png (1.82 KiB) Viewed 3429 times
marble_run-3.png
marble_run-3.png (1.96 KiB) Viewed 3429 times

User avatar
dougeff
Posts: 2673
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Marble Run

Post by dougeff » Tue Jul 03, 2018 7:09 am

Looks fun. :D
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
rainwarrior
Posts: 7801
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Marble Run

Post by rainwarrior » Tue Jul 03, 2018 1:51 pm

That's cool. Thanks for sharing!

WhiteHat94
Posts: 36
Joined: Fri Apr 07, 2017 5:02 pm

Re: Marble Run

Post by WhiteHat94 » Tue Jul 03, 2018 1:57 pm

Pretty fun little game, nice job. And it does indeed work just fine on console with Everdrive.

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2032
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Marble Run

Post by FrankenGraphics » Tue Jul 03, 2018 2:16 pm

Once i saw it i knew i'd like it. It's super hard for me (i haven't beaten a single stage after 30 minutes) but it's still fun.
http://www.frankengraphics.com - personal NES blog

User avatar
pubby
Posts: 550
Joined: Thu Mar 31, 2016 11:15 am

Re: Marble Run

Post by pubby » Tue Jul 03, 2018 2:37 pm

That's interesting! How did you do the physics?

Mika Haarahiltunen
Posts: 3
Joined: Tue Jul 03, 2018 2:41 am

Re: Marble Run

Post by Mika Haarahiltunen » Tue Jul 03, 2018 11:27 pm

pubby wrote:That's interesting! How did you do the physics?
The first thing that might be worth mentioning is that it uses a CORDIC algorithm for vector magnitude calculation and normalization. CORDIC is an old algorithm that is very versatile, but I hadn't even heard of it before I started working on this project.

Here is a nice description of the idea behind CORDIC: https://www.uio.no/studier/emner/matnat ... cordic.pdf

Another thing might be the broad phase collision detection. Since the ball radius is constant, it has been included in the object AABBs. The object AABBs are sorted by their minimum x-coordinates in ascending order, which allows the broad phase to quickly figure out the last AABB to check. There is also an index list that allows the broad phase to quickly figure out the first AABB to check.

I included an NTSC ROM image for a test program that shows the broad phase in action.

In the test program:
- AABB corners are dark green, if the AABB is not checked in the broad phase
- AABB corners are light green, if the AABB is checked and rejected in the broad phase
- AABB corners are orange, if the AABB requires a narrow phase check

The rest is just calculating contact points and contact plane normals, pushing the ball out of the static objects and applying impulses.
Attachments
broad_phase.nes
(24.02 KiB) Downloaded 178 times

Post Reply