This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Is anybody interested in reviewing my code?

Is anybody interested in reviewing my code?
by on (#185720)
Hi there,
I just 95% finished my very first NES project and am looking for someone who is interested in reviewing my code.
It is just a simple Snake clone, written in C. I would like to improve my NES skills and there I am looking for some feedback.

You can find the project here: https://github.com/JuzamDjinn91/NES-Snake

Regards Sebastian
Re: Is anybody interested in reviewing my code?
by on (#185730)
A couple of thoughts after playing it:

1. Sprites appear on screen 1 line lower than you probably think. e.g. If you put 0 in the Y coordinate, the first row of the sprite will appear on line 1.

2. Eating the second spider does not increase the length of the snake, but every other spider does. Why is the second one special?

3. You can reverse direction if you press the buttons fast enough. e.g. If you are facing left, you can tap up then right quickly to turn right without ever moving up. If the snake is longer than two parts this causes suicide, which is frustrating because it's easy to do by accident while just trying to make a quick turn.

For precise control, the solution I'd suggest is maybe queue button presses. If someone taps up then right on the same turn, apply up on the next tick, then right on the tick after that?

4. When moving along the top wall, a tile once disappeared from it, leaving a hole. Not sure what caused this, and wasn't able to do it again, but it suggests there is a bug that causes this.

5. Why do you hide the snake head and spider sprites when displaying the PAUSE indicator?

6. Is there no way to return to the title screen after game over?

7. The title NESNAKE was already used for a similar game by RetroUSB (Super NeSnake 2), which might be worth playing for some ideas.
Re: Is anybody interested in reviewing my code?
by on (#185771)
rainwarrior wrote:
A couple of thoughts after playing it:

1. Sprites appear on screen 1 line lower than you probably think. e.g. If you put 0 in the Y coordinate, the first row of the sprite will appear on line 1.

2. Eating the second spider does not increase the length of the snake, but every other spider does. Why is the second one special?

3. You can reverse direction if you press the buttons fast enough. e.g. If you are facing left, you can tap up then right quickly to turn right without ever moving up. If the snake is longer than two parts this causes suicide, which is frustrating because it's easy to do by accident while just trying to make a quick turn.

For precise control, the solution I'd suggest is maybe queue button presses. If someone taps up then right on the same turn, apply up on the next tick, then right on the tick after that?

4. When moving along the top wall, a tile once disappeared from it, leaving a hole. Not sure what caused this, and wasn't able to do it again, but it suggests there is a bug that causes this.

5. Why do you hide the snake head and spider sprites when displaying the PAUSE indicator?

6. Is there no way to return to the title screen after game over?

7. The title NESNAKE was already used for a similar game by RetroUSB (Super NeSnake 2), which might be worth playing for some ideas.


Thanks for the feedback. I did not notice, that you can switch directions that way (3).
Regarding the disabled tile: I noticed this as well but could not find the bug yet.

Regards Sebastian
Re: Is anybody interested in reviewing my code?
by on (#185774)
rainwarrior wrote:
5. Why do you hide the snake head and spider sprites when displaying the PAUSE indicator?

If it hid the entire snake, it'd make sense as an anti-cheating mechanism (i.e. similar to hiding the playfield in Tetris) - otherwise, you could pause the game, study the playfield, and figure out how to safely navigate to the next item.
Re: Is anybody interested in reviewing my code?
by on (#185779)
One suggestion I have is that it should display what level number you are on at the top and on the game over screen.

A way to hide everything when paused is to switch to the other nametable. For example you can use the nametable at $2000 for the playfield and at $2C00 for the pause screen (if you aren't scrolling, you don't need $2400 and $2800 nametables).

Other ideas for enhancements to the game are possible, such as:
  • Time limit
  • One way passages
  • Option menu for setting speed and possibly other setting