[RGD] DirectX implementation of RGSS3

Discussion in 'Useful Development Tools' started by invwindy, May 13, 2018.

  1. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Noticed another difference between RGD and the default engine. Yay! :D

    In the default engine, if a sprite's zoom would get below 0, it would simply disappear, and the zoom level is corrected to 0.
    In RGD, it is possible to get negative zoom levels, no correction happens here, and if that happens, the sprite won't disappear, it will start to appear again with inverted canvas (at least I think it's inverted, but my images with this issue are almost symmetric, so it's hard to see).
    No idea if it is intended (I can see some uses for this), but even if it is, it should be an optional thing, so it should correct negative values unless this optional flag is enabled for the sprite.

    This negative zoom issue can be prevented by correcting the zoom level manually in our code, that's true, but there are serveral scripts out there which don't bother to do that (not made by me - I can correct mines if there is any with this issue), so it's kinda time-consuming to edit all of those in a big project.

    Aaaand... another thing I noticed...
    The wave effect looks really bad when the sprite's src_rect is changed.
    For example, you only show a portion of the image with the sprite by setting the src_rect's properties (x, y, width and height). When a wave effect is used on a sprite like this, the wave effect is not centered on the shown portion of the image, instead it still does the wave effect on the whole image. This leads to pretty bad looking wave effects, especially on smaller images. >.>
    Can the wave effect be set to account for the shown portion of the image only? I really need a fix for this, I use tons of animated image sheets with wave effects, and those look ugly with the current the wave effect.

    Edit again! >.>
    There seems to be an issue with the clear_rect method of the Bitmap class in RGD.
    [​IMG]
    See that empty space in the middle of that obvious testing area? That was made with the clear_rect method, but...
    The height argument I used for that clear_rect method was 200... It's clearly not... clearing that much, right? >.>
    No matter what I do, I can't clear anything below that area in the window, I can move around that clearing area, I can increase it's size even further, it still won't clear anything past that area.
    The fill_rect method works fine, as you can see (the red testing area was made with that), so I wonder what went wrong with the clear_rect method...
    This only happens with RGD installed, so the issue must be in RGD.
     
    Last edited: Nov 23, 2018
  2. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    Working on key config and more game settings and fixing existing bugs
    try to replace F1 menu with an in-game interface

    [​IMG]
    [​IMG]
     
    Archeia, Zeriab and BCj like this.
  3. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Glad to see you are still working on this!

    I noticed a compatibility issue with RGD and Cidiomar's Perfect Pixel Collion System, which is kinda an issue for me, since that script (well, DLL) is the only thing that can actually detect precise collision between two sprites regardless of their rotation, zoom level and other visual modification in VX Ace.
    I suspect it has to do with it using the bitmap's object IDs for something, probably to read their colors, but I'm just guessing here, since I can't open and check the source code in that DLL (sadly >.>).

    Is there any way to make these compatible somehow? Or is there any chance that you can make a similar DLL working with RGD? Just asking because it's a pretty important feature in many of my "mini-projects" where precise (and fast) collision detection is crucial (mostly shooting games and some other 2D physics based games using projectile reflection).
    If you need Cidiomar's script and DLL for debugging, I can upload them for you. Tried to find the link where I got them, but got tired of searching. >.>

    The other compatibility issue I found is with KGC_BitmapExtension script/DLL. I use this one to make circular and other non-standard gauges with images, but it crashes when I try to use any of it's region based drawing methods.
    If there is already a way to draw in non-standard areas without this script in RGD, I would like to get some info on it, well, when you have the time to share it, of course.
    If there isn't a way with RGD, is there a way to make this script/DLL compatible? Or any plans to add these drawing methods into RGD in the future?

    Also, no idea if this is reported already or not, but most of the tiles (possibly all, but I haven't tested them all, so can't be sure) from the B, C, D, E tileset parts are draw above the default map shadows, and above any events with "Below Characters" priority. There are also some tiles from the A tileset parts doing the same.
    Only tiles marked with "star" passability should appear above characters,, if I remember right.
    I don't use the default map stuffs in my projects, so it's not an issue for me, but it's certainly one for people who do their mapping the default way.

    The control configuration looks nice, although I don't like the default limitation you choose to follow (the gamepad buttons linked with keyboard keys).
    Well, it may even be expandable, can't tell from the screenshots only, so if it is, disregard the above. :D
     
  4. BCj

    BCj Veteran Veteran

    Messages:
    1,395
    Likes Received:
    655
    Location:
    NL
    First Language:
    Dutch
    Primarily Uses:
    N/A
    Any chance of an update to the lightning script with x/y implementation as well? :)
     
  5. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    Here is a reply for @Sixth . I'm quite sorry that I cannot solve all of your problems. But your advice gives really great help to RGD.

    1、Some GPU may lock FPS on 30. It occurs on my laptop when fullscreen is on. I am also not sure how to fix this issue. If you need your game updating without Graphics.update lagging the performance, a timer is needed for calculating time cost for Graphics.update and skip some updates if the previous update takes too much time. I thought about adding this function in RGD but this function can be implemented in ruby script editor.

    2、I have given up implementing Audio module with API or third party libraries. Default Audio module is fit for most RPG in function and performance. BTW it is really a nightmare to implement a complete audio module from windows raw API.

    3、Graphics.filter in RGD modifies sampling filter in fullscreen or expanded game window. When the filter is set to 0, nearest neighbor method is used and pixel effects are preserved. When the filter is set to 1, linear interpolation is used and the resized sreen looks more smooth.

    4、Thank you for finding my forgetting disposals in the lighting script. I have fixed them with your method and fixed some other bugs that have been reported. Is it valid to start a new thread storing scripts for RGD? I'll post the updated lighting script and F1 game setting script there.

    5、I decide to keep the negative zoom flipping effect. (Sorry for my wayward.) If you need to keep the zoom positive, you may override Sprite#zoom_x=(value) and Sprite#zoom_y=(value) and add the comparison here.

    6、Wave effect in RGD has not been polished. It may be a bit complex to fix src_rect problem. I'm even planning to implement wave in a brand new way. If you need the effect in the project, you may create a partial bitmap using blt, then use the small bitmap in sprites.

    7、For the problem on clear_rect, I found that I have wrongly written a Width instead of a Height. It is fixed in the next update.

    8、I cannot think about good pixel collision solutions at this time, so it may take some more time for me to decide. One problem is real time efficiency for this collision detection. It may be hard for large image pixel collision tests. The other problem is the representation of collision results. It may be represented as collided pixels or directions, but both of them are not perfect. On the other hand, modern games always use geometry based collision detection. A complex game object can be divided into several rectangles or triangles. I recommend using collision detection in this way.

    9、Map priority problems have been fixed. If this still occurs in future versions, please describe the example for me.

    10、New Input module is limited in keyboard, including key settings in the F1 menu. I may add controller in Input.dir4 but not sure. Another way for moving player using controller is to override Input#dir4 and add Controller.thumb_left_dir4 or Controller.thumb_right_dir4 into it.

    New version of RGD is still on progress. I am trying to add Graphics.play_movie now.
    @BCj you can create a sprite on map and use [offx] and [offy] to adjust light position.
     
  6. BCj

    BCj Veteran Veteran

    Messages:
    1,395
    Likes Received:
    655
    Location:
    NL
    First Language:
    Dutch
    Primarily Uses:
    N/A
    I'm not sure what this means. Can you post a sample?
     
  7. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    After reviewing the script, I have found that I was already using absolute position lights in particles. However the interface is not fit for custom light creation. I may add this function later.
     
  8. BCj

    BCj Veteran Veteran

    Messages:
    1,395
    Likes Received:
    655
    Location:
    NL
    First Language:
    Dutch
    Primarily Uses:
    N/A
    But.. if I set the code to load a light source as you've done on the sample, how can I change the x-y position of that image on screen? Like, I want it 5 pixels to the right instead of where it is now?
     
  9. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    You can write "[offx]5" in the comment. Similarly [offy] makes vertical offsets.
     
  10. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Are you sure these comments are implemented in the current public version?
    I got the demo with the lighting script when the latest RGD version came out, and these comments weren't implemented yet.
    I even made an addon for making offset settings in the script because I needed that feature as well.

    I just checked it, and it's not implemented in the version I have right now.
    I also noticed this line in the description/manual "script":
    Code:
    Designed for RGD v1.3 and later versions.
    I suppose that's a typo there? The latest public version is 1.2.1, or did I miss something? o_O

    There were also a missing default value for some light setting, it was a numeric :cast_ option, forgot which one exactly.

    Anyway...
    The GPU issue can be solved by adjusting that setting I mentioned a few posts before, so it's not a game-breaking issue.
    Huge thanks for that filter option for fullscreen mode! That makes it easy to just drop a new option in my settings script.

    I'm a bit sad for that wave effect, but we can't have it all, right? I will survive... somehow, I guess. :D

    That map display error happens when events with "Below Characters" priority setting walk around on tiles that have been painted with (probably) any tiles from the B, C, D, and E tileset types, even some tiles from the A tileset appear above these events. I checked this in version 1.2.1, so if there is a new version out already, it may be fixed already in that one. Same issue with the default shadow from the map editor, those also appear below these tiles.

    And I got another question regarding fullscreen toggle...
    I tried out the toggle_fullscreen method, and it works fine.
    But according to my tests, when the player presses ALT+ENTER, a different method is run, because the debug print I added from the toggle_fullscreen method didn't trigger. Can we get a method that runs when the player toggles the fullscreen with ALT+ENTER too? It's kinda necessary for some features I got in mind regarding the mouse cursor.
    I got around this issue by disabling the ALT+ENTER key combo and adding my own input to toggle fullscreen with the toggle_fullscreen method instead, but that presented another issue, which made it impossible to do any key combos with ALT in it, and I need that feature too. Plus the method is_fullscreen? returned false the first time the game is set to fullscreen that way, no matter where I put the check for it (it only works as intended after the first toggle).

    And sure, if you want to separate the discussions regarding the lighting script (and any other future scripts written for RGD) and RGD itself, you should definitely make a new topic for these scripts in the RGSS3 Scripts section of the forum.
     
  11. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    Thank you for the explanation. In the coming new version all the functions in the documents and comments are going to be implemented.
    Alt+Enter is running an internal function which may not overrided by Graphics.toggle_fullscreen. It may be better to call Graphics.toggle_fullscreen in ruby when pressing Alt+Enter. Your suggestion is great! I also added Graphics.fullscreen = true/false for setting fullscreen manually.
     
  12. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    The last function of RGSS3, Graphics.play_movie, is almost finished.

    [​IMG]

    Video playing in RGD only supports WMV files. (It's really hard to find decent video codecs for other formats ... Most of the codecs are under GPL licences, which is hard to handle with you know)
    New functions Sprite.play_video are also added. Sprites playing videos cannot use other shader effects (because I use a video shader to map RGB colors to RGBA channels). But sprite properties like position, zooming and rotation still work.
     
  13. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,702
    Likes Received:
    720
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    sssssssssssssooooooooo........ animated menu backgrounds? maybe?

    please say yes please say yes please say yes please say yes :LZScheeze:
     
  14. Valentine90

    Valentine90 Veteran Veteran

    Messages:
    36
    Likes Received:
    12
    Location:
    Brazil
    First Language:
    Português
    Primarily Uses:
    RMVXA
    Please allow me to
    1) disable the pause function while the window is minimized; and
    2) disable text compression.
     
  15. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    Sorry, it looks that animated menu can be implemented in ruby scripts. So I do not count as an RGD function.

    I am trying to add background executing but there are still some small issues. I will fix them before publishing the new version.
     
  16. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA


    A new version of lighting script as well as a new demo is under construction! Many thanks for the lovely design from congwsbn!
     
    BCj likes this.
  17. JakenBear

    JakenBear Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Having a very minor issue with 1.3 hopefully someone can help fix.
    We have a custom script for an input function as follows:

    def self.check_any_key
    return true if Input.trigger?(Input::A)
    return true if Input.trigger?(Input::B) #this is B, not a smiley face
    return true if Input.trigger?(Input::C)
    return true if Input.trigger?(Input::X)
    return true if Input.trigger?(Input::Y)
    return true if Input.trigger?(Input::Z)
    return true if Input.trigger?(Input::L)
    return true if Input.trigger?(Input::R)
    end

    When running with RGD 1.3 at startup we get the following error:

    "Script 'Custom_CORE' line 19: NameError occurred.
    Uninitialized constant Input::Z"

    If we comment out this line: return true if Input.trigger?(Input::Z)
    the error goes away but the enter key is no longer functional.

    Any script masters have a fix to initialize Input::Z or is that missing from RGD 1.3?
    Thanks!
     
  18. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA
    Input::Z is missing in RGD 1.3. Thank you for reminding me!
     
  19. JakenBear

    JakenBear Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    No problem! Glad to help and glad to see it will be fixed. Really nice work on RGD by the way.
     
  20. invwindy

    invwindy Ice Fairy Veteran

    Messages:
    64
    Likes Received:
    58
    First Language:
    Chinese
    Primarily Uses:
    RMVXA

Share This Page