Coder Social home page Coder Social logo

mattbierner / two-seconds-super-mario-bros-3 Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 0.0 82 MB

Scripts and data used to generate the Two Seconds of Super Mario Bros. 3 book

Home Page: https://blog.mattbierner.com/two-seconds-mario

Lua 0.01% Python 0.03% HTML 99.97%

two-seconds-super-mario-bros-3's Introduction

Two Seconds of Super Mario Bros. 3

Scripts and data used for a book containing every operation executed during two seconds of Super Mario Bros. 3 for NES

Repo Contents

  • mario-book/: Files for the 2 second Mario trace book.
  • mario-data/: Raw screenshots and data for the Mario trace book.
  • lordtim,mitjitsu,tompa-supermariobros3.fm2: Speed run gameplay movie used for the book.
  • fceux-screenshot-per-frame.lua: FCEUX script that takes a screenshot per frame of gameplay.
  • *.py: Python scripts used to generate the book.

Capturing data from an NES game

This project uses the FCEUX emulator. To capture your own trace:

  • Use the FCEUX trace logger to capture the executed operations. Be sure to disable all logging fields except Log frame count and To the left of dissasembly.

  • Use the fceux-screenshot-per-frame.lua Lua script to capture a screenshot of each frame of gameplay.

You should run the Lua script and the trace logger at the same time. Since the trace logger generates a lot of data and slows down the emulator quite a bit, you may need to use a pre-recorded gameplay movie instead of playing the game live.

Converting captured data to a book

The split_frame_data python3 script splits a large trace file from the FCEUX trace logger into a one file per frame. To use it with the included example data:

$ unzip ./mario-data/speed/trace.log.zip -d ./mario-data/speed/

$ python split_frame_data.py \
    --trace-file=./mario-data/speed/trace.log \
    --out-dir=./scratch

The frames_to_html python3 script converts the frame data into an html page

$ python frames_to_html.py \
    --trace-files=./scratch/ \
    --out=./two-seconds-mario.html \
    --start=410 \
    --end=530 \
    --images-path=./mario-data/speed/

From here, you can open the html page or convert it to a PDF. Be aware the if you include a lot of frames, your browser may become unresponsive if you try viewing the generated html or try printing it. You can use headless chrome to convert the page to a pdf:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --disable-gpu --no-margins --print-to-pdf=out.pdf ./out.html

Example

two-seconds-super-mario-bros-3's People

Contributors

bustinbung avatar mattbierner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.