Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
532 stars 140 forks source link

Support more format #97

Closed RyanBram closed 4 years ago

RyanBram commented 9 years ago

Hi, Jonas and other MKXP contributor, One of the advantage of MKXP is we can extend it to do more than original RGSS Player can do.

AFAIK MKXP is based on SDL and based on the documentation as of version 1.2.7, sdl_mixer supported format are dynamically loaded, therefore we can just place a specific format .dll to sdl_mixer directory then we'll get that format supported.

I am just curious that, is it possible for MKXP to support more format (music or graphic) than RPG Maker can do by just simply putting a specific .dll into MKXP directory?

In RPG Maker VX Ace, music is determined by its title and not its extension, so we can do for example place "battle.ogg" and replace it with "battle.mid" manually without the need for changing our database.

Ancurio commented 9 years ago

What are you looking to achieve? What image/audio formats would you like to use with mkxp that aren't available in RMXP?

RyanBram commented 9 years ago

I would like to see module music format (.mod, .it, etc) supported. Because I want to take advantage of MIDI (small filesize and editable), but without the need to bring big size soundfont along with my game while still sound relatively good no matter which device play it.

I also would like to see webp supported, because webp can be lossy compressed, but unlike JPG, it also perserve transparency of my image just like lossless PNG. So I can use small lossy transparent picture in my game. Even webp support animation. (Combination of PNG, JPG, and GIF).

All of those features are not just for the sake of new feature, because game developer can take benefit from small distribution size especially when porting their game to mobile device like Android.

Thanks

Ancurio commented 9 years ago

SDL_image supports webp via libwebp, and SDL_sound supports tracker formats via libmodplug, so you're good to go. The only problem is that SDL_image has no dynamic way to discover the supported decoders so mkxp has no way of knowing it should look for .webp files, meaning you'd have to recompile mkxp manually with the extension added to the list.

By the way mkxp does not use SDL_mixer.

RyanBram commented 9 years ago

Hi, I tried to put precompiled libmodplug.dll in my directory (I got it from SDL_Mixer website) and swaping my "Title.mid" with "Title.it", but the following error message appear:

DebugLogger: no debug extensions found
eval:890:in `bgm_play': No such file or directory - Audio/BGM/ThemeFF (Errno::EN
OENT)
        from eval:890:in `play'
        from {0101}:133:in `play_title_music'
        from {0101}:18:in `start'
        from {0100}:12:in `main'
        from {0006}:23:in `run'
        from {0124}:7:in `block in <main>'
        from {0124}:7:in `call'
        from {0124}:7:in `rgss_main'
        from {0124}:7:in `<main>'

I tried to use the original player and the game still run without message, but without sound. It seems that original RGSS player is more format tolerant than MKXP. It can detect format change or extension error then trying to use available codec if possible and just ignore it if there is no supported codec found.

I tried another approach. I tricked MKXP by renaming "Title.it" into "Title.mp3", so MKXP will think it is the supported format. So far it seems working, but unfortunately I still found error like following:

eval:890:in `bgm_play': SDL_sound: Sound format unsupported (SDLError)
        from eval:890:in `play'
        from {0101}:133:in `play_title_music'
        from {0101}:18:in `start'
        from {0100}:12:in `main'
        from {0006}:23:in `run'
        from {0124}:7:in `block in <main>'
        from {0124}:7:in `call'
        from {0124}:7:in `rgss_main'
        from {0124}:7:in `<main>'

This time I doubt if the error appear because I placed wrong dll which aren't supported by SDL_Sound, or because MKXP still detect my "Title.it" as MP3, because it determines my BGM file format by its extension.

Based on my request, I just want to suggest an idea for MKXP to support plugin system. The plugin is loaded dynamically, therefore user can just put or remove .dll or .so based on they need. If user need one format, they just need to place the proper .dll and removing .dll they don't need. The plugin system also usable if user need to expand more feature, such as Mode7, Networking, shader system like emulator has, etc.

I cannot help much with this project as my programming skills is very limited, but I can consider some donation as long as I know where I should give it.

Regards, RyanBram

Ancurio commented 9 years ago

Oh, sorry, I completely missed to mention that support for those two formats is a compile time option of SDL_image/sound and the precompiled binaries here on github have only the formats supported by RMXP (jpg/png/ogg/mp3/wav/mid) compiled in.

You're right that mkxp should tolerate files with extensions even if the format is not supported.

Ancurio commented 9 years ago

Oh, you're using Windows? If you're not familiar with compiling software, I can make a Windows build with libwebp and libmodplug, but I won't be able to support it indefinitely.

RyanBram commented 9 years ago

Wow, really! That's great. (^_^)

i think it is too much effort from you just to satisfy single person personal interest. But before you go too far, I reported you new bug. Maybe after fixing it first you can give me the pre-compiled build, so I will not bother you with any personal request.

Thank you so much for your kindness.

How can I pay for this?

Ancurio commented 9 years ago

No problem, here is a first build you can try out: https://www.dropbox.com/s/5svi994bvtk2q5w/mkxp-modplug-webp.zip?dl=0

RyanBram commented 9 years ago

I tried your build and play with it for minutes. My reception is : "AWESOME!!!" :+1: Even RPG Maker VX Ace official editor seems don't care which format I throw in my project directory. It still try to list it in the menu (although it just show blank webp picture, but the picture is selectable).

But I still suggest a plugin based feature, so any additional feature can be added just by placing the respective .dll. It will also make your task easier and MKXP will not become bloated.

Thank you very much for this custom build. If there is something I can do as a return, please let me know.

You can close this issue now.

Best regards, RyanBram