Pitch-perfect copy of map generation algorithm from Slay the Spire

Overview

sts_map_oracle

Pitch-perfect copy of map generation algorithm from Slay the Spire

Usage

Prints out map layouts in console for given seed:

sts_map_oracle.exe --seed 673465884448

To save maps in given directory in JSON format:

sts_map_oracle.exe --seed 673465884448 --path C:\maps\

Download

https://github.com/Ru5ty0ne/sts_map_oracle/releases/

Output example

Act 1


14     R  R        R     R
         \|      / |   /
13        ?     M  M  M
            \     \  \  \
12           R     M  E  ?
           /   \   |  |/
11        ?     ?  E  ?
          |     |  |  | \
10        M     M  R  $  R
          |   /      \|  |
9         M  R        M  E
          |  |        |/ |
8         T  T        T  T
          |  |      / |  |
7         M  E     M  ?  M
          |  |       \| \|
6         E  M        M  ?
        /    |      /   \|
5      R     E     M     E
         \     \ /     / |
4         M     ?     M  ?
          |     | \ /  / |
3         M     M  M  M  ?
        /     /  /  /  /
2      $     M  ?  $  ?
         \     \|/  /
1         M     M  ?
        /     /      \
0      M     M        M


Act 2


14     R  R  R  R
       |/   \|/
13     E     $
       | \ / | \
12     ?  M  ?  M
       |  | \|    \
11     ?  M  ?     E
       |/    | \ /
10     M     ?  M
       | \ /      \
9      E  M        R
       |  |      / |
8      T  T     T  T
       | \| \ /      \
7      R  E  R        R
       |/ |/            \
6      $  M              E
       | \| \            |
5      E  R  E           R
       |/    | \       /
4      M     M  $     M
       | \     \  \ /
3      ?  M     ?  ?
       | \|   /    | \
2      ?  M  ?     M  M
         \| \|   /      \
1         M  M  ?        M
        /  /      \    /
0      M  M        M  M


Act 3


14     R  R        R  R
       |  |      /    | \
13     ?  E     ?     M  M
       |/     /       |/
12     $     R        E
       | \ /          | \
11     E  M           M  M
       |  | \       /  /
10     M  E  M     ?  ?
         \|  |     |  |
9         ?  M     ?  ?
        / |  |     |    \
8      T  T  T     T     T
       | \  \  \ /     /
7      R  R  $  M     ?
       |  |/    |   /
6      E  M     R  E
       |/   \ /   \  \
5      R     E     E  R
       | \     \     \  \
4      ?  M     M     ?  M
       |  |     | \ /  /
3      M  ?     ?  M  M
         \|       \| \  \
2         M        M  M  $
          |      / |    \|
1         M     M  ?     M
        /     /      \ /
0      M     M        M
Comments
  • Split into library and thin CLI wrapper

    Split into library and thin CLI wrapper

    Hi! I recently found this after I started working on a map analyzer toy project, and thought it'd be neat if I could use this as a library to generate the map from a given seed. Unfortunately, right now all the code is in the binary module, so it can't really be used as a library.

    This series of changes restructures the code a bit, mainly splitting it into a core library module and a thin CLI wrapper. I've also restructured a few of the top-level functions into primarily returning data, and split out the print statements into separate functions. This enabled me to do stuff like this, which uses this project as a WebAssembly library to generate the map.

    Would you like this?

    opened by emlun 5
  • Tests, stable Rust, and some intrusive refactorings

    Tests, stable Rust, and some intrusive refactorings

    This includes everything in #2 and #3, and also adds a few questionable "improvements" that are definitely down to subjective taste, and some (962dd49a25f27d61be2fed1ce27a16ab6d8ee1fe, 564e686be4bbb808db14b1f4e4d2dd26c7185e4b) significantly change how parts of the program works. Again, you're welcome to cherry-pick whatever you want from here and ignore whatever you don't like.

    opened by emlun 3
  • Map generation sometimes seems to be wrong?

    Map generation sometimes seems to be wrong?

    Thank you for accept my pull request!

    By the way, map generation by this tool sometimes seem to be wrong. for example,

    sts_map_oracle --seed 673465884448
    

    (673465884448 is AGCK93XT)

    Act 2
    
    
    14     R  R  R  R
    (----snip----)
    2      ?  M  ?     M  M
             \| \|   /      \
    1         M  M  ?        M
            /  /      \    /
    0      M  M        M  M
    

    It should be below. (My StS version is 12-22-2020, and don't use MOD)

    Act 2
    
    
    14     R  R  R  R
    (----snip----)
    2      ?  M  ?     M  M
             \| \|   /      \
    1         M  ?  ?        M
            /  /      \    /
    0      M  M        M  M
    

    I compared logic of room count in StS and sts_map_oracle.

    ◆ Slay the Spire decompiled

    /*  630 */     int count = 0;
    /*  631 */     for (ArrayList<MapRoomNode> a : map) {
    /*  632 */       for (MapRoomNode n : a) {
    /*  633 */         if (!n.hasEdges() || 
    /*  634 */           n.y == map.size() - 2) {
    /*      */           continue;
    /*      */         }
    /*  637 */         count++;
    /*      */       } 
    /*      */     } 
    /*      */ 
    /*      */ 
    /*      */     
    /*  643 */     generateRoomTypes(roomList, count);
    

    ◆ current sts_map_oracle logic

    let count = map
        .iter()
        .flat_map(|row| row.iter())
        .filter(|n| !n.edges.is_empty() && n.y as usize != map.len() - 1)
        .count();
    let room_list = generate_room_type(&room_chances, count);
    

    But, filter condition of sts_map_oracle should be below

     .filter(|n| ((!n.edges.is_empty() || (n.y as usize == map.len()-1 && !n.parents.is_empty())) && n.y as usize != map.len()-2))
    

    Can I send Pull Request?

    opened by kojim 1
  • Tests, stable Rust, and various refactorings

    Tests, stable Rust, and various refactorings

    This includes everything in #2, and also adds a bunch of refactoring. I personally think these refactorings all seem worthwhile, but in the end it's a matter of taste, so you're welcome to cherry-pick whatever you like and ignore whatever you don't like.

    opened by emlun 0
  • Add tests and make compatible with stable Rust

    Add tests and make compatible with stable Rust

    This first adds a couple of regression tests, and then changes a few math operations from unchecked to wrapping math. This eliminates the need for the unchecked_math feature, and thus the need to compile with nightly Rust, and still passes the tests. :slightly_smiling_face:

    opened by emlun 0
Releases(v1.1.0)
Owner
Rusty 0ne
I'm Rust lover, GitHub newcomer and pasta devourer.
Rusty 0ne
FlatBuffers compiler (flatc) as API (with focus on transparent `.fbs` to `.rs` code-generation via Cargo build scripts integration)

FlatBuffers flatc API for Rust This crate provides a programmatical way to invoke flatc command (e.g. from build.rs) to generate Rust (or, in fact, an

Vlad Frolov 87 Dec 22, 2022
enum-map enum-map xfix/enum-map [enum-map] — An optimized map implementation for enums using an array to store values.

enum-map A library providing enum map providing type safe enum array. It is implemented using regular Rust arrays, so using them is as fast as using r

Konrad Borowski 57 Dec 19, 2022
Slay the Spire save deobfuscator / reobfuscator

SpireSaver This is a command-line Slay the Spire save file deobfuscator / reobfuscator that I threw together in a couple of hours. I used andrewsnyder

null 2 Oct 11, 2022
SelfOrgMap 5 Nov 4, 2020
Suite for automatically testing algorithm questions from the Polish Algorithm Olympiad.

oisuite Your number #1 tool to managing your algo questions! This software only works on UNIX-based operating systems (macOS, Linux, BSD, etc.) Projec

null 3 Nov 25, 2021
Pixel-Perfect, 2D Renderer for Bevy that Seamlessly Targets Desktop and Web

bevy_retro ( Screenshot of Bounty Bros. game made with Bevy Retro and Skip'n Go ) Bevy Retro is a 2D, pixel-perfect renderer for Bevy that can target

Katharos Technology 224 Dec 23, 2022
Pixel-perfect integer scaling for windowed applications

integer-fullscreen Pixel-perfect integer scaling for windowed applications. Usage Run the program. Move your cursor to a window you would like to get

Cecile Tonglet 6 May 23, 2021
A simple camera for properly displaying tile-based low resolution pixel perfect 2D games in bevy.

Bevy Tiled Camera A simple camera for properly displaying low resolution pixel perfect 2D games in bevy. The camera will adjust the viewport to scale

sark 10 Oct 5, 2022
Generate perfect code headers every time.

Generate perfect code headers every time.

t11s 111 Dec 28, 2022
✨ A perfect template for a binary rust project.

Rust Template A project template for Rust, helping to structure your projects blazingly fast ⚡ . Features ?? Code-ready for binary projects. Add amazi

bwtecode 3 Aug 21, 2022
A principled BSDF pathtracer with an abstracted backend. Perfect for rendering procedural content.

This is a port of the excellent GLSL_Pathtracer to Rust utilizing an abstracted, trait based backend. Perfect for rendering procedural content. Rust F

Markus Moenig 5 Nov 23, 2022
Generate perfect Vyper compatible code headers every time.

headers-vy Generate perfect Vyper-compatible code headers every time. Build You need Rust and Cargo installed on your machine. See the installation gu

t11s 15 Feb 12, 2023
The frequency-perfect synthesizer for a PC-speaker

?? BeeSynth Project The frequency-perfect synthesizer for a PC speaker ✔️ Features Written in Rust ?? Support playing MP3, WAV, FLAC, tracker music an

Александр 9 Jul 17, 2023
With Dejavu, you can have a perfect memory by capturing and organizing your visual recordings efficiently.

Dejavu The content in README.md is assisted by ChatGPT. Overview Dejavu is an open-source, cross-platform tool designed to help you record and search

Zhou Zhiqiang 127 Jul 31, 2023
A perfect smoother; A discrete time version of spline smoothing for equally spaced data

Whittaker Smoother Aka Whittaker-Henderson, Whittaker-Eilers Smoother is known as the perfect smoother. Its a discrete-time version of spline smoothin

Mathis Wellmann 3 Aug 12, 2023
Rust implementation of the PTHash perfect hash function for static compile-time generated hash tables

QuickPHF QuickPHF is a Rust implementation of the PTHash minimal perfect hash function algorithm. It consists of two crates: quickphf - runtime code f

Darko Trifunovski 11 Oct 20, 2023
Smooth pixel-perfect camera for Bevy

bevy_smooth_pixel_camera A bevy plugin that adds a simple smooth pixel camera. The smoothing is based on this video from aarthificial which explains h

Doonv 9 Nov 14, 2023
A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator

tmux-thumbs A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints. Usage Press ( prefix + Space

Ferran Basora 598 Jan 2, 2023
A CLI utility to secretly copy secrets to your clipboard. 🦀

seclip ?? ?? A CLI utility to secretly copy secrets to your clipboard. ?? Table of Contents Features Installation Usage Build From Source Contribution

Mufeed VH 34 Dec 27, 2022
Zero-Copy reading and writing of geospatial data.

GeoZero Zero-Copy reading and writing of geospatial data. GeoZero defines an API for reading geospatial data formats without an intermediate represent

GeoRust 155 Dec 29, 2022