GithubHelp home page GithubHelp logo

spelunky-fyi / playlunky Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 8.0 2.44 MB

Extended Mod Management for Spelunky 2 via dll injection

License: MIT License

CMake 1.04% C++ 47.54% C 50.82% Lua 0.61%
dll-injection modding spelunky-2

playlunky's People

Contributors

dregu avatar fienestar avatar gmjosack avatar malacath-92 avatar mauvealerts avatar mr-auto avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

playlunky's Issues

Modlunky launching through Discord

Everytime I try to run Playlunky it seems to always launch through discord. I'm able to tell because I'm not able to open the steam overlay, nor does it say I'm playing Spelunky on Steam, and it also has a Discord icon next to my name when I try to play online.

The issue started when I added Spelunky to my registered games on discord. It worked fine at first because I did that during the time I was playing it, however the next time I launched Playlunky, it would only launch through Discord.

I don't think it's related to any of the mods I currently have, I think the problem may stem from the discord_game_sdk.dll file that's in my folder. When I try to launch Playlunky or vanilla Spelunky with the discord_game_sdk.dll file deleted, Playlunky gives me the error that discord_game_sdk.dll was not found, while Spelunky just won't launch without it.

I've checked that it is reading the correct Spelunky installation.

Disabling speedrun mode doesn't fully work until restarting

  1. Enable some character and script mods
  2. Enable speedrun mode
  3. Open the game and then quit
  4. Disable speedrun mode
  5. Open the game (see that your enabled script mods are not loaded) and then quit
  6. Open the game once more, only now will script mods load

Keeps Crashing At the end of runs in Online mode (Everyone Dying)

First it happens on linux, so i went to windows to find that its happening here to! the title says it all. when ever everyone dies in online mode. the game crashes when trying to start over. i dont know how it happens but its annoying to continuosly open the game back up every time we lose in online

Possible memory leak with scripts mods on Linux under wine

Game version: 1.27
Wine version: 6.13
Playlunky: Nightly version from Oct 9th (playlunky_nightly_33E9D4A.zip)

I'll start by saying I know Linux is not officially supported. But I figured I'd report anyway in case it might be a simple fix.

Steps for a bugless execution

  • Install Spelunky via steam for linux.
  • Download Playlunky and extract it in the Spelunky directory (~/.steam/steam/steamapps/common/Spelunky 2/)
  • Create an empty directory called my-test-mod inside Mods/Packs/, and add it to load_order.txt.
  • Launch Playlunky via Wine (I've attached the script I use below, for the exact envvars).
  • Once the game reaches the Start Screen (the one with the art of Ana holding a torch), simply wait.

For me, here, the game sits at a healthy 5.7% memory usage. (monitored via htop)

Steps for the bug

  • Inside the directory called my-test-mod, place an empty file called main.lua.
  • Launch Playlunky via Wine again and, again, wait on the Start Screen.
  • This time there will be a "Playlunky ####-modified" watermark on the bottom left.

For me, here, the game starts at 5.9% memory usage and increases at a rate of approx 1% per minute (that's about 188MB/min) even if I just sit and stare at the start screen (no inputs, no changes).
After about an hour of gameplay, the game will run out of available memory and the OS starts swapping or crashes.

Further notes

  • I'm on Kubuntu 20.10
  • Sprite mods don't cause this problem, it's something specific to script mods.
  • At first I thought it was the script's fault, but then I tested with a completely empty script and the problem persisted, so I presume it's something in playlunky.
  • I don't experience this issue with scripts loaded via Overlunky (at least, not at this alarming rate).

Adding launch settings to play_launcher to support renaming Spel2.exe [enhancement]

Using hardcoded strings prevent the ability to alter the launch file names. I'm hoping to try something similar to what can be done with the stardew modding api to make it compatible for pc gamepass. The basics are your rename the base executable to something you know then rename the play_launcher.exe to Spel2.exe. This will allow the gamepass application to launch the renamed play_launcher (i have validated this works for launching it, it just crashes due to not finding spel2.exe). if i could tell play_launcher what exe is the original spelunky2 it should be able to chain.... i think. If it does work then we should be able to use mods with the gamepass/windows version of the game.

Mod Options panel has no scroll bar

The Mod Options panel has no visible scroll bar, even if the options extend past the bottom of the panel. This happens with script mods with a lot of options, such as Randomizer. Scrolling with the mouse wheel still works.

I believe this is being caused by the combination flag ImGuiWindowFlags_NoDecoration on the ImGui window:

ImGui::Begin(
"Mod Options",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoDecoration);

That flag is redundant with the others, since NoTitleBar, NoResize, and NoCollapse are already explicitly set on the window, so all it serves to do is add NoScrollbar.

Transparent entity sprites fail to merge

Some entity sprites crash the sprite merger if the wrong parts are empty, like the head icon thingy on percy_v2 and other pets. This is not very good for testing unfinished mods.

Don't premultiply cached/vanilla images

Thoughts from Discord:

  1. DDS files in the game are premultiplied alpha, but extraction does not un-premultiply when making PNGs (premultiplied PNG is not even a thing but whatever)
  2. Multiplying/Dividing the alpha is lossy and we can't really get an original PNG back that could be both loaded in PL and look right in an editor
  3. Playlunky is premultiplying all images from mods, cause they are likely PNG and not premultiplied
  4. Playlunky is also premultiplying the cached vanilla files it extracted when stitching entity sheets or sprite maps, which is bad and any unmodified parts get premultiplied twice in the end
  5. Using any mods that custom sprite map to items.png will break all the other items because of 4
  6. There might even be a feedback loop so files in the cache get premultiplied again and again

Solutions:

  • Modlunky could predivide alphas when extracting, but it's not going to look the same when premultiplying again
    • We could just say the extracted PNG files are premultiplied and anyone who uses very transparent parts as base for their mods is stupid
  • Playlunky definitely shouldn't divide or premultiply cached (vanilla) files ever, only premultiply user-provided files once before caching or stitching
    • Disabling premultiplication in PL will load extracted vanilla PNG files correctly, but this is obviously a useless feature

I tried to undo the premultiplication and then load the textures again in PL https://imgur.com/a/Z4ToeAS
I extracted the divided textures with this modification but nothing looks quite right either way...

def dds_to_png(data):
    """Takes a .DDS `Image` and returns .png data."""
    img = Image.open(io.BytesIO(data))
    px = img.load()
    width, height = img.size
    for i in range(width):
        for j in range(height):
            if px[i, j][3] != 0:
                R = int(255.0 * px[i, j][0] / px[i, j][3] + 0.5)
                G = int(255.0 * px[i, j][1] / px[i, j][3] + 0.5)
                B = int(255.0 * px[i, j][2] / px[i, j][3] + 0.5)
                a = px[i, j][3]
                px[i, j] = (R, G, B, a)
    new_data = io.BytesIO()
    img.save(new_data, format="PNG")
    return new_data.getvalue()

Originally posted by @Dregu in spelunky-fyi/modlunky2#304 (comment)

Sticker generator woes

A lot of editors and therefore character mods use transparent as rgba(255,255,255,0), although the game and presumably playlunky expect rgba(0,0,0,0). This causes the sticker generator to put all white squares instead of characters in the quick select etc... You should make sure all transparent or near transparent pixels are converted to black or weird things happen.

Also the custom tile positions (8x14 and 8x15, presumably 0-indexed XxY) for sticker and journal graphics make no sense. I assume you meant the two-or-so tiles to the right of petting, but currently they're both using 8x14, journal just using a larger area of it. 8x15 is not even possible. Exact pixel coordinates would be nice.

Playlunky tab won't load

No idea what I'm doing, so I could just have done something wrong. All I did was download modlunky 2, put it in the spelunky 2 folder, and run it. The Playlunky tab won't load and this is the error message

2022-08-31 17:18:06,126: Failed to register tab Level Editor: Traceback (most recent call last):
File "modlunky2\ui__init.py", line 429, in register_tab
File "modlunky2\ui\levels\tab.py", line 86, in init__
TypeError: unsupported operand type(s) for /: 'NoneType' and 'str'

playlunky_installer is very broken

Doesn't work at all if you drag a zip from outside the game folder, like Downloads, even if the installer is in the game folder. ("Not running from game folder...")

It also flattens the directory structure when unzipping, breaking anything more advanced in the process.

Just remove the whole thing, cause nobody even knows it exists and modlunky actually works.

calling draw_text_size on script load/games start returns garbage

Essentially if you use draw_text_size outside of any callback or in ON.LOAD callback, it will return some garbage

this seams to be only PL issue as it loads the scripts as soon as the game starts (i think?)
could be also OL thing if you use the on start script loading, but i dint test it

Hundun slows down every restart?

I recently tried checking something and noticed that Hundun seemed slow. In this video:

  • Start adventure mode, attach x64dbg just to edit theme_start, then detach
  • No mods are loaded
  • No pre-existing playlunky.ini nor imgui_playlunky.ini
  • Launched via Modlunky2
  • Nightly, version 08e0cab-modified. Specifically the playlunky_nightly_C0C88C3.zip released at 2023-01-04T15:53:42Z

This doesn't reproduce with:

  • Stable
  • or with Speedrun Mode enabled
  • or resetting in Dwelling

Looking for a tool to emit the game state to external program

Hello.
I want to make a bot but I'm not a C++ programmer, not experienced in DLL injecting, etc. I've googled a lot about all versions of Spelunky, Game Maker, Cheat Engine, etc. but found nothing usable for me.
Is it possible to make a tool that just runs in parallel with a game and continuously (for example N times per second or on events happening) prints the game state (configurable subset of it) to STDOUT? Like the game map, coordinates and speeds of myself and enemies, all the items. So I would just feed it to my bot and then send the key press messages.

Playlunky does not load soundbank files

Some users reported that soundbank files do not get loaded by Playlunky, aka mods with soundbanks will have to be packed with modlunky.
I haven't investigated this yet, so not sure if it is possible to fix.

Transition tiles do not connect properly

When the game is launched through Playlunky, the tiles in transitions don't connect properly. Tiles that are supposed to be 2-tall connections draw only the bottom half twice. Or it could be that a bottom half of a connection tile is being used in random places instead of just with its top half.

char_character_full sticker issues

when loading a char_character_full via playlunky, everything works as expected, however, autogenerated stickers for other characters no longer work, making me a tad bit confused as to which characters i have installed or not. Thanks for all of your amazing work!

Patched exe

2021-07-15 01:19:40,484: You're using Playlunky against a patched exe. For best results use Playlunky on a vanilla exe

i don't have a vanilla exe how do i use Playlunky without it?

Deleting mods will not correctly force a refresh of affected assets.

For example, if a mod A replaced strings00.str, while another mod B ships strings00_mod.str Playlunky will generate a strings00.str file in Packs/.db If the user now deletes mod A they would expect to have Packs/.db/strings00.str be regenerated from the original strings file. However that file stays untouched and the user witnesses a ghost of mod A.

This version of Spelunky 2 is not supported by playlunky Error upon launch

For the last few days when i launch Playlunky using Modlunky 2 I get the following error:

This version of Spelunky 2 is not supported by playlunky, please update you game or check if there is a new version of Playlunky Available.

Spelunky Version: could not be verified
Supported Version 1.25.2

Press OK to start without Playlunky or Cancel to yolo

If you press Cancel it does not load any mods but the game plays and loads from the steam install:

Mods in use:
Co-op shared Camera

I think this has to do with the Spelunky 2 August Patch?

Is there anything that can be done? My wife and her sister have 900+ hours into the game and play it everyday... but will not play without this mod. I am hoping to fix it soon for them to play.

Thanks all.

Feature Suggestions & Backlog

This is just a rough backlog on what would be interesting to look at, it's not a guarantee that any of this makes it into Playlunky. The list is in order of priority. Please comment here if you have any other suggestion for features. As soon as someone decides to work on one they should open a separate issue for it and probably make a feature branch, you know, git etiquette..
The list is written from a developer perspective, so might not make sense to a user. Some points might be more fitting for the game-api or meta, but fret not, this is just a random list so it's allowed to contain illogical stuff.

  • Shuffle level gen mods
  • Add PRE/POST transition level generation
  • Create an interface to load Playlunky and only convert mods to a packable state
  • More enums instead of magic numbers
  • Level-Gen: biome-specific floor tile codes
  • Level-Gen: pass spawned entities to post_tilecode
  • Option to block saving the game to savegame.sav
  • Shipping mods with savegame.sav, loading from that and saving to it
  • Option to disable achievements
  • More sample mods
  • Multithread some mod init?
  • Changing constellation names
  • Adding new characters
  • Adding new entities
  • Some magic to help figuring out whether a character mod was renamed and thus adjusting which char some code affects

In Review:

Done:

  • Hitbox utilities (for draw functions and overlap checks)
  • Add draw functions to a context
  • Bug: Korean language mod can't be unzipped
  • Bug: Audio data is currently copied for no reason (needs 16 byte padding left and right to avoid)
  • Bugfix: Don't print script errors a billion times
  • Bugfix: Add pet menu sprite to pet entity sheets (credit to gmjosack)
  • Bugfix: Sprite settings invalidate cache
  • Bugfix: Cap num messages from scripts
  • Bugfix: Bind old and new entity sheets for pets/mounts
  • Bugfix: Scaled input for stickers
  • Bugfix: Still some duplicate messages
  • Level-Gen: Procedural entity placement hooks
  • Level-Gen: Post-Room-Gen hook
  • Level-Gen: Post-Level-Gen hook
  • Add getters for character def (name, heart color)
  • on_entity_spawn
  • spawn_liquid
  • Adding new in-engine textures
  • Gender control for characters
  • Hot-reload heart color
  • Per-mod save data API
  • Extended API for existing audio spelunky-fyi/overlunky#67
  • Shipping with custom tile mapping data
  • load order == script execution order
  • Less visible watermark during gameplay
  • Watermark during gameplay only if non-character mods
  • Speedrunning support (speedrunner mode)
  • Modify char name in main menu
  • Changing character heart colors
  • Basic Level Gen API

Playlunky doesn't work for me.

When I try to run "playlunky_installer.exe" nothing happens, even when I run it as administrator I've tried with several versions:
nightly
stable
0.16.1
0.11.0
The problem continues even if I run it with Modlunky or without.

(I use DeepL Traductor so..)

patched exe error message

I'm running into this problem where it keeps telling me "You're using Playlunky against a patched exe. For best results use Playlunky on a vanilla exe." but i've already validated the game files and haven't modded the game files at all. does anyone know how to help?

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.