Protector by khopa
PROTECTOR
A Ludum Dare 46 game jam compo entry. April 2020.
THEME : KEEP IT ALIVE
Platform : Nintendo Entertainment System [NES]
Language : C (ASM source included in source code were either generated, or are existing library necessary to build the ROM.)

Description
This a 1-player Arcade action game. You are a hero, with your antivirus gun, you must destroy the incoming viruses, survive and protect the nurse in an hospital.

Controls
- Hold A to run
- Press B to shoot
- Use D-PAD to move around
- Press SELECT to toggle the music if it annoys you
- Press START to pause the game

How to run
Download .nes ROM. Open it in your favorite NES emulator. I recommend to use Mesen for an optimal experience.
If you do not want to install an emulator, you can just go to https://jsnes.org/, then drag and drop the .nes rom on the webpage to play.
How was it made
Libraries :
- Shiru's neslib
- Shiru's famitone2
Tools used :
- Visual Studio Code (Code editor)
- Shiru's NES Screen Tools (CHR graphic bank editor, and nametable map tool, NES palette editor)
- CA65 compiler (Compiler)
- Famitracker (Sound & Music)
- Mesen (Emulator & Debug tools)
- Shiru's NES Space Checker (Check generated ROM)
Special Thanks
I'd like to thanks :
- Shiru for his invaluable NES development tutorials, tools, examples and learning resources
- All the developers of the tools i used. (Mesen, Famitracker, Visual Studio Code, CA65)
- The LDJAM event organizers
- Anyone that is going to play and rate this game during the competion
- ...
- AND all the people fighting the pandemic while i'm at home making silly games !
How to run
Download the .nes ROM. Open it in your favorite NES emulator. I recommend to use Mesen for an optimal experience.
If you do not want to install an emulator, you can find a web-based one, then just drag and drop the .NES rom.
I found these working online html5/javascript NES emulators : - https://app.7io.org/CycloaJS/ : Just drag and drop the .nes file on the webpage to start playing. [Recommended] - https://jsnes.org/ : Just drag and drop the .nes file on the webpage to start playing. [Does not work entirely as expected]
Ratings
| Overall | 468th | 3.485⭐ | 35🧑⚖️ |
| Fun | 651th | 3.136⭐ | 35🧑⚖️ |
| Innovation | 213th | 3.706⭐ | 36🧑⚖️ |
| Theme | 521th | 3.676⭐ | 36🧑⚖️ |
| Graphics | 269th | 3.786⭐ | 37🧑⚖️ |
| Audio | 380th | 3.266⭐ | 34🧑⚖️ |
| Humor | 434th | 2.939⭐ | 35🧑⚖️ |
| Mood | 679th | 3.015⭐ | 35🧑⚖️ |
| Given | 53🗳️ | 39🗨️ |
I played it on CycloaJS and while the sprites moved SUPER fast, because the projectiles were also so fast that they were essentially a laser beam it wasn't to hard to intercept them.
Nice job!
The Theme quite feet with the current time :)
The game plays nicely in online emulator or mednafen, the experience is complete with a controller :smile:
I didn't get the logic behind projectile speed? They seem to be really fast when spawning, but this may just be an emulation quirk.
Really pleasant experience though, and friendly fire is a nice detail!
Also fits the theme really well, keep those 8bits machines alive!
Thanks everyone for the feedback.
@greizgh, @magnusfurcifer, Yes, the projectiles are really fast, it did not seems too extreme for me though, maybe your emulator is making the game faster than it actually is ?
But yeah the player's projectile are really fast by design and there is actually a technical reason behind this choice.
By making the player projectile that fast, it means that they also dissapear faster, which save on sprite count on screen, on RAM needed to store the state of the bullets and on the number of collision checks to perform on each frame.
Because, the NES has a limit of 64 '8x8' sprites displayed on screen, and a maximum of 8 '8x8' sprites can be displayed on each 'scanline'. So to avoid any issues, and flickering i limited the player gun to 4 projectile. So it is enough to display two virus, the Player, the NPC, and the 4 bullets, on one line before flickering starts.
Otherwise should the player fire from the extreme left side of the screen to the right side, there would be a lot of bullets to display, as well as lag because of the increasing number of collision check to perform. (And the game is far from being perfectly optimized for the system, as it is written in C)
To demonstrate what could happen, I just built an example ROM where i increased the number of bullets the player can fire, and reduced their speed to 1 px per frame (which is really slow for demonstration purpose), look at how glitchy and laggy it can get :
https://github.com/Khopa/protector_ldjam46/releases/download/1.0.1-glitchy/protector_slow_bullets_example.nes
Thanks !
If you are interested in programming for the NES, you should definitely check this website out :
https://shiru.untergrund.net/articles/programming_nes_games_in_c.htm
It has a bunch of very simple examples, tools, resources, and general advices that might be better to get you started.
That's a really good idea for the A button ! I might experiment this, as it's true the current sprint behaviour doesn't work very well.
Question, the doctor in the intro, is that Prof Didier Raoult? :thinking:
It's kinda hard to give feedback on this one, since I grew up with a SNES, but not an NES, and so I don't really know what is a technical difficulty or impossibility or what is a choice imposed by the console's limitation :P
I'm definitly going to try to do something for the NES in the future !
Yes it is. :sweat_smile:

Just don't read too much into it. I needed a doctor photography, and the guy being kind of a meme, i decided to go with that. I'm surprised that he's even recognizable, as i did an awful job when trying to convert the picture to 4 color NES compatible format.
I did not grew up with the NES either, and i totally get your point. I played most of the popular games later, but still.
I wasn't aware of most limits before i started really reading about the system and coding for it.
And now that i know a little bit more about it, i'm actually really impressed by the games that were released back then, and what developers achieved with the system.