public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Extending RGSS (ruby) with C

BMM Archive · July 16, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Extending RGSS (ruby) with C
  • Original author: ??????
  • Original date: November 23, 2014
  • Source thread: https://forums.rpgmakerweb.com/threads/extending-rgss-ruby-with-c.34231/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > Learning Ruby and RGSSx

Summary

So, thanks to the wonderfull work of Wannabe && FenixFyreX, the RPG Maker Community is  now able to benefit from loading .so files into the maker directly. Alot (perhaps most) of you may be thinking "what the hell is a .so file?", so here is a short explanation from my understanding; A .so file is essentially the same as a .dll file, with one major exception... Rather than being called each time its required via some API call, the .so is able to implant new methods into the ruby (RGSS)...

Archived First Post

So, thanks to the wonderfull work of Wannabe && FenixFyreX, the RPG Maker Community is  now able to benefit from loading .so files into the maker directly.

Alot (perhaps most) of you may be thinking "what the hell is a .so file?", so here is a short explanation from my understanding;

A .so file is essentially the same as a .dll file, with one major exception... Rather than being called each time its required via some API call, the .so is able to implant new methods into the ruby (RGSS) environment directly.

Consider the following...

# Ruby Codedef some_method(value) return value >= 100 ? true : falseend# End Ruby CodeThis simple method checks if the value passed as argument 1 is greater or equal to the value of 100. if yes, it returns true and false otherwise.

Now what if we wanted to write this method in C?  There are many reasons for why you may wish to do such a thing, performance being the most common, but I'm not really going into that...

Normally, we would have had to do something like this..

# Ruby Codedef some_method(value)  @method_api ||= Win32API.new('DllName','FunctionName','i','i')  return @method_api.call(value) != 0 ? true : falseend# End Ruby Code
Code:
// C Codeint FunctionName(int value){  if (value >= 100)  {    return 1;  }  return 0;}// End C Code
As you can see, this is fairly pointless. Its likely that performance would actually be lost in such a transition; however, if we where able to perform even more of the code on the C side of things (ideally all of it), it could potentially become far superior..

An Example of a much faster way to write such a function within a .so file:

// C Code#include "ruby.h" VALUE FunctionName(VALUE self,VALUE ruby_value){ return NUM2INT(ruby_value) >= 100 ? Qtrue : Qfalse;} VALUE rb_DEKModule = Qnil; void Init_Tutorial(){ rb_DEKModule = rb_define_module("DEK"); rb_define_singleton_method(rb_DEKModule, "function_name", FunctionName, 1);}// End C CodeThe end result of this code is almost identical to using the above Ruby + dll. ie - the ruby method function_name calls the C method FunctionName when called.

So, I wrote a tutorial on how to bring the ability to load a .so into your rpg maker projects. This tutorial can be found HERE.

Annd.. Here is a link to a demo containing a working Tutorial.so file.

Any questions ??

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#rpg-maker-archive#rgss-learning

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar