It is currently Sat Jul 21, 2018 10:27 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Marble Run
PostPosted: Tue Jul 03, 2018 7:01 am 
Offline

Joined: Tue Jul 03, 2018 2:41 am
Posts: 3
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 57 times
marble_run-0.png
marble_run-0.png [ 2.26 KiB | Viewed 456 times ]
marble_run-1.png
marble_run-1.png [ 1.58 KiB | Viewed 456 times ]
marble_run-2.png
marble_run-2.png [ 1.82 KiB | Viewed 456 times ]
marble_run-3.png
marble_run-3.png [ 1.96 KiB | Viewed 456 times ]
Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 7:09 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2155
Location: DIGDUG
Looks fun. :D

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 1:51 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6425
Location: Canada
That's cool. Thanks for sharing!


Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 1:57 pm 
Offline

Joined: Fri Apr 07, 2017 5:02 pm
Posts: 7
Pretty fun little game, nice job. And it does indeed work just fine on console with Everdrive.


Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 2:16 pm 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1657
Location: Gothenburg, Sweden
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


Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 2:37 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 318
That's interesting! How did you do the physics?


Top
 Profile  
 
 Post subject: Re: Marble Run
PostPosted: Tue Jul 03, 2018 11:27 pm 
Offline

Joined: Tue Jul 03, 2018 2:41 am
Posts: 3
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 35 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group