Git Product home page Git Product logo

attractor-wallpaper's Introduction

Space Invaders Emulator

This is a emulator of the classic arcade game, Space Invaders (1978), write in Rust.

Controls

'Z' is Shoot, 'Left' and 'Right' arrows to move, 'Return' for 1 Player Start button, and 'Backspace' for the 2 Player Button.

And for binary builds with the debug feature enable, press Escape to enter the debug mode.

debugger

When in debug mode, you can enter commands in the terminal:

  • run to exit the debug mode;
  • bp <HEX ADRESS> to place a breakpoint at an address;
  • runto <HEX ADRESS> to run until the given address.

Compile

To compile and run to Windows, Linux or macOS, run the command cargo run --release.

Or cargo run --release --features=debug to enable the intel 8080 debugger.

WebAssembly

To compile to WebAssembly, you can use wasm-pack with the command:

wasm-pack build --target web --out-dir ../pkg  ./space-invaders-wasm

You can run it in a webpage by starting a http server in the root directory. You can use python for that, for example:

py -m http.server

attractor-wallpaper's People

Contributors

rodrigodd avatar

Stargazers

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

Watchers

 avatar

attractor-wallpaper's Issues

Make the terminal not appear on Window

In principle, we only need to add #![windows_subsystem = "windows"] to the crate root to make it not spawn a terminal. But this would also make it not attach to the terminal it is called from, which makes the CLI more clumsy.

Ideally, we should also distribute a .cmd shim that calls the main binary and attaches it to its terminal. There are a couple of ways of doing this (I only remember the one used in mpv, right now), and I need to find out which one is better/easier to implement.

HDR support

Would be cool to make the gradient accept luminance values beyond the ones allowed by the sRGB color space (I am already using the OkLab color space), and render the attractor with HDR colors.

I am mainly thinking about adding effects like bloom to the final image, but I think this could also allow creating HDR wallpapers for HDR displays.

Test this on macOS

I don't have a macOS to test this on, so I cannot ensure that this is working there. But as far as I know, All crates used support macOS.

Split downsampling in two passes

The multi-sampling option works by multiplying each dimension of the attractor's aggregation buffer, and then downsampling it using a Lanczos kernel in the shader. It also applies the colormap to each pixel right before scalar-multiplying with the kernel, so each pixel is unnecessarily colormapped multiple times.

The problem is that the kernel grows quadratically with the multi-sampling order, making the rendering too slow to run in full real-time for a non-small multisampling value. But the kernel used is actually separable, so we can make the slowdown grow linearly by separating the downsampling into horizontal and vertical passes.

This was not first done, not only because it was easier to implement, but also because I was afraid of using really big intermediate textures (the current approach only uses a single texture for the output, and a u32 array for the input aggregate buffer). But this choice doesn't work well enough, so better to risk the alternative approach. The "too big textures" problem can at least be solved by splitting the rendering into tiles.

Handle DPI scalling

It seems like it's not doing great with my Macbook Pro's high dpi display. Looks to be half-sized, and the Configuration controls appear to be relative to the window (vs. the actual mouse position).

Originally posted by @jacobbarssbailey in #2 (comment)

Implement better dithering

Dithering is used to avoid banding artifacts in the smooth color gradient of the background. The current implementation of dithering were copied from Bevy's implementation. Not sure if I implemented it wrong, but it causes stripes for some color shadings.

It may be better change the dithering implementation. I have some done some tests in notebooks/dither.html.

The current implementation is in the shader script, more specifically here.

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.