Conversation

i shoud start optimizing oneshot/equinox’s engine

2
0
0
long, optimizing the oneshot engine
Show content

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)

1
0
0
re: long, optimizing the oneshot engine
Show content

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.

0
0
0
link to github
Show content

@thing its open source actually! https://github.com/elizagamedev/mkxp-oneshot

also im making my own version from scratch called equinox

2
0
0

@thing just keep in mind parts of the repo (in particular the “journal” folder) contain spoilers

0
0
0
re: link to github
Show content
@kemona_halftau @thing how much stuff is in the (free software) engine vs in the (proprietary) game itself? (as in is it mostly data in the game or code)

(I would play oneshot if it was free/libre software)
1
0
2
re: link to github
Show content

@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)

2
0
2
re: link to github
Show content

@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

1
0
1
re: link to github
Show content

@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

0
0
1
re: link to github
Show content
@kemona_halftau @thing maybe I should play it then. is it playable on wayland? I heard there were some issues with that (I can't easily use X11 because Alpine dropped support for Plasma on X11 and I could never get it to work on Guix either)
1
0
2
re: link to github
Show content

@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

1
0
2
re: link to github
Show content
@kemona_halftau @thing guix and alpine both dropped plasma 5 so I can't really use that (actually I'm not sure guix ever had it, for a long time plasma wasn't packaged at all)
1
0
1
re: link to github
Show content

@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

2
0
1
SPOILERS SPOILERS SPOILERS
Show content

@noisytoot @thing it will not be able to set your wallpaper, though

1
0
1
re: link to github
Show content
@kemona_halftau @thing please do send the window rules
1
0
1
re: link to github
Show content

@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

1
0
1
re: link to github
Show content

@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)

1
0
1
re: link to github
Show content

@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

2
0
1
re: link to github
Show content

@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.

2
0
1
re: SPOILERS SPOILERS SPOILERS
Show content
@kemona_halftau @thing I think I can fix that by patching it to use dbus-send instead of qdbus
1
0
1
re: link to github
Show content
@kemona_halftau @thing I got it to work! I patchelf'd the appimage so I could use --appimage-extract to extract the data and deleted usr/bin/oneshot (since I'm using my own build) and usr/bin/_______ (since I'm running the free reimplementation of it separately). My engine was linked against the wrong version of ruby so it was crashing but I fixed that by hardcoding the path to libruby-static.a and adding the transitive dependencies (libm, libcrypt, and libgmp) to target_link_libraries. (The build process I used is really messy and definitely not the correct way to do things but it works for me)
0
0
1
re: link to github
Show content

@noisytoot @thing the source code for the journal should be in the /journal/unix directory

1
0
1
re: link to github
Show content

@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

2
0
1
re: link to github
Show content
@kemona_halftau @thing I managed to extract it by using patchelf to change the interpreter so it would run, but thanks anyway
0
0
1
re: link to github
Show content
@kemona_halftau @thing thanks, somehow I missed that. this should work better than the fork I found that looks for the pipe in the wrong place
1
0
1
minor spoilers but necessary for fixing the journal, re: link to github
Show content

@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)

2
0
1

@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

1
0
1
re: minor spoilers but necessary for fixing the journal, re: link to github
Show content

@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

1
0
1

@noisytoot @thing oneshot works best with x11/xwayland

1
0
1
spoilers about a game mechanic
Show content

@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

0
0
1
@kemona_halftau @thing I have two monitors and one (the external monitor that I mainly use) is correctly shown because it's unscaled while the other (the internal display) is shown as 1600x900 when it's actually 1920x1080 due to 120% scaling
1
0
1

@noisytoot @thing in that case, while playing oneshot, i suggest only having one monitor connected

0
0
1
re: SPOILERS SPOILERS SPOILERS
Show content

@noisytoot @thing the file you need to patch is in /binding-mri/wallpaper-binding.cpp

2
0
1

@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

1
0
1
@kemona_halftau @thing if the assets are portable then I can take them from the windows zips
1
0
1

@noisytoot @thing you should be able to, i just cant remember if the windows itch.io build is up to date or not

1
0
1
re: SPOILERS SPOILERS SPOILERS
Show content

@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.

1
0
1

@noisytoot @thing ooh, have you ran the game yet?

1
0
1

@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

1
0
1
@kemona_halftau @thing yes, I was playing it for the last few hours and it seems to be working fine
0
0
1

@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

1
0
1
@kemona_halftau @thing the only mention of the string "Windows-31J" is in Data/xScripts.rxdata, where it's present in the windows version but not in the older appimage version (and I haven't noticed anything being immediately broken by this). Windows-31J/CP932 is backwards compatible with ASCII, so does this even matter?
1
0
1

@noisytoot @thing probably not, its likely just due to ruby version differences

0
0
1