(kemona_halftau)
i shoud start optimizing oneshot/equinox’s engine
(kemona_halftau)
one of the laggiest aspects of oneshot’s engine (and probably other rpgmakerxp games) is map refreshes
so every time a variable, switch, or self-switch is modified, the entire map and all events within the map get “refreshed”
a refresh basically just means looping through all events and deciding which event page to use, and if the event page changes, reloading the event
an easy optimization to make here would just be to have a table of each variable/switch an event depends on associated with all events which would need to be refreshed if said variable/switch changes, and then only reload events whose self-switches change, rather than all events (since self-switches are specific to a single event)
(kemona_halftau)
another (relatively easy) optimization to make is in event collision data. the large sparkly phosphor shrimp pools in the beginning of the game are a good example of this. the reason you cant walk into them despite them being a single event is because they have collision data. (even though the devs could probably have used invisible tiles on the topmost layer to prevent the player from walking inside of them, since the pools can’t move)
this collision data is an array of coordinates that looks like this (see attached image). whenever an event needs to decide whether it’s intersecting with another event, it has to loop through all of these coordinates to check to see whether any of these coordinates happens to be the relative coordinates between the 2 events. this happens even if the other event is nowhere near the shrimp pool.
there are a few ways i could optimize this.
(kemona_halftau)
@thing its open source actually! https://github.com/elizagamedev/mkxp-oneshot
also im making my own version from scratch called equinox
(kemona_halftau)
@thing just keep in mind parts of the repo (in particular the “journal” folder) contain spoilers
(kemona_halftau)
@noisytoot @thing the proprietary portion is basically just all of the assets (the tilemaps, dialog, sprites, sounds, etc.)
both the c++ and ruby portion of the engine are fully open-source
there are also a few times when ruby code is invoked by level data from an event script, technically making it proprietary (or technically source-available), but theyre usually limited to a few lines
also there are a couple of non-free dependencies but afaik theyre all optional (e.g. steam integration)
(kemona_halftau)
@noisytoot @thing the developer permits “fanworks” “as long as credit is given” (in fact theyre “welcomed and encouraged”), but it is unclear which portions that applies to
(kemona_halftau)
@noisytoot @thing i was considering making a game within my equinox engine (my c#/javascript port of oneshot’s engine) using exclusively free assets (public domain, creative commons, etc) and original maps/characters/story, but i am not creative enough for it to be anything more than a test room with a few events
(kemona_halftau)
@noisytoot @thing it works best on x11, although it also worked for me on wayland, surprisingly! although the game does some things to your desktop shell which only work on a handful of desktop environments, so i recommend using a desktop environment out of the ones supported by the game (e.g. kde plasma 5 (6 didnt work for me because it drops qdbus5), xfce, cinnamon, lxde, and a few others)
i played oneshot in swaywm/swayfx (wayland) and it worked perfectly, except for the parts where it interacts with the desktop environment itself
(kemona_halftau)
@noisytoot @thing in that case, you can probably still use plasma 6 in wayland
some things will be broken, but i fixed one of the things with window rules, i can send them if you’d like
(kemona_halftau)
@noisytoot @thing it will not be able to set your wallpaper, though
(kemona_halftau)
@noisytoot @thing here they are
the dpi scaling rule is only necessary if you have a hidpi display, since otherwise the game window will be very tiny
(kemona_halftau)
@noisytoot @thing if you have any problems with the game (e.g. crashing or giving an error on startup) please let me know, because the official itch.io appimage linux version never worked for me without some manual patching (but its fairly easy to fix)
@kemona_halftau @thing I can’t even run the appimage (I assume because /lib64/ld-linux-x86-64.so.2 doesn’t exist at that path on my system)
> ./OneShot.appimage
exec: Failed to execute process './OneShot.appimage': The file exists and is executable. Check the interpreter or linker?
I compiled the engine yesterday (it required some patching to get it to build without conan) so I just need to extract the files from the AppImage somehow and then I can run it with the engine I compiled myself
@kemona_halftau @thing Actually is the journal free software? The mkxp-oneshot repo contains build instructions but seemingly no source code. There is, however, this reimplementation that I will try to use.
Although, I’ll need to find another way to extract the image files:
First, aquire a copy of the Windows-version journal executable. Next, download ResourcesExtract and run it, either via Wine or from a Windows install. Set the filename to the journal executable and the destination to the images directory in your local copy of this repo. Set the program to extract only bitmaps, then press Start. Once extraction completes run the included Python script renameandconvert.py (requires ImageMagick), which will create the required PNGs.
I don’t want to run a proprietary Windows program to do this.
(kemona_halftau)
@noisytoot @thing the source code for the journal should be in the /journal/unix directory
(kemona_halftau)
@noisytoot @thing ./OneShot.AppImage --appimage-extract should extract the appimage into ./squashfs-root/, from there all the game assets are in usr/bin/ just sitting there
if you dont want to run that (although i dont think it actually runs anything inside the appimage to do that), i can send you my squashfs-root
(kemona_halftau)
@noisytoot @thing one thing you should check for after compiling the journal is to see if youre able to move it around the screen by clicking in the middle of the window and dragging
if you cant do this youll need to force qt to run with the xcb backend by setting an environment variable (QT_QPA_PLATFORM=xcb) (the game invokes the journal at times, so youll need to run the game itself with that environment variable, in addition to the times when you need to run the journal directly, both cases happen during a normal run)
(kemona_halftau)
@noisytoot @thing an easy way to check to see if the journal will work at all under a wayland compositor implementing xwayland is to use an x11 program like xeyes, open another x11 window, move both of them around, and ensure xeyes properly follows your mouse pointer along the screen
if the eyes do not account for the different window positions, it probably won’t work (it seemed to work fine for me in all the wms ive tested, with the exception of niri)
also run xrandr in a terminal and make sure your monitor’s resolution is correctly shown
@kemona_halftau @thing instead of using pyinstaller to turn the journal into a binary I just replaced it with a script that cd’s to the right directory and execs python so I can put environment variables in there, but it seems to be already using xwayland (qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "")
does oneshot itself need to be using xwayland too? I have SDL_VIDEODRIVER=wayland set so it’s using wayland currently
(kemona_halftau)
@noisytoot @thing oneshot works best with x11/xwayland
(kemona_halftau)
@noisytoot @thing it needs to know where the window is on the screen
wayland doesnt allow native clients to tell where a window is on the screen, only x11/xwayland does
(kemona_halftau)
@noisytoot @thing in that case, while playing oneshot, i suggest only having one monitor connected
(kemona_halftau)
@noisytoot @thing the file you need to patch is in /binding-mri/wallpaper-binding.cpp
(kemona_halftau)
@noisytoot @thing i dont know why i just now received that
(kemona_halftau)
@noisytoot @thing i just remembered, the linux appimage is very out of date (its a build from 2020) and is probably missing some assets the (newer) source repo might depend on
i think i remember the devs saying they couldnt update the linux version because of build problems
worst-case, you can revert to a commit from before 2021, although youd have to redo all of your patches
(kemona_halftau)
@noisytoot @thing you should be able to, i just cant remember if the windows itch.io build is up to date or not
@kemona_halftau @thing I did this:
diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp
index 344825b..cf02998 100644
--- a/binding-mri/wallpaper-binding.cpp
+++ b/binding-mri/wallpaper-binding.cpp
@@ -330,7 +330,7 @@ end:
boost::replace_all(concatPath, "\\", "\\\\");
boost::replace_all(concatPath, "\"", "\\\"");
boost::replace_all(concatPath, "'", "\\x27");
- command << "qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:" <<
+ command << "dbus-send --session --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:" <<
"var allDesktops = desktops();" <<
"for (var i = 0, l = allDesktops.length; i < l; ++i) {" <<
"var d = allDesktops[i];" <<
@@ -426,7 +426,7 @@ RB_METHOD(wallpaperReset)
}
} else if (desktop == "kde") {
std::stringstream command;
- command << "qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:" <<
+ command << "dbus-send --session --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:" <<
"var allDesktops = desktops();" <<
"var data = {";
// Plugin, picture, color, mode, blur
I don’t know if it works or not. It hasn’t changed my wallpaper yet but maybe I just haven’t reached a point in the game where it does that.
(kemona_halftau)
@noisytoot @thing ooh, have you ran the game yet?
(kemona_halftau)
@noisytoot @thing in that case id suggest trying to revert some of the newer commits (there are only a few) at least until 4f4b43dbf31f0d3a9ddbb5ffcad98b51f6932c5a, since the commit after that (“Localized Niko Name Checks”, 34f08e10c3c9a8aacf5e16f86cd9ad291226217d) reads from a localization entry which did not seem to exist back then, and it might cause unexpected behavior early on in-game
@kemona_halftau @thing I don’t think it actually broke anything except if you inputted a matching name but I reverted it anyway now.
I tried loading the windows assets and it spams ruby: warning: failed to load encoding (Windows-31J); use ASCII-8BIT instead on startup
(kemona_halftau)
@noisytoot @thing probably not, its likely just due to ruby version differences