Projects/Ledbanner NES: Difference between revisions

From Hackerspace Amersfoort
Jump to navigation Jump to search
(Added Ledbanner NES project)
 
 
Line 11: Line 11:


== How to run ==
== How to run ==
TODO: Need to check the ledbanner for the command to use, to lazy to write it out right now.  
go run ./go/src/glitter.jemoeders.website/biodiscus/ledbanner_nes/main.go ./mario/out/mario.so ./mario/rom/mario2.nes | ledcat --dim 0.4 hexws2811 > /dev/ttyACM0


== Stuff created ==
== Stuff created ==

Latest revision as of 12:51, 25 March 2018


Project NES op de ledbanner 🐄
Name NES op de ledbanner 🐄
Start 2018/01/15
End
Contact Gopper
Website https://glitter.jemoeders.website/biodiscus/ledbanner nes
Information Putting a NES game (in this case Mario) on the ledbanner
Status Beta


Idea

I thought it would be fun to do it.

How to run

go run ./go/src/glitter.jemoeders.website/biodiscus/ledbanner_nes/main.go ./mario/out/mario.so ./mario/rom/mario2.nes | ledcat --dim 0.4 hexws2811 > /dev/ttyACM0

Stuff created

For this project different parts where

  • A plugin system
    • To allow the camera to be different for different displays, a display of 150x16 has different mapping rules than a 1920x1080 display.
    • Look at the build script in the test_plugin folder to compile the plugin.
  • A ledbanner "emulator", to make local development easy and fast
    • Ledcat's demo feature wasn't nice when this feature was created.
    • Run Web/test.html from the browser to emulate the ledbanner display.
  • A socket to send controller inputs to the server

Encountered problems

During the project quite a lot of problems where encountered, the idea behind this entry is to help people not make the same mistake or allow this to help solve the problem.

Size

A size of a NES is 256x240 (Vertical x Horizontal) pixels, while the size of the ledbanner is 150x16. To solve this, I've tried a few thing:

  • Stretching the image horizontal and vertical to fit the led banner perfectly, by stretching the whole game isn't recognizable
  • Stretching the image horizontal and keep the aspect ratio, this way the game becomes recognizable but Mario can jump off screen
  • Scaling the image and keeping the original aspect ratio, this made Mario 1x2 (width x height) pixels and made the game not recognizable
  • Track the position and state of Mario and scaling and moving the area according to those variables, this makes the game way harder but Mario is recognizable

A plugin was written where the NES memory can be used to control the camera, this allows "anyone" to create a correct mapping for the display. A project that I'd love to do right now is map Mario for the Kubusje.

Data

To much data was send to ledcat, while it did run on 60 FPS it also made the input fall a second behind. This was fixed by adding a delay when rendering a single frame.

Link to delay when rendering a frame

Hidden Mario

Mario is hidden due to frame skipping, to make the game appear to run faster than it's actually doing. Frame skipping was implemented on every second frame, which also happens to be the frame when mario is invuranble after taking damage. This was solved by putting the frame skip on every third frame.

Link to the frame skip

Camera would move before mario

There was a problem with the camera moving to a position before Mario was visually at that place. This was fixed by keeping a buffer and taking data out of it two frames later.

Link to y position from a buffer

Emulator and different mappins

All different kind of emulators use different kinds of memory mappings (?). Making imposible to play certain games on the emulator. The emulator chosen for this project, was chosen because it supported Mario 🤷‍♂️. The NES emulator that's modified is: [1], in this version there are a lot of Stdout prints, which is not ideal when you need to send pixels/colors to Stdout to ledcat.

Bugs/Features

Stuff that still needs to happend, but I can't be bothered to fix it.

  • When you die it's just a blank screen, a game over text added to it can be a nice feature.
  • When falling the screen scales back before the player has landed, this should be fixed by only scaling back when Mario landed.
  • When falling from the screen, the screen scrolls to a black screen.
  • When jumping from a high thing and reaching the top of the screen, there is 1 frame that is black and after that will go back to the correct color.
  • When scaling the left and right should be duplicated, otherwise it's really uggly.


~ Gopper 🐄