Giter Site home page Giter Site logo

astrabit-st / luminol Goto Github PK

View Code? Open in Web Editor NEW
90.0 9.0 11.0 36.86 MB

An RPG Maker XP-VX Ace rewrite, written in Rust with love ๐Ÿ’•

Home Page: https://luminol.dev/

License: GNU General Public License v3.0

Shell 0.11% Rust 97.51% WGSL 0.86% JavaScript 1.16% Batchfile 0.09% HTML 0.27%
editor game-editor rpg rpg-maker rpg-maker-xp ruby ruby-marshal rust egui game-development

luminol's People

Contributors

afrogthatexists avatar callistoashley avatar dependabot[bot] avatar imgbot[bot] avatar pie-flavor avatar somedevfox avatar speak2erase avatar white-axe avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luminol's Issues

Error when "cargo build" is used

When I run cargo build I get the following error message:

error[E0554]: `#![feature]` may not be used on the stable release channel                                                                                                                                       
  --> alox-48\src\lib.rs:11:1
   |
11 | #![feature(min_specialization)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling git-version v0.3.5                                                                                                                                                                                 
   Compiling egui_extras v0.21.0                      

I can't promise that it isn't just me doing something wrong though. =D

Event command editing

At the moment, Luminol has a pretty basic event command editor.
In the past Events were preprocessed at load time to an enum of hardcoded commands. This system was clunky and generally annoying to work with (although it did yield some good results)

Currently, Luminol uses a descriptor based system to define commands rather than hardcoding them. It's a pretty basic system. There's no preprocessing of commands going on either, Luminol constructs the UI dynamically every frame based on command descriptions. This has the neat side effect that updating a command will instantly update the UI.

Unfortunately, the current approach is a bit flawed when it comes to handling event commands that "nest" other event commands underneath them, leading to weird bugs.

It's possible pre-parsing events commands into a tree of commands could solve that? Something like indextree may work.

Viewport transformation efficiency

Is your feature request related to a problem? Please describe.
Luminol's shaders have a 4D viewport transformation matrix. This is totally unnecessary because all we ever do to the viewport is translate and scale it.

Describe the solution you'd like
Replace the 4D viewport matrices with two vec2<f32>s: one that represents the position of the viewport and another that represents the scale along the X- and Y-axes.

Describe alternatives you've considered
If we need to do more than just translations and scaling to the viewport, we can use a 3D transformation matrix instead of a 4D one. A 3D transformation matrix is enough to encode any 2D affine transformation, a 4D transformation matrix is only required for 3D affine transformations.

Collision Preview

Is your feature request related to a problem? Please describe.
Often during the latter halfs of the development cycle there's often a lot of missing collision that lets you leave maps or just go somewhere plain weird. It'd be nice to be able to check and view the map collision within the editor so you don't have to use a janky debug script and run around everywhere.

Describe the solution you'd like
Some sort of layer toggle button that overlays a red collision indicator (like the pre-existing debug script solution we have with the tileset rn) in the editor on the map, accounting for event collisions too

Describe alternatives you've considered
The debug script we haveโ„ข

Additional context

image

image

Tilemap grid

Is your feature request related to a problem? Please describe.
We currently don't display any grid lines in-between tiles.

Describe the solution you'd like
We add another toggle to the layer list that disables/enables the tile grid. It should probably be enabled by default for the tilepicker.

Describe alternatives you've considered
N/A

Additional context
N/A

Switch/Variable Grouping

Is your feature request related to a problem? Please describe.

Often times you end up in a situation where switches or variables are all over the place instead of in a fixed range, usually as a result of going back to tweak things and adding new switches, so finding related switches or variables can get tedious sometimes.

Describe the solution you'd like

The ability to group switches and variables under labels independent of their IDs would allow for easier managing without too much hassle, or relying on naming conventions like cfg: xxx which usually only add more clutter and confusion.

When viewing switches/variables, there would be a view where you'll have a list of drop downs labeled with their name.
Each drop down will display both the switches and the variables grouped under it, and will allow you to select a switch/variable from the group.
If you're viewing it from a switches context, you'll still see the variables, but you won't be able to insert them, and vice versa.

The user would be able to manage these groups, by creating new ones, renaming/deleting existing ones, and adding entries to the groups.

This should not affect the game logic, it's just an easier way to organize things in editor.

Describe alternatives you've considered

Using prefixes in switch/variable names, which isn't very helpful when the switches/variables are all over the place, and make the rest of the name less readable.

Additional context

The structure should be as simple as:

{
  "group_name": [100, 101, 102]
}

Also might be worth notifying the user when a switch/variable is in more than one group.

Variable controls and Switch toggling

Is your feature request related to a problem? Please describe.
In RPG Maker, you'll often want to see what a map will look like depending on the value of a switch or variable. You need to go in game for this, and can't get an accurate view of the entire map without extra hacking.

Describe the solution you'd like
Add a UI to Luminol that'll allow you to toggle switches and set a specific value for variables. Events, common events, etc, all react accordingly, and Luminol provides you some information about what the switch changes.

Webassembly crashes due to use of Promise::block_and_take

In the items window, it looks like @somedevfox used Promise::block_and_take to wait for a future to evaluate.

        let icon_paths = match Promise::spawn_local(info.filesystem.dir_children("Graphics/Icons"))
            .block_and_take()
        {
            Ok(icons) => icons,
            Err(why) => {
                info.toasts
                    .error(format!("Error while reading `Graphics/Icons`: {why}"));
                Vec::new()
            }
        };

Unfortunately, this behavior is not possible on webassembly and will simply panic. webassembly does not support blocking at all, hence why this happens.

The application panicked (crashed).
Message:  condvar wait not supported
Location: library/std/src/sys/wasm/../unsupported/locks/condvar.rs:20

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Remove git dependencies

Git dependencies prevent us from being able to publish to crates.io (if we want to) and are also inherently unstable. Most of our git dependencies are for pull requests that haven't been merged yet (i.e. flume, cpal) or crates that haven't been updated on crates.io yet (catpuccin-egui).

The only exception to this is wezterm-term, which we use to handle most of the terminal functionality. We aren't really supposed to be using wezterm-term anyway, as it's a crate tailor made for wezterm and has no stability guarantees.

Downloading files in web builds

Is your feature request related to a problem? Please describe.
Credentialless COEP does allow, in certain cases, downloading files from and sending POST requests to other websites on different origins without worrying about CORS. But there's a catch - whatever HTTP requests are made to other origins without CORS, JavaScript (and WebAssembly) can't access the response body, response headers or even the response status code.

In web builds, we need to make HTTP requests for two reasons: sending crash reports and downloading mkxp-based runtimes for new projects. For sending crash reports, requests with credentialless COEP are sufficient because we don't care about the response body: all we need to do is send a request containing the crash report to a server somewhere and then ignore the response. But for downloading runtimes, we can't do this because we need to read the response body in order to extract the runtime into the user's new project.

So the only way to download runtimes is still with CORS. I've already asked Ancurio to enable CORS headers on mapleshrine.eu so we can download mkxp-freebird releases, but for the other runtimes we're gonna need a different solution because GitHub doesn't set CORS headers on GitHub releases, even when downloading directly from their cloud storage buckets via the GitHub API.

Describe the solution you'd like
Get Ancurio or someone else to host current and future releases of whatever runtimes we need on a server that has CORS headers enabled. The easiest way to deal with CORS is to get the server that's hosting the files to serve them with the header Access-Control-Allow-Origin: *.

Describe alternatives you've considered
Use a CORS proxy as before. I'm not sure if GitHub has rate limits for downloading releases, but if it does then that's one problem. The other problem is susceptibility to man-in-the-middle attacks, but these can be mitigated by asking the people maintaining the GitHub repos to sign their future releases in GitHub Actions with PGP private keys stored as secrets on GitHub and then verifying these future releases in Luminol with the corresponding PGP public keys using rPGP or Sequoia, and, if needed, hardcoding cryptographic hashes of existing releases into Luminol.

Reusable Command Snippets

Is your feature request related to a problem? Please describe.

Sometimes you need to repeat a certain command chain, be it for reproducing specific logic steps or a set of conditional branches, which can be tedious and time consuming.

Describe the solution you'd like

It would be very helpful if the user could define a snippet/blueprint which would contain a set of commands, and give it an appropriate name.
Then when needed, the user could insert the blueprint into a command list of the same type. (Prevent insertion of movement specific commands into an events command list)
Very similar to how RMXP already does command copy/pasting, but instead of relying on the clipboard we could have a menu featuring a list of snippets/blueprints we can share and use when needed.

This feature could also be extended to events, as sometimes you have a specific type of event that would repeat across multiple areas, such as outdoor map transfer or fast travel.

Describe alternatives you've considered

Currently you must either create dummy events just to store the commands, or go looking for an event that's using them.

Additional context

Fading Memory has a lot of repeating command patterns, like waiting for an event to dynamically reach a certain spot, or a complex conditional chain with sub-conditions, so it could be used as a testing ground.
Most of the repeating commands can be found under Mod/DEBUG/utility showcase.

Improved error reports

Is your feature request related to a problem? Please describe.
At the moment, Luminol provides pretty basic error messages, especially related to the filesystem:
image
image

This makes it annoying to debug things. What file didn't exist? Did this happen just after the host filesystem was loaded, or after?

Describe the solution you'd like
Ideally we use some error type that allows us to provide additional context, all the way up the call chain.

// call site
texture_loader.load("Graphics/Characters", event_name).with_context("while loading an event")?;

// texture loader
fn load_texture(...) -> Result<Texture, Error> {
  filesystem.open_file(path).with_context(|| "while loading a texture")
}
// filesystem
fn open_file(...) -> Result<File, Error> {
  std::fs::open(path).with_context(|| format!("while opening {path}"))
}

Describe alternatives you've considered
miette looked appealing but I'm not sure how to use the API. anyhow has a .with_context method but that only seems to override any context provided.

Placeholder graphics

Is your feature request related to a problem? Please describe.

Luminol refuses to open maps with missing assets at the moment. While this is reasonable behavior, it'd be nice if Luminol could load maps with missing assets by displaying them as placeholder graphic.

Describe the solution you'd like

When Luminol attempts to load missing assets, it creates a toast for every missing asset and prompts the user if they really want to open the map.

Questions

Should we replace any missing assets with a placeholder graphic? If so, do we create a file with the same name as the missing asset, or change the asset's path?

Describe alternatives you've considered

RPG Maker XP (in my experience) flat out won't complain and instead uses a blank image. This is pretty reasonable behavior too.

Show/Move Picture Command Visualizer

Is your feature request related to a problem? Please describe.
Getting the right coordinates for an image you want to display can be a pain in the ass, especially when movement and zoom are involved.

Describe the solution you'd like
The show/move picture command window could have an expandable section where you can select a rectangle on the image itself instead of inputting raw numbers, so that the program will do the calculations for the user.

Describe alternatives you've considered
Opening an image editor and a calculator to do the calculations yourself.

Website allows you to use it from phone

If you use the website on a phone, it allows you to press "new project" but then when you press ok, it just loads forever.

I'm guessing this is because it thinks the "choose a folder" window has appeared and is therefore waiting for you to make your choice

Custom egui app runner to replace eframe

Is your feature request related to a problem? Please describe.
eframe is nice, but is slow to update and most notably doesn't work in a web worker, so atm Luminol has a custom web runner that can't fully integrate with eframe. eframe doesn't export all the functionality required to make a custom app runner, unfortunately.

Describe the solution you'd like
We fork eframe and egui_wgpu and vendor our own versions of these two crates.

Additional context
wgpu has just updated to 0.18 and I could see eframe and egui_wgpu taking a few more months to update. We should ideally be staying up to date with the latest wgpu release (We're currently two versions behind!!) especially since gfx-rs/wgpu#3626 might be landing soon.

UI repaints every frame when the map editor is open

What's the issue? Please describe.
At some point we started being affected by an egui bug that causes the egui::Context::request_repaint_after method to cause the screen to repaint every frame with no delay regardless of what duration is passed to the method. This method is called by the map editor to animate the autotiles in the map and tilepicker, causing unnecessarily high GPU usage when it's open. This will be fixed by emilk/egui#3978 which is in egui 0.26.0.

Describe the solution you'd like
Upgrade to egui 0.26 as soon as possible. This requires waiting for catppuccin-egui to upgrade their egui dependency or getting rid of catppuccin-egui.

Describe alternatives you've considered
None

Tests
It's possible to check if the UI is rendering every frame by opening the egui inspection window via the Debug tab in the top bar and checking how often the time updates, or alternatively by using a GPU usage monitor like NVTOP.

Implement RMXP Extractor Into the Editor

Is your feature request related to a problem? Please describe.

Currently, to extract RMXP scripts the user requires installing Ruby on their machine.
If the functionality were to be implemented into Luminol, users would be able to extract and look through them with one less dependency.
Would be very helpful to users who're new to scripting, and are terrified of touching the console.

Describe the solution you'd like

  • A button that would extract scripts from Scripts.rxdata into files in a folder of the users choice
  • A button that would compress scripts from a folder of the users choice into a Scripts.rxdata file

Describe alternatives you've considered

Doing it the less user friendly way with the RMXP Extractor gem in a terminal.

Event evaluation

Is your feature request related to a problem? Please describe.
RPG Maker lacks proper tooling to debug events. This would be an amazing feature to have, even if it would be heavily restricted (i.e. no script event commands, no custom event commands, etc)

Describe the solution you'd like
Allow Luminol to scan over commands and process them. Known commands are evaluated, but unknown commands or commands that Luminol can't process (i.e. script commands) are unprocessed and a warning is shown.
Luminol provides typical debug tools, such as stepping over individual lines or breaking at a certain point. This could also integrated nicely with #32.

Describe alternatives you've considered
Fading Memory has a partial event command debugger implemented in RGSS. The implementation is botched and hard to use. Luminol could provide an RGSS based debugger, but it likely wouldn't play nice with complex custom scripts.

Change NilPadded to start at index of 1 rather than 0

RPG Maker uses arrays padded with nil at the start to make all arrays start at an index of 1, rather than zero (its quite stupid, I know)

All indexes RPG Maker stores into these arrays assume this- so all over Luminol's codebase there's index - 1. This is easy to miss (and has been missed) leading to bugs.

Software crashes when when you press the "items" button

Steps to reproduce:

  • Create a new project.
  • Restart the software
  • Open that project.
  • Press "Items" under the "Data" tab
  • The software crashes with the following error:
Finished dev [optimized + debuginfo] target(s) in 0.57s
     Running `target\debug\luminol.exe`
Attempted loading xScripts failed with The system cannot find the file specified. (os error 2)
Attempted loading xScripts failed with The system cannot find the file specified. (os error 2)
Attempted loading xScripts failed with The system cannot find the file specified. (os error 2)
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: src\windows\items.rs:80

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
2023-04-03T18:33:03.065355Z  WARN egui_glow::painter: You forgot to call destroy() on the egui glow painter. Resources will leak!
error: process didn't exit successfully: `target\debug\luminol.exe` (exit code: 101)

Unable to load KNight-Blade after saving

Describe the bug
Luminol fails to load RPG Maker XP's KNight-Blade example game after saving to it.

To Reproduce
Steps to reproduce the behavior:

  1. Download the KNight-Blade example from https://www.rpgmakerweb.com/additional-downloads#sample-games
  2. Open it in Luminol
  3. Modify a map so that saving will actually write files to the project
  4. Save the project
  5. Load the project again

Expected behavior
It should be able to save and load properly because I was able to save and load from OSFM-GitHub.

Desktop (please complete the following information):

  • OS: Arch Linux

Editor Plugins

Is your feature request related to a problem? Please describe.
People tend to build features that extend RPG Maker, (such as custom event properties) and they're usually implemented with hacks. Sound emitters in Fading Memory are a great example of this- events have a magic comment denoting that they are an emitter. From what I've seen as well the use of the Notes section in VX Ace is commonly used to add extra fields to data types.

We can cover the majority of simple cases by adding custom event commands (I am working on that, plugins could likely integrate really well into the system I have in mind) and providing a simple way to specify extra fields on types from the luminol_data crate. However, that won't scale to anything more complex than editing a string or two.

Describe the solution you'd like
A plugin system (preferably in a scripting language) would allow users to extend Luminol with custom features, such as adding new ui, tools specific to their game (such as save editors) and would greatly help to improve the longevity of Luminol.

Describe alternatives you've considered

Lua

Lua seems to be the best option for writing plugins. There are already some amazing bindings out there and Lua is pretty easy to build. It's designed to be integrated as a scripting system as well, which is exactly what we'd want!

Rust

Luminol is made in Rust, which at a glance means we don't have to write a lot of custom bindings. However Rust isn't ABI stable! This is made worse because Luminol only compiles with nightly at the moment. There's also the hassle of having to distribute platform specific builds of plugins as well.

Javascript

We wouldn't need to bundle an entire Javascript runtime on web builds as it's built into the browser already. Unfortunately Javascript runtimes are pretty heavyweight and there don't appear to be many rust bindings available, as far as I can tell. I don't think we want to turn Luminol into a browser!

Ruby

It's what most people using Luminol will be familiar with, and there are decent bindings out there (magnus and rb-sys). That's about the only thing going for Ruby, unfortunately. Ruby is extremely heavyweight- and stubborn to build to say the least. Webassembly builds appear to be experimental as well.
It'd also railroad us into using mingw on Windows, which is a whole other mess.

Python

I don't have enough experience working with Python to make any solid comments, but I'd imagine Python would have the same problems as Ruby, without the benefit of most RPG Maker users being familiar with it.

Additional context
Unless we go with Rust we will have to write egui bindings. I'm also not sure how to even integrate plugins in an immediate mode UI without having tons of hooks everywhere.

This is likely not something that should be worked on until we have a solid idea of how plugins should work and the editor is more finished. Discussion is encouraged!

Change optional string properties to use Option<String>

In paths to images, RPG Maker uses empty strings to represent a lack of an image.

This is not very ergonomic in rust code, so during serialization and deserialization it'd be nice to convert these stings to Option<String> to improve code quality.

This should not add any additional overhead, and in fact may speed things up.

Path cache

Is your feature request related to a problem? Please describe.
Because RMXP is stupid, it doesn't store file extensions or care about file casing when storing file paths.
At the moment, luminol blindly searches all file paths when trying to load something. This is very slow and wasteful.

Describe the solution you'd like
Cache paths when loading a project, referring to them when attempting to load files

Describe alternatives you've considered
N/A

Additional context
Possibly copy mkxp?
Could be handy when implementing rgssad support

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.