Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Calling external languages?

xpace

Member

There is one thing I need to be able to do in RMXP before I commit to using it. That is the ability to call a library or an external .dll or program written in another language. And by "call" I mean pass variables, too. Is this possible? And, if so, how?

What I want to do is use the front-view battle system, the game editor, and item/stats/spells/skills handling of RMXP and combine it with something else written in another language. I'm not certain, but I think this is called a "Language Binding" or "Wrapper". But from what little I've been able to find, it does not sound like this is possible:
Linkin_T":1r3mece4 said:
RMXP can [not] load it because it was made in another language that´s not Ruby (maybe C or C++). In truth a Ruby Interpreter is embedded into the program, while the main process is done by the other language. So the program can take advantage of a powerful language operating in the background while the maker uses a more friendly language to make his/er games.
That might present a problem for me as I would like to use something written in another language. (For speed, if nothing else.) In theory, is there some way to bypass the Ruby Interpreter and get the main process to call an external 3D engine directly?

I am seriously thinking about suggesting that (the ability to bypass the built-in Ruby interpreter to call an external library directly) to this thread:

Ideas for a new RPG Maker XP Editor(RPG Advanced Editor)

But, as Vgvgf is creating an alternative editor (written in VB and with RGSS support) that still requires Game.exe and other RMXP files, I'm not sure if that is theoretically possible, either. I'm not familiar enough with RMXP or RGSS to determine this. I have to wonder if, by using the existing Game.exe, it will still have the same restrictions.

Please, any constructive comments and suggests are welcomed.
 

poccil

Sponsor

I have recently figured out the method of doing much as you requested.  It involves passing the Ruby object's ID to the other function in a DLL.  That DLL function can shift the object ID left by 1 to obtain a pointer to the Ruby object.  See this thread.

http://www.rmxp.org/forums/index.php?topic=39324.0

There I explain the technique in further detail and offer a demo illustrating a few bitmap effects.

Also, the Win32API class in the Ruby framework allows a Ruby program to call a DLL function.  An example is given in the link above.
 

xpace

Member

Hey, thanks for the tip! :thumb:

poccil":1mxrqm8w said:
...Also, the Win32API class in the Ruby framework allows a Ruby program to call a DLL function.

Question: When the Win32API class is used in RGSS to call a DLL function, is the DLL being processed through an interpreter level?

I'm just wondering if using this method will result in a C++ DLL running at nearly the same speed as if the DLL were a stand-alone program. If the RGSS interpreter level still acts as a 'bottleneck' of sorts, then it's probably not possible to incorporate a true 3D engine and still get a decent framerate.
 

Zeriab

Sponsor

I have once played around with some simple summarization and subtraction operations and found that the dll code were about 100 times faster.
I guess this answers your question ^^
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top