mkxp icon indicating copy to clipboard operation
mkxp copied to clipboard

Support for IDE-like debugging of RGSS / ruby scripts

Open Poityu opened this issue 7 years ago • 8 comments

The idea is that it would be much easier to debug scripts, with step through/step into...etc functions provided by the IDE.

I saw some people mentioning using IDEs instead of the engine editor with MV, which shouldn't be too difficult because MV is backed by Javascript.

For engines with RGSS, I am under the impression that this would require quite some hacking, correct? (Likely involves RubyInline/Rice/FFI) This is because both the official and the mkxp binary are exe first, Ruby second (Binary runtime that calls into Ruby script), where as MV is Javascript first. (Javascript that calls into JS Runtime)

Appreciate clarifications or confirmations.

Poityu avatar Apr 28 '18 13:04 Poityu

Last time I checked (a long time ago), there was no simple way to step through a running ruby script, look at (local) variables etc., has this changed meanwhile? I don't like the idea of people using mkxp to create new games (because the engine architecture of RPG Maker is flawed, see #103), but I would still appreciate an effort like this, simply for the fact that it's a nightmare to debug existing games right now with the current infrastructure (which is barely more than printf-debugging).

This is because both the official and the mkxp binary are exe first, Ruby second (Binary runtime that calls into Ruby script), where as MV is Javascript first. (Javascript that calls into JS Runtime)

This is correct. I don't know what's involved in making MRI "traceable", and I don't really have time or resources to devote to this, but I would support such an effort.

Ancurio avatar Apr 29 '18 09:04 Ancurio

Oh, I see..

Last time I checked (a long time ago), there was no simple way to step through a running ruby script, look at (local) variables etc., has this changed meanwhile?

Hmm, RubyMine seems to be able to? I'm approaching this from a similar perspective where ActionScript under Flash has no breakpoint at all, but with Flex you get those things...But in fact, I am not familiar with Ruby development at all, sorry if this turned out to be a silly question.

it's a nightmare to debug existing games right now with the current infrastructure (which is barely more than printf-debugging).

Can't agree more.

This is correct. I don't know what's involved in making MRI "traceable", and I don't really have time or resources to devote to this, but I would support such an effort.

Thanks for the answer. I don't think I can do it even if I have all the time I want. One can only dream...

Poityu avatar Apr 29 '18 12:04 Poityu

Well...I don't know why I missed them, but there were certainly some attempts at porting the engine that can be used for the purpose. None seem to be finished.

I have managed a frankenstein that can be boot up and debugged from VSCode (breakpoints/step into/step over/inspect variables...etc), it can show the title screen (in a quite poor way, because it is spliced together), but that's about it... VXonGosu.zip

I have no idea what is happening beyond title screen, either in a infinite loop or takes too much time drawing. Monkey patching can only get one so far...

Poityu avatar Feb 07 '19 23:02 Poityu

ruby2.6 + ruby_jard  use rubygems install ruby_jard 

debug

gbbnfhb avatar Oct 22 '21 16:10 gbbnfhb

ruby2.6 + ruby_jard  use rubygems install ruby_jard 

:O 超かっこいいじゃないすか、まるでIDEのdebuggerみたいです。 スクショ ありがとうございます。

Ancurio avatar Oct 24 '21 06:10 Ancurio

You can actually get rdebug_ide and debase working inside mkxp, with some trickery. It's kinda meh, but it works. Ruby does come bundled with an official debugger too, so you could try to upgrade to 3.1.0 and use that instead.

melody-rs avatar Jan 12 '22 19:01 melody-rs

Currently, mkxp doesn't work on ruby 3.1, but I'm investigating. https://aur.archlinux.org/packages/mkxp-git/ Again, it's 2.7, and since ruby_jard>2.5 or higher, I've adopted the stable 2.6.

gbbnfhb avatar Jan 13 '22 01:01 gbbnfhb

You can try using binding-util.h from mkxp-z, it supports 3.1

melody-rs avatar Jan 13 '22 18:01 melody-rs