sm64-random-assets


Namesm64-random-assets JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/Erotemic/sm64-random-assets
SummaryThe sm64-random-assets module
upload_time2023-07-29 02:13:15
maintainer
docs_urlNone
authorJon Crall
requires_python>=3.8
licenseApache 2
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            SM64 Randomized Asset Generator
===============================

Generates non-copyrighted randomized assets so sm64 and sm64-port can be used
for educational purposes.

This has only been tested for building the US variant, and only on Linux.

For each asset it generates a random texture, except in special cases like text
where it was possible to generate reasonable textures with open source tools.
The result is surprisingly playable.

Future work will support configurable and procedural generation of assets.


.. image:: https://i.imgur.com/iiMPSTZ.png

.. image:: https://i.imgur.com/5OsOH1F.png

.. image:: https://i.imgur.com/yFI8WV2.png

.. image:: https://i.imgur.com/jlXDyMJ.png


Python Requirements
-------------------

To run the asset generation script, the following requirements are needed.

.. code:: bash

   pip install kwimage opencv-python-headless ubelt numpy ruamel.yaml PyYAML scriptconfig rich parse


PC Port Example Usage
---------------------

The following instructions were written on an Ubuntu 22.04 PC

.. code:: bash

    # PC Port Dependencies
    sudo apt install -y git build-essential pkg-config libusb-1.0-0-dev libsdl2-dev

    # You can set your "code" directory path - the place where you will clone
    # this repo - to be somewhere convenient for you
    CODE_DPATH=$HOME/code

    # Ensure your code directory exists
    mkdir -p $CODE_DPATH

    # Clone this repo
    git clone https://github.com/Erotemic/sm64-random-assets.git $CODE_DPATH/sm64-random-assets

    # Move into the root of this repo and initialize the sm64-port submodule,
    # which will clone the official PC port repo.
    cd $CODE_DPATH/sm64-random-assets
    git submodule update --init tpl/sm64-port

    # Run the asset generator
    python $CODE_DPATH/sm64-random-assets/generate_assets.py --dst $CODE_DPATH/sm64-random-assets/tpl/sm64-port

    # Move into the PC port directory
    cd $CODE_DPATH/sm64-random-assets/tpl/sm64-port

    # Compile
    make NOEXTRACT=1 VERSION=us -j16


The compiled executable can now be run directly:

.. code:: bash

    # Run the executable
    build/us_pc/sm64.us


Headless ROM Usage
------------------

.. code:: bash

    # ROM-only dependencies
    sudo apt install -y binutils-mips-linux-gnu build-essential git libcapstone-dev pkgconf python3

    # You can set your "code" directory path - the place where you will clone
    # this repo - to be somewhere convenient for you
    CODE_DPATH=$HOME/code

    # Ensure your code directory exists
    mkdir -p $CODE_DPATH

    # Clone this repo
    git clone https://github.com/Erotemic/sm64-random-assets.git $CODE_DPATH/sm64-random-assets

    # Move into the root of this repo and initialize the sm64 submodule,
    # which will clone the official ROM-only sm64 repo.
    cd $CODE_DPATH/sm64-random-assets
    git submodule update --init tpl/sm64

    # Run the asset generator
    python $CODE_DPATH/sm64-random-assets/generate_assets.py --dst $CODE_DPATH/sm64-random-assets/tpl/sm64

    # Move into the ROM-only sm64 directory
    cd $CODE_DPATH/sm64-random-assets/tpl/sm64

    # Compile
    NUM_CPUS=$(nproc --all)
    NOEXTRACT=1 COMPARE=0 NON_MATCHING=0 VERSION=us make -j$NUM_CPUS

    # The compiled ROM is: build/us/sm64.us.z64

This ROM can now be flashed on an N64 cartage, copied onto an Everdrive, or run
using an N64 emulator (like Mupen64Plus). For instance, if you have Mupen64Plus
installed (e.g. ``sudo apt install mupen64plus-qt``) you can run:

.. code:: bash

   mupen64plus build/us/sm64.us.z64


N64 Limitations
---------------

On real N64 hardware truly randomizing all textures will cause the system to
lock up. This is because the N64 has 4 megabytes of RAM, and many of the
original PNG textures are optimized to reduce their memory usage by having
large continuous sections of the same color. Naively randomizing every pixel
does not generate data well suited for PNG compression.

I have verified that I cen enter every major stage and complete every bowser
fight, so I think all of the crashes have been resolved by reducing texture
sizes. I have completed a 16 star run on real N64 hardware with this.


Development
-----------

While I'll try to keep the above instructions working / maintained, the
``build.sh`` script is the end-to-end entry point for developers. Starting from
a fresh repo, the ``build.sh`` script will take care of the entire process from
initializing submodules, generating assets, compiling the binaries, and even
running them with the pc-port, in an emulator, or copying ROMs to an EverDrive.
Environment variables can be used to control the build.sh behavior.

The following are several common examples:

.. code::

   # Build and run the PC port
   TEST_LOCALLY=1 TARGET=pc ./build.sh

   # Build and run the ROM in an emulator (m64py)
   TEST_LOCALLY=1 TARGET=rom EMULATOR=m64py ./build.sh

Resources
---------

* Mupen64Plus Emulator: https://wiki.debian.org/Mupen64Plus

* Python Frontend for Mupen64Plus: https://github.com/mupen64plus/mupen64plus-ui-python

* Everdrive 64 X7: https://krikzz.com/our-products/cartridges/ed64x7.html

* The SM64 Port: https://github.com/sm64-port/sm64-port

* The SM64 Decomp: https://github.com/n64decomp/sm64

* The SM64 Decomp Discord: https://discord.gg/DuYH3Fh

* Kaze Emanuar ROM Hacks: https://www.notabug.org/anomie/kaze-emanuar-romhacks

* High resolution redrawn textures: https://github.com/TechieAndroid/sm64redrawn

* SM64 Randomizer: https://github.com/andrelikesdogs/sm64-randomizer

* List of SM64 Hacks and Ports: https://en.wikipedia.org/wiki/List_of_Super_Mario_64_ROM_hacks,_mods_and_ports

* SM64 plus: https://github.com/MorsGames/sm64plus

* SM64 ex: https://github.com/sm64pc/sm64ex

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Erotemic/sm64-random-assets",
    "name": "sm64-random-assets",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jon Crall",
    "author_email": "erotemic@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/99/9a/9ad4733a675b530d16fe171a04fdfbcc634a67a399cbf73c7abf85c1a99b/sm64_random_assets-0.0.1.tar.gz",
    "platform": null,
    "description": "SM64 Randomized Asset Generator\n===============================\n\nGenerates non-copyrighted randomized assets so sm64 and sm64-port can be used\nfor educational purposes.\n\nThis has only been tested for building the US variant, and only on Linux.\n\nFor each asset it generates a random texture, except in special cases like text\nwhere it was possible to generate reasonable textures with open source tools.\nThe result is surprisingly playable.\n\nFuture work will support configurable and procedural generation of assets.\n\n\n.. image:: https://i.imgur.com/iiMPSTZ.png\n\n.. image:: https://i.imgur.com/5OsOH1F.png\n\n.. image:: https://i.imgur.com/yFI8WV2.png\n\n.. image:: https://i.imgur.com/jlXDyMJ.png\n\n\nPython Requirements\n-------------------\n\nTo run the asset generation script, the following requirements are needed.\n\n.. code:: bash\n\n   pip install kwimage opencv-python-headless ubelt numpy ruamel.yaml PyYAML scriptconfig rich parse\n\n\nPC Port Example Usage\n---------------------\n\nThe following instructions were written on an Ubuntu 22.04 PC\n\n.. code:: bash\n\n    # PC Port Dependencies\n    sudo apt install -y git build-essential pkg-config libusb-1.0-0-dev libsdl2-dev\n\n    # You can set your \"code\" directory path - the place where you will clone\n    # this repo - to be somewhere convenient for you\n    CODE_DPATH=$HOME/code\n\n    # Ensure your code directory exists\n    mkdir -p $CODE_DPATH\n\n    # Clone this repo\n    git clone https://github.com/Erotemic/sm64-random-assets.git $CODE_DPATH/sm64-random-assets\n\n    # Move into the root of this repo and initialize the sm64-port submodule,\n    # which will clone the official PC port repo.\n    cd $CODE_DPATH/sm64-random-assets\n    git submodule update --init tpl/sm64-port\n\n    # Run the asset generator\n    python $CODE_DPATH/sm64-random-assets/generate_assets.py --dst $CODE_DPATH/sm64-random-assets/tpl/sm64-port\n\n    # Move into the PC port directory\n    cd $CODE_DPATH/sm64-random-assets/tpl/sm64-port\n\n    # Compile\n    make NOEXTRACT=1 VERSION=us -j16\n\n\nThe compiled executable can now be run directly:\n\n.. code:: bash\n\n    # Run the executable\n    build/us_pc/sm64.us\n\n\nHeadless ROM Usage\n------------------\n\n.. code:: bash\n\n    # ROM-only dependencies\n    sudo apt install -y binutils-mips-linux-gnu build-essential git libcapstone-dev pkgconf python3\n\n    # You can set your \"code\" directory path - the place where you will clone\n    # this repo - to be somewhere convenient for you\n    CODE_DPATH=$HOME/code\n\n    # Ensure your code directory exists\n    mkdir -p $CODE_DPATH\n\n    # Clone this repo\n    git clone https://github.com/Erotemic/sm64-random-assets.git $CODE_DPATH/sm64-random-assets\n\n    # Move into the root of this repo and initialize the sm64 submodule,\n    # which will clone the official ROM-only sm64 repo.\n    cd $CODE_DPATH/sm64-random-assets\n    git submodule update --init tpl/sm64\n\n    # Run the asset generator\n    python $CODE_DPATH/sm64-random-assets/generate_assets.py --dst $CODE_DPATH/sm64-random-assets/tpl/sm64\n\n    # Move into the ROM-only sm64 directory\n    cd $CODE_DPATH/sm64-random-assets/tpl/sm64\n\n    # Compile\n    NUM_CPUS=$(nproc --all)\n    NOEXTRACT=1 COMPARE=0 NON_MATCHING=0 VERSION=us make -j$NUM_CPUS\n\n    # The compiled ROM is: build/us/sm64.us.z64\n\nThis ROM can now be flashed on an N64 cartage, copied onto an Everdrive, or run\nusing an N64 emulator (like Mupen64Plus). For instance, if you have Mupen64Plus\ninstalled (e.g. ``sudo apt install mupen64plus-qt``) you can run:\n\n.. code:: bash\n\n   mupen64plus build/us/sm64.us.z64\n\n\nN64 Limitations\n---------------\n\nOn real N64 hardware truly randomizing all textures will cause the system to\nlock up. This is because the N64 has 4 megabytes of RAM, and many of the\noriginal PNG textures are optimized to reduce their memory usage by having\nlarge continuous sections of the same color. Naively randomizing every pixel\ndoes not generate data well suited for PNG compression.\n\nI have verified that I cen enter every major stage and complete every bowser\nfight, so I think all of the crashes have been resolved by reducing texture\nsizes. I have completed a 16 star run on real N64 hardware with this.\n\n\nDevelopment\n-----------\n\nWhile I'll try to keep the above instructions working / maintained, the\n``build.sh`` script is the end-to-end entry point for developers. Starting from\na fresh repo, the ``build.sh`` script will take care of the entire process from\ninitializing submodules, generating assets, compiling the binaries, and even\nrunning them with the pc-port, in an emulator, or copying ROMs to an EverDrive.\nEnvironment variables can be used to control the build.sh behavior.\n\nThe following are several common examples:\n\n.. code::\n\n   # Build and run the PC port\n   TEST_LOCALLY=1 TARGET=pc ./build.sh\n\n   # Build and run the ROM in an emulator (m64py)\n   TEST_LOCALLY=1 TARGET=rom EMULATOR=m64py ./build.sh\n\nResources\n---------\n\n* Mupen64Plus Emulator: https://wiki.debian.org/Mupen64Plus\n\n* Python Frontend for Mupen64Plus: https://github.com/mupen64plus/mupen64plus-ui-python\n\n* Everdrive 64 X7: https://krikzz.com/our-products/cartridges/ed64x7.html\n\n* The SM64 Port: https://github.com/sm64-port/sm64-port\n\n* The SM64 Decomp: https://github.com/n64decomp/sm64\n\n* The SM64 Decomp Discord: https://discord.gg/DuYH3Fh\n\n* Kaze Emanuar ROM Hacks: https://www.notabug.org/anomie/kaze-emanuar-romhacks\n\n* High resolution redrawn textures: https://github.com/TechieAndroid/sm64redrawn\n\n* SM64 Randomizer: https://github.com/andrelikesdogs/sm64-randomizer\n\n* List of SM64 Hacks and Ports: https://en.wikipedia.org/wiki/List_of_Super_Mario_64_ROM_hacks,_mods_and_ports\n\n* SM64 plus: https://github.com/MorsGames/sm64plus\n\n* SM64 ex: https://github.com/sm64pc/sm64ex\n",
    "bugtrack_url": null,
    "license": "Apache 2",
    "summary": "The sm64-random-assets module",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/Erotemic/sm64-random-assets"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eef23c08006911659eb4b83eadfdc21c26a28e8e34c89266f3840a099b65afcc",
                "md5": "aee4237e4239dd84e420259b37053fac",
                "sha256": "300049974279ceab917ba80a524e68ea50fae814ad8dc78c50d76e46aedd8c8f"
            },
            "downloads": -1,
            "filename": "sm64_random_assets-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aee4237e4239dd84e420259b37053fac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 50366,
            "upload_time": "2023-07-29T02:13:04",
            "upload_time_iso_8601": "2023-07-29T02:13:04.980263Z",
            "url": "https://files.pythonhosted.org/packages/ee/f2/3c08006911659eb4b83eadfdc21c26a28e8e34c89266f3840a099b65afcc/sm64_random_assets-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "999a9ad4733a675b530d16fe171a04fdfbcc634a67a399cbf73c7abf85c1a99b",
                "md5": "b7a30119d69eb2d63fd18c0d7771db12",
                "sha256": "5a7ae8a725dfdd3867440524975b020d320eb98bba601a07c27cabf9c75b5374"
            },
            "downloads": -1,
            "filename": "sm64_random_assets-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b7a30119d69eb2d63fd18c0d7771db12",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 51686,
            "upload_time": "2023-07-29T02:13:15",
            "upload_time_iso_8601": "2023-07-29T02:13:15.204545Z",
            "url": "https://files.pythonhosted.org/packages/99/9a/9ad4733a675b530d16fe171a04fdfbcc634a67a399cbf73c7abf85c1a99b/sm64_random_assets-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-29 02:13:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Erotemic",
    "github_project": "sm64-random-assets",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "sm64-random-assets"
}
        
Elapsed time: 0.09207s