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
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
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
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
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Beka Modebadze 24 Dec 29, 2022
Copy Translator 是使用Rust编写的翻译小工具,使用DeepL翻译

Copy Translator Copy Translator 是使用Rust编写的翻译小工具 特点 程序大小12MB,极其轻量 自动去除多余的换行和断句,优化PDF翻译体验 选中即翻译(划词翻译),专注论文阅读 使用DeepL进行翻译,翻译效果极佳 使用说明 工具仅一个exe,启动后会驻留后台,选

zu1k 1k Jan 7, 2023
Rust wrapper for Eclipse iceoryx™ - true zero-copy inter-process-communication

iceoryx-rs Experimental rust wrapper for the iceoryx IPC middleware. clone and build The iceoryx repo is include as git submodule, therefore keep in m

null 43 Jan 4, 2023
Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Jerel Unruh 70 Dec 13, 2022
A trash-cli copy, but this time in Rust.

trash-rs A trash-cli copy, but this time in Rust. TODO Deletion Relative paths * functionality List files Include in Metadata: Original directory Date

null 1 Nov 23, 2021
Terra Trophies is a copy of Ethereum's POAP project for Terra

Terra Trophies Terra Trophies is a copy of Ethereum's POAP project for Terra. It allows anyone to create digital badges for participants of events, or

larry.{ust,sol,thor} 18 Dec 7, 2022