使用 DirectX 驱动的 RPGMaker VX Ace Game.exe

目录 / Contents

  1. 简介 / Introduction
  2. 使用方法和下载 / Instructions and Download Link
  3. API 参考 / API Reference
  4. 与 RGSS3 的差异 / Difference with RGSS3
  5. Shader 参考 / Shader Reference
    1. RGD 中的 shader / Shader in RGD
    2. 在 Sprite 和 Viewport 上使用 shader / Use Shader on Sprites and Viewports
    3. 一些内置 shader 的可用内容 / Some Useful Contents in Built-in Shader
  6. 兼容性 / Compatibility
  7. 使用约定 / Terms of Use
  8. 更新记录 / Update Log

 

简介 / Introduction

RGDirect (RGD) 是对 RPG Maker VX Ace (RMVA) 的脚本系统 RGSS3 的部分重新实现和功能扩展。它的主要作用是提升游戏的绘图效率、增强绘图扩展性,同时修正一些存在于原版 RGSS3 的漏洞。

RGD 使用 DirectX9 重新实现了 RGSS3 的 Bitmap, Graphics, Viewport, Sprite, Tilemap 和 Plane 绘图相关类和模块,利用 GPU 资源,使得绘制大地图、大图片、较多旋转缩放精灵的时候足够高效,杜绝了原版 RGSS 的卡顿现象。RGD 内置了 Sprite 和 Viewport 的 shader 接口,可以很方便地添加实时计算的自定义特效代码。位图操作方面,RGD 在实现原有操作的基础上,文字绘制内置了采用像素字的选项,可以不依赖外部 DLL 绘制像素字体。在图像绘制之外,RGD 加入了鼠标输入的功能,可以使用 Mouse 模块方便地获取鼠标的位置和按键状态。

这项工作由我和 Fux2 共同完成。Fux2 负责所有 C++ 代码和 Ruby 交互、Ruby 对象处理以及描绘文字相关的功能,我负责 D3D 绘图相关的功能。感谢 Mayaru 绘制了 RGD 的形象和图标文件。

如果有任何询问或意见,请在此处回复或发送邮件到 cirno@live.cn。

请在这里支持我:爱发电 Patreon

RGDirect (RGD) is a partial reimplementation and functional extension of the script system of RPG Maker VX Ace (RMVA), RGSS3. The main purporse of this project is to enhance the rendering efficiency, expansibility and to fix some bugs on original RGSS3.

RGD reimplements graphical classes and modules in RGSS3, Bitmap, Graphics, Viewport, Sprite, Tilemap and Plane, using DirectX9 technique. The performance for drawing maps, images of large size and scaling, rotating sprites of large number with GPU is greatly higher compared to the lag in RGSS3. RGD has a built-in shader interface in Sprites and Viewports which is used for real-time custom effect code. On bitmap operations, besides the operators in RGSS3, RGD implements built-in pixel font option without using external DLLs. In addition, RGD implements mouse input. You may use module Mouse to get mouse position and button status easily.

This work is completed by Fux2 and me. Fux2 completed all the communications between C++ and ruby, and functions on drawing texts. I completed the functions related to D3D rendering. Many thanks to Mayaru for drawing the character and icons of RGD.

If you have any questions or advice, please reply to this post or send email to cirno@live.cn.

Please support me here: Afdian Patreon

      

 

使用方法和下载 / Instructions and Download Link

下载地址 Download Link: RGDv1.5.4 RGDv1.6.1(maybe unstable)

使用此处提供的 RGD Game.exe 替换原版游戏的 Game.exe。

Replace original Game.exe with RGD Game.exe from here.

 

当前可用的 RGD 脚本一览:

Available RGD script list:

http://cirno.blog/archives/457

请注意一些范例内置exe可能版本并非最新。

Please pay attention to the version of exe in example. They are not always the newest version.

 

API 参考 / API Reference

本节只显示默认 RGSS3 没有提供的接口。对于 RGSS3 已有的功能,请参考 RMVA 的 F1 帮助文档。

This section only shows interfaces RGSS3 does not provide. For existing functions in RGSS3, please refer to the F1 manual in RMVA.

 

Audio

 

Audio_Slot

 

Bitmap

Input::Controller

 

Input::Controller::State

Font

 

Geometry

 

Graphics

 

Input

L2D

 

Mouse

 

RGD

 

Spine

 

Sprite

 

Viewport

 

与 RGSS3 的差异 / Difference with RGSS3

本节不包括上述 API 中介绍的部分。除此之外已知的 RGD 和 RGSS3 的差异有:

  • Graphics.play_movie 没有在 RGD 实现; 在1.3版本后,Graphics.play_movie已经实现,但需求的格式为 WMV,而不是 RGSS3 的 OGV。
  • Bitmap 读写效率略低于 RGSS3 ,因为把修改后的纹理更新到 GPU 时有额外开销;
  • RGSS3 中 Sprite 的 blend_type可以跨 Viewport 起作用,但 RGD 中由于实现方式差异, Viewport 之间的合成相互独立,上层的加法、减法合成不能作用在下层。
  • RGD 取消了 RGSS3 的 F1 设置界面,用“关于”代替。 在1.3版本后,F1 的“关于”已经取消,提供了自定义的游戏设置、按键设置脚本可供使用。

This section does not include API differences above. Other known differences between RGD and RGSS3 include:

  • Graphics.play_movie is not implemented in RGD; After version 1.3, Graphics.play_movie has been implemented, but video format requirement for this function becomes WMV, rather than OGV in RGSS3.
  • Performance of Bitmap operators is slightly lower than RGSS3, because of extra overhead when updating modified texture to GPU.
  • blend_type in Sprites of RGSS3 can work across Viewports, while Sprites with additive and subtractive blend types in higher viewport in RGD cannot work with lower viewport since the difference in implementation methods of Viewport.
  • RGD removes F1 config dialog in RGSS3 and replaces it with “About” dialog. After version 1.3, “About” dialog has been replaced with a custom game and control setting script.

 

Shader 参考 / Shader Reference

English is currently not available in the first parts of this section. Sorry.

RGD 中的 shader / Shader in RGD

RGD 使用 shader 的方式为首先在 Graphics 中添加相应代码,再在 Sprite 和 Viewport 中设置对应的名称和参数去启用 shader 特效。Graphics.add_shader 分为两部分:主函数部分和 pass 定义部分。所有的 shader 都使用 HLSL 语言。

The way RGD using shaders is to add them in Graphics first, then to set corresponding name and parameters in Sprites and Viewports to enable shader effects. Graphics.add_shader is divided into two parameters: main function part and pass definition part. All the shaders use HLSL here.

对于主函数部分,一个通用的例子,也是 RGD 的默认 shader 展示如下。本案例中使用的函数都可以在自定义 shader 中调用。

For the main function part, a common example is demonstrated here, which is also the default shader in RGD. All the functions used in this case can be arbitrary called in custom shaders.

这一段函数是在 GPU 中每一个用上这段 shader 的像素都会独立执行一遍的,它们之间唯一的不同是传入的参数差别。下面分析上述函数的意义和作用:

This piece of function is executed on every pixel that GPU used the shader on. The only difference between these function executions are parameters. Now we analyse the function above:

首先上述函数中用到了 float4 和 float2 这些类型。它们是 HLSL 中的矢量格式,分别表示4个和2个 float 构成的矢量。它们可以进行逐位的加减乘除等操作,也可以使用 color.r, color.g, color.b, color.a(rgba 可以换成 xyzw)访问它们的分量。更进一步地,可以用 color.rg, color.rgb 等组合来用更小的向量形式一次性表示它其中好几个分量。

First the function above used data types like float4 and float2. They are vectors in HLSL, meaning vectors constructed with 4 floats or 2 floats. Vectors can be added, subtracted, multiplied and divided. You can also use color.r, color.g, color.b and color.a (rgba can replaced by xyzw) to access its components. Further more, you can use combinations like color.rg, color.rgb to represent multiple components as smaller vectors.

对于函数的定义,两个参数的格式是 name : SEMATIC。其中 name 表示参数名称,和 C 的函数参数相同;SEMATIC 表示它在 shader 中的使用方法和传递过程。color : COLOR0 是表示(顶点插值后)颜色的属性,texcoord : TEXCOORD0 表示当前位置的纹理坐标,也就是它对应 Bitmap 上哪一点。 PS_OUTPUT 是 shader 中自定义的结构,用来表示 Pixel Shader 的输出。其中包含两个颜色 COLOR0 和 COLOR1。这里不论是颜色还是纹理坐标,数据范围都是 0 到 1。对于颜色来说,(0, 0, 0) 代表全黑,(1, 1, 1) 代表全白(相当于 RM 的 (255, 255, 255))。对纹理坐标来说,(0, 0) 代表左上角,(1, 1) 代表右下角。

For function definition, the form of two parameters is name: SEMATIC, where name represents parameter name just like C function parameters, and SEMATIC means how it is passed and used in the shader. “color: COLOR0” represents vertex color after interpolation, and “texcoord: TEXCOORD0” represents texture coordinate on current pixel, which means what point on bitmap is the pixel corresponding to. PS_OUTPUT is a custom-defined structure in shader representing shader output. Two colors COLOR0 and COLOR1 are included. In this case, all colors and texture coordinates are from 0 to 1. For a color, (0, 0, 0) is totally black while (1, 1, 1) is totally white (like (255, 255, 255) in RM). For texture coordinates, (0, 0) is upper left corner while (1, 1) is bottom right corner.

samp(texcoord) 是自定义的在纹理寄存器上采样的函数,包括了坐标缩放和偏移的一些计算。如果想要直接进行采样,可以使用 tex2D( spriteSampler, texcoord ) 。tex2D 是从采样器上采样,也就是在图片上取颜色的操作;spriteSampler 通过 register(s0) 获得,是 D3DXSprite 中纹理的采样器,也就是我们需要绘制的图片。每个像素都具有不同的 texcoord,因此它们才能在图片上取到不同的点,最终把整张图片呈现出来。

samp(texcoord) is a custom sampling function on texture registers including some computation on coordinate scaling and translating. If you need to sample directly, you can use tex2D(spriteSampler, texcoord). tex2D is sampling function directly on registers, that is, obtaining colors from the image. Value of spriteSampler is obtained from register(s0), which is the texture used on D3DXSprite. Each pixel has different texture coordinate (texcoord), so they find different points on original image and finally present the whole image on screen.

ColorMap, BushMap 和 ToneMap 都是自定义的颜色处理函数,传入和返回的都是 float4 格式。其中 ColorMap 处理变色效果,BushMap 处理“草木茂密”效果,ToneMap 处理色调变更。

ColorMap, BushMap, and ToneMap are custom color transforming functions with both input and output float4. ColorMap handles color changing effect, BushMap handles “bush” effect in RM, while ToneMap handles tone changing effect.

res *= color 是把顶点颜色合成到当前颜色上。最常见的功能是当设置不透明度后,不透明度的信息就被携带在顶点颜色中,而 res 通过 tex2D 得到,只包含了原始图片的透明通道信息,所以要把精灵的整体不透明度信息合成上去。

“res *= color” is to blend vertex color on current color. A main function is to store alpha information in vertex color when using translucent sprites. Since res is got from tex2D with only alpha information in original bitmap, the overall alpha of sprite needs to be blended on it.

res.rgb *= res.a 的步骤称为预乘(Pre-multiply)。因为 alpha blending 中,最终颜色的计算公式为:背景色 * 背景色的 alpha * (1 – 前景色的不透明度) + 前景色 * 前景色的 alpha,所以我们在处理前景色时,先把它乘以 alpha,最后只要加到背景色的那一项上就可以了。当它成为背景色以后,因为已经预先乘了 alpha,所以“背景色 * 背景色的 alpha”也可以看作一个整体,直接参与运算。

“res.rgb *= res.a” is called “pre-multiply”. Because color formula in alpha blending is: final_color = background_color * background_alpha * (1 – foreground_alpha) + foreground_color * foreground_alpha, we multiply foreground_color with foreground_alpha as the new foreground_color, then we just need to add it directly on the background term. When the new color becomes background color, “background_color * background_color” is seen as a whole because alpha channel is pre-multiplied.

最后的 GetOutput,就是把我们得到的颜色,包装成 PS_OUTPUT 的格式输出。

Finally, GetOutput is to warp our result color as PS_OUTPUT and output it.

在写 shader 时可以从上面的代码开始修改和编辑。比如下面的案例就能让最终的颜色变得更红一些(为了避免重复,函数名称改成了PS2):

When you create a new shader, you can start modifying and editing from the example above. For example, the shader below makes final color more reddish. (We use PS2 as function name to avoid name conflict)

完成这个步骤后,就能在 add_shader 的第二个参数中添加 pass 了。一个典型的案例如下:

After this step, you can add a pass in the second parameter of add_shader. A typical example is shown here:

其中需要注意的是,AlphaBlend 代表 pass 的名字,在 Sprite 和 Viewport 的 effect_name 中设置成这个值就能对应使用(但是自定义的 pass 请换一个名称,因为 AphaBlend 是内部 shader 使用的,自定义写成 AlphaBlend2 就没问题)。另一点需要注意的在 PixelShader = compile ps_2_0 PS(); 中,PS() 就是我们上面定义的函数,如果想要使用自己定义的名叫 PS2 的函数,那么这里也要使用 PS2。

What you need to pay attention to is that AlphaBlend is the name of a pass. You can use it by setting effect_name to it on Sprites or Viewports (but please select another name in your custom shader, such as AlphaBlend2, because AlphaBlend is used in internal shader). Another point is that PS in PixelShader = compile ps_2_0 PS(); is the function we have defined. If you are going to use custom function PS2, you need to change function name to PS2 here.

AlphaBlendEnable 和 SeparateAlphaBlendEnable 分别表示开启透明合成以及颜色和不透明度采用不同的透明合成方式(因为存在减法合成这类颜色和透明度合成方式不同的算法)。BlendOp代表合成的运算符号,下面四行分别代表前景图颜色、背景图颜色、前景图 alpha,背景图 alpha 的合成参数。ONE 代表乘以1,INVSRCALPHA 代表 1 – 前景图 alpha 。上述的合成方式是在采用预乘的条件下,按透明度合成的正确做法。

在 Sprite 和 Viewport 上使用 shader / Use Shader on Sprites and Viewports

要使用上面定义的 shader,方法很直接,只要设置 Sprite#effect_name 和 Viewport#effect_name 对应于我们设置的值(比如 AlphaBlend2)就可以了。但是要实现一些复杂的效果,还需要把参数传入 shader 中才行。

If you need to use shader defined in previous section, just set Sprite#effect_name and Viewport#effect_name to our pass names (like AlphaBlend2). But you need to pass parameters in your shader if you are going to implement some complicated effects.

在 shader 第一部分的函数上方,我们可以自定义一些全局变量,比如:

On the first part of shader, we can define some global variables. For example:

其中定义 texture 的方式比较复杂。首先需要定义一个纹理资源 texture myparam_tex; ,然后定义一个 sampler 在它的上面采样。sampler_state中可以设置纹理的采样方式,比如 AddressU = Wrap 意味着如果纹理坐标超出了0到1,就会通过循环的方式回到0到1的范围,利用 Wrap 可以做出远景图循环等效果。

Here the definition of texture is a bit complicated. First we create a texture resource myparam_tex, then define a sampler to sample on it. Sampling methods are defined in sampler_state. AddressU = Wrap means texture coordinates will return to the range of 0 to 1 in cycle if it exceeds the range. You can use Wrap to obtain parallax looping effect.

这些参数一旦设置,就可以在自定义的函数中使用了。但为了设置这些参数,在 Sprite 和 Viewport 中,需要调用 set_effect_param,方式如下:

These parameters can be used in custom functions as long as they are set. But you still need set_effect_param to pass value into these parameters:

只要保证第一个名字参数和变量名一样,第二个参数符合变量类型,就没问题了。

You only need to ensure that the first parameter is variable name, and the second parameter fits your variable type.

一些内置 shader 的可用内容 / Some Useful Contents in Built-in Shader

这部分介绍定义在内置 shader 中(但并不是 HLSL 语言特性)的一些变量和函数。它们是 RGD 代码实现的。

This part introduces some built-in variables and functions of default shader (but not a part of HLSL feature). They are implemented in RGD source code.

兼容性 / Compatibility

已知有一些情况会导致 RGD 不能正常运行,请参考下列方式调整:

  1. RGSS300.dll 不受到 RGD 支持。请使用 RGSS301 或更新的版本。
  2. 因为硬件设备支持的纹理尺寸各不相同,太大的图片可能会在载入后自动缩小或出现崩溃等其他问题,所以请确保图片资源大小在 2048×2048 以下。如果需要大幅图片,请把它分割成多张图使用。
  3. AMD 显卡环境下可能会导致出错,这一点还未确定是不是 DirectX9 与 AMD 的兼容性问题或是其他原因,暂时没有解决的办法。

Ruby 脚本方面,RGD 保证和 RGSS3 的行为几乎一致,绝大多数第三方脚本不会引起兼容性问题。

一些第三方脚本使用内存地址等方式对 Bitmap 等对象进行处理,在直接使用 RGD 时可能会遇到兼容性问题。在这里列举一些可能有帮助的解决方法,希望它们不会成为制作游戏的阻碍。

  1. 使用 RGD 内置的功能,如 Font.pixel和Mouse模块,能替代一些特定功能的脚本(如利用半生的文字描绘扩展做像素字体效果,和一些鼠标脚本系统)。
  2. 使用 Bitmap#process_color 处理图片颜色。一些脚本(比如截图存档)会利用内存地址访问位图的数据,但是纹理的数据必须经过 lock 的过程才能编辑,因此建议使用 process_color。
  3. 尽量多使用精灵,并且把特效转移到 shader 中。一些脚本过度依赖位图操作,甚至每一帧都会修改图片,导致性能下降;RGD 的精灵以及 shader 开销都非常小,请尽量使用。
  4. 把一些 Sprite 设置为正确的 Viewport。因为跨图层叠加的行为和 RGSS3 存在差异,所以把带有合成效果的 Sprite 都放在同一 Viewport 内,比如 Scene_Map 的 @viewport1。

如果出现其他兼容性相关问题,会陆续补充到此处。

Some known factors may cause RGD not start properly. Please refer to the following solutions:

  1. RGSS300.dll is not supported in RGD. Please use RGSS301 or newer versions of DLL.
  2. Different hardware may support different texture size, while images with too large size may be automatically resized or cause other problems. Make sure the size of your image resources is smaller than 2048×2048. You may divide large images into multiple partitions if necessary.
  3. Crashes may happen on AMD graphic cards when running RGD. It is still unknown whether the crashes are caused by incompatibility of DirectX9 and AMD graphics. There is no solution for this issue at present.

RGD keeps all the behavior almost the same as RGSS3. Most third-party scripts do not cause any compatibility problems with RGD.

In Ruby scripts, some third-party scripts use memory address to handle Bitmap and other objects. This may cause compatibility problems when they are combined with RGD. Here are some solutions which may help you solve the problems and remove the obstructions when making your game.

  1. Use built-in functions of RGD, like Font.pixel and module Mouse. This replaces some scripts with specific functions (such as pixelated font from tktkgame bitmap extension, and some mouse input systems).
  2. Use Bitmap#process_color to process bitmap colors. Some scripts (such as snapshot on savefile) may use memory address on bitmap to access data. However the bitmap data in RGD is in form of textures and lock/unlock must be used to modify data. So the process_color is recommended here.
  3. Use sprite combinations instead of bitmap processing, while move special effects into shaders. Some third-party scripts rely on bitmap processing too much, even modify bitmaps at each frame, which may cause poor performance. The cost for RGD sprites and effects are greatly reduced. Please make use of them.
  4. Set the viewport of sprites properly. Because of the difference on cross viewport blending with RGSS3, it is helpful to put sprites in one viewport, such as @viewport1 in Scene_Map, if they have blending effects.

Other compatibility solutions will be updated here if new problems are found and solved.

 

使用约定 / Terms of Use

  • RGDirect 可以在 RPG Maker VX Ace 制作的非商业或商业游戏中使用。
  • 请勿用于违反相关国家法律法规的用途,请勿用于伤害他人的合理合法权益。
  • 请勿以制作者之外的其他名义二次发布 RGDirect。
  • RGDirect 的开发者不对使用过程中和使用后的任何问题负责。
  • 如果出现任何冲突,以相关法律法规、Enterbrain 公司的官方规定为准。
  • RGDirect is permitted to use in non-commercial or commercial games made with RPG Maker VX Ace.
  • Do not use RGDirect in violating the laws and regulations of related countries, and do not use it to harm the legitimate rights and interests of other people.
  • Do not republish RGDirect outside the name of the developers.
  • Developers on RGDirect are not responsible for any problems during and after use.
  • In the event of any conflict, laws and regulations of related countries, and the official instructions from Enterbrain Corporation shall prevail.

 

更新记录 / Update Log

  • 2021/3/22 – 1.6.1
    • 回滚到默认Audio,重写的Audio可以在Game.ini使用“OverwriteAudio=1”开启。
    • 修正了绘制和测量文字时间距不正确的错误。
  • 2020/9/15 – 1.6
    • 重写Audio模块,增加若干功能。
    • 增加对Cubism Live2D的支持。
    • 增加对Spine的支持。
  • 2020/7/12 – 1.5.4
    • 修复当Sprite作为child时的visible问题。
    • 修复Sprite在带有children时释放崩溃的问题。
    • 修正了地图循环显示不正确的问题。
    • 控制台输入支持多行。
    • 修复Tilemap没有正确释放导致内存泄漏问题。
  • 2020/5/13 – 1.5.3
    • 修复Font.clone和dup的崩溃问题。
  • 2020/5/12 – 1.5.2
    • 修正background_exec的in_focus和out_focus。
    • 修正tilemap柜台遮挡错误的问题。
    • 修复了blur的实现方式。
    • 修正了color在Font、Viewport、Plane等地方的复制错误问题。
  • 2020/3/20 – 1.5.1
    • 修复Tilemap写入数据崩溃的问题。
  • 2020/3/17 – 1.5
    • 启用了控制台的输入功能。
    • 提升Tilemap的性能。
    • 修复了一些图块意外出现在阴影上方的问题。
    • 修复了Bitmap#clear_rect的问题。
  • 2019/12/31 – 1.4.1
    • 修复 BUG。
  • 2019/12/27 – 1.4
    • 增加 Sprite#shear_x 和 shear_y 来进行精灵扭曲。
    • 增加 Sprite#add_child 和相关的方法。
    • 修复 BUG。
  • 2019/1/9 – 1.3.2
    • 修复 BUG。
  • 2018/12/28 – 1.3.1
    • 修复 BUG。
  • 2018/12/22 – 1.3
    • 重制 Input 模块并把 Controller 放入 Input 中。(Controller.update也被包括在了Input)
    • 提供游戏设置的自定义脚本,可代替原版 RGSS3 的 F1 选单。
    • 修复大量 BUG。
  • 2018/9/2 – 1.2.1
    • 增加 Controller 模块识别 XInput(XBOX360) 手柄操作。
    • 修复一些 BUG。
  • 2018/8/29 – 1.2
    • 增加了Geometry的z和w坐标,以及shader功能。
    • 窗口焦点触发事件改为RGD.focus_in和RGD.focus_out,取消窗口关闭事件。
    • 性能优化。
    • 修复大量 BUG。
  • 2018/7/24 – 1.1.2
    • 修复一些 BUG。
  • 2018/7/1 – 1.1.1
    • 增加Graphics.resize_window功能,直接缩放游戏窗口尺寸。
    • 修复一些 BUG。
  • 2018/6/7 – 1.1
    • 增加了窗口获得焦点、失去焦点、关闭时的回调。
    • 增加了Geometry的图片功能。
    • 增加了调整窗口大小功能。
    • 修复大量 BUG。
  • 2018/5/12 – 1.0.2
    • 增加了 Geometry 类,可以用于在屏幕上直接绘制三角形。
    • 增加了 Viewport 的快速绘制层的功能,便于制作粒子特效等批量精灵效果。
  • 2018/5/9 – 1.0.1
    • 修正了包括文字描绘、图像缩放等方面的大量BUG。
    • 增加了使用 Symbol 访问鼠标状态的方式。
  • 2018/5/4 – 1.0
    • 初版发布。
  • Mar 22, 2021 – 1.6.1
    • Rollbacked to default Audio. The new audio module can be enabled using “OverwriteAudio=1” in Game.ini.
    • Fixed the bug of incorrect spacing when drawing or measuring texts.
  • Sep 15, 2020 – 1.6
    • Re-implemented Audio module and added several functions.
    • Cubism Live2D support.
    • Spine support.
  • Jul 12, 2020 – 1.5.4
    • Fixed sprite visibility as a child.
    • Fixed a crash on disposing a sprite when it has any children.
    • Fixed incorrect display on looped tilemap.
    • Console now supports multiple line input.
    • Fixed a memory leak on incorrect Tilemap disposal.
  • May 13, 2020 – 1.5.3
    • Fixed crashing on Font.clone and Font.dup.
  • May 12, 2020 – 1.5.2
    • Fixed in_focus and out_focus when background_exec.
    • Fixed counter layering bug in Tilemap.
    • Fixed blur implementation in Bitmap.
    • Fixed incorrect copy of color in Font, Viewport and Plane.
  • Mar 20, 2020 – 1.5.1
    • Fixed a crashing bug when setting data to Tilemap.
  • Mar 17, 2020 – 1.5
    • Enabled input for debug console.
    • Enhanced performance for Tilemap.
    • Fixed a bug that some tiles are accidentally above the shadow.
    • Fixed a bug on Bitmap#clear_rect.
  • Dec 31, 2019 – 1.4.1
    • Fixed some bugs.
  • Dec 27, 2019 – 1.4
    • Added Sprite#shear_x and shear_y for sprite shearing.
    • Added Sprite#add_child and some related funtions.
    • Fixed some bugs.
  • Jan 9, 2019 – 1.3.2
    • Fixed some bugs.
  • Dec 28, 2018 – 1.3.1
    • Fixed some bugs.
  • Dec 22, 2018 – 1.3
    • Remake Input module and move Controller into it. (Controller.update is also automatically executed by Input module.)
    • Published a new script for replacing F1 menu of original RGSS3.
    • Fixed lots of bugs.
  • Sep 2, 2018 – 1.2.1
    • Added Controller module to receive XInput(XBOX360) game controller input.
    • Fixed some bugs.
  • Aug 29, 2018 – 1.2
    • Added z and w coordinates and shaders for Geometry.
    • Window events of getting and losing focus changed to RGD.focus_in and RGD.focus_out. Removed window close event.
    • Performance optimization.
    • Fixed lots of bugs.
  • Jul 24, 2018 – 1.1.2
    • Fixed some bugs.
  • Jul 1, 2018 – 1.1.1
    • Added Graphics.resize_window to resize game window directly.
    • Fixed some bugs.
  • Jun 7, 2018 – 1.1
    • Added callback on window getting focus, losing focus and closing.
    • Added bitmap on Geometry.
    • Added resizing window function.
    • Fixed lots of bugs.
  • May 12, 2018 – 1.0.2
    • Added Geometry class, which is used for drawing triangles on screen.
    • Added fast drawing layers on Viewport for batch sprites like particles.
  • May 9, 2018 – 1.0.1
    • Fixed lots of bugs related to text drawing, image scaling and more.
    • Added Symbol parameters on mouse state functions.
  • May 4, 2018 – 1.0
    • RGDirect released.

38 thoughts on “使用 DirectX 驱动的 RPGMaker VX Ace Game.exe

    1. invwindy Post author

      没有违反用户协议的,在RMW已经和官方的人联系过,没有问题。
      源码暂时不打算公开,因为可能比较乱,自己也暂时继续维护着,等没有精力更新了再公开吧。

      Reply
  1. 路过的海豹

    发现换用后会导致地图上第二层开始那些本来显示在玩家角色下方的图块变成覆盖玩家角色(没有其他任何脚本和修改)。

    典型的比如一棵树、一个高塔的下半部分。原版exe的话一棵树下半部分(通行X)会被玩家角色覆盖,而上半部分(通行☆)会覆盖玩家角色
    而换用新exe后只要位于第二层(B)以上的图块就会覆盖玩家角色。

    Reply
    1. rfvtgbzxc

      请问作者知道一个项目吗?https://forum.chaos-project.com/index.php/topic,12899.0.html
      用XP编辑器,Ace的内核来处理游戏内容,请问能否通过一些小更改使得XP的内容可以在大大的项目上运行呢?
      不是伸手党,正在尝试中,感觉光影那个实在是太厉害了,看到了一丝八方旅人的素质。
      不过看了代码感觉又不大可能在RMXP的编辑器下实现,好恨……

      Reply
      1. invwindy Post author

        直接的话小修改程度的可能不行,毕竟XP和VA区别挺大了……
        各种XP转VA工程的项目,应该也只是在“最终”环节才转成VA,并不能一边用XP编辑器一边写RGD代码。
        所以这样看下来可能真的无解。唯一的方法是把素材都丢到VA里然后用VA做吧,基本上XP的功能是VA的子集。唯一XP有优势的地方三层地图,如果使用ULDS或者Overlay这些远景地图的情况下,应该也就不会影响太大啦。

        Reply
        1. rfvtgbzxc

          明白啦,XPA的原理的确是在最后将XP里基础的内容转换掉,包括window这些,测试里面光window初始化就有50%的崩溃几率,难受……
          主要还是搬运数据到RMVA里会比较麻烦,还有不熟悉VA的地图绘制。不过看到这么好的性能感觉也不是太大的代价了23333感谢大大造的轮子
          不过light那个范例1070显卡计算量消耗35%会不会有点过分了……

          Reply
    1. invwindy Post author

      I use Windows API to implement the mouse feature. For example, I use GetCursorPos to get mouse position, and GetAsyncKeyState to get stats of mouse buttons.

      Reply
  2. Tanno Maru

    您好,请问有Geometry对象具体的使用范例或者说明/参考吗?没有特别搞懂这个东西怎么绘制三角形,想做几个位图在同一个的3D透视面上的表现效果~

    Reply
    1. invwindy Post author

      暂时没有更详细的说明……以后Geometry可能会继续更新。要做位图的透视效果需要改w,x y z w是经过变换矩阵变换后的结果(里面还有一些directx的约定我自己也记得不是很清楚)

      Reply
  3. CodeRipper

    您好!请问能够开源吗?我想要移植到linux平台上,建立一个vulkan版本。希望能够开放源代码,或者邮箱联系。谢谢!

    Reply
    1. 13addata

      我也是想做linux的移植,经过一段时间研究我有的疲惫了,于是来这里看看有没有开源,不如你留下邮箱我跟你交流一下?
      不知道你是做x86/x64架构的还是arm,x86/x64有现成方案。 我是苦苦研究arm无果。

      Reply
    1. invwindy Post author

      RGD不限制使用的题材。不过在制作和发布的时候请遵守相关地区法律法规,RGD不对任何作品发生的问题负责。

      Reply
  4. R-YaTian

    可不可以做一个像XP一样可以通过重定义Kernel.exit来控制X掉游戏后执行代码的功能
    比如为exit设置条件分歧满足条件才关闭游戏窗体,不满足则return
    而不是像VA一样,点击关闭按钮/(或ALT+F4)就无论如何会关闭窗体

    Reply
  5. Road

    你好,我发现使用了这个exe后,游戏内容的分辨率就固定了,改变窗口大小只会拉伸窗口内容。有什么办法能取消掉这个效果吗?因为我想改变游戏内容的分辨率

    Reply
  6. Maru Tanno

    冒昧打搅,作者似乎许久没有登陆P1论坛了所以到Blog下面来请教了。
    请问有什么办法可以在Shader里用在Viewport上采样然后把结果输出到另一个Sprite或者Geometry上吗?若能回复感激不尽。

    Reply
      1. Maru Tanno

        在实际使用的时候因为游戏类型需求的原因,我的游戏分辨率是1920*1080,FPS被设置成了120,这个Viewport尺寸又很大,Geometry又需要实时和Viewport同步刷新,结果一秒需求实时描绘了120次尺寸很大的Bitmap,电脑配置差一点的话FPS就掉光了,所以来问一下是否有什么比如依靠Shader的开销更小的解决办法~

        Reply
    1. Road

      最近又发现了几个新BUG:
      1、生成的时候,visible=false的Sprite和Window也会被截进去
      2、透明部分的截图有问题。比如透明度为0.5的图片snap_to_bitmap之后透明度会变成0.25,也就是平方了一次。

      Reply
        1. Road

          前两个问题(rect不为(0, 0, Graphics.width, Graphics.height)的Viewport截图后生成空图片, 截图时没有检测WIndow和Sprite的visible属性)我测试了很多次,是确实存在的。

          透明部分的截图问题应该是在获取颜色的时候,rgb数据多乘了一次透明度的缘故。
          也就是说viewport里原本颜色为(r, g, b, a)的像素,被截图后颜色就变成了(r*a, g*a, b*a, a)

          Reply
          1. invwindy Post author

            好的,我稍后去测试

            编辑:我大概懂了,这个是viewport预乘alpha通道的缘故, 应该无解了(为了最终渲染结果的正确性)

  7. 哇哇哇啊叭叭

    报告一个不知是否是bug的问题:win32api图片反色导致程序崩溃。
    范例游戏《丝丝和条条》在使用RGD1.61后,只要使用“反色”有关的方法,就会崩溃。具体在“QQEat_Bitmap”条目下“Bitmap”类的“invert”方法前后出现的问题。将此方法内容注释掉,就无崩溃情况出现了。

    范例游戏地址:https://rpg.blue/thread-410703-1-1.html

    Reply
    1. invwindy Post author

      你看看有没有用外部的dll,如果用了外部处理bitmap的dll估计是不兼容的。
      可以用RGD的process_color来做反色。

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *