With the discover of how to export methods from managed .NET assemblies, and now the discover of how to manipulate RGSS Bitmaps from within a managed .NET assembly, I can now do all sorts of things that I have only dreamed of before, using my favorite programming language: C#.
For the past few days, I have been working on a library to use in conjunction with script that can add all sorts of various improvements and enhancements to RPG Maker. So far I have implemented a few general "utility" methods, and have been focusing a lot on extending the Bitmap class.
So far, this is what I have:
- Setting the resolution
- Getting the handle to the game window
- Getting the game library
- Getting the game title
- Getting the RTP name(s) and path(s)
- Toggling the console on/off to display output
- Opening a script window to place script calls while the game is running. (Better than the script I wrote long ago...)
- Getting list of installed fonts on the system
- Using the system font picker to change the game font
- Added methods to get/set the saturation, brightness, contrast, and gamma
- Save a bitmap as *.jpg, *.png, *.gif, *.tiff, *.bmp
- Implemented draw_arc function
- Implemented draw_bezier function
- Implemented draw_curve function
- Implemented draw_ellipse function
- Implemented draw_line function
- Implemented draw_pie function
- Implemented draw_closed_curve function
- Implemented draw_polygon function
- Implemented fill_pie function
- Implemented fill_ellipse function
- Implemented fill_polygon function
- Implemented fill_closed_curve function
- Additional image formats (*.tif, *.gif, *.psd, etc.)
- A "snapshot" function that returns a copy of the current client area of the game as a Bitmap
- Reading PhotoShop's *.psd format and creating Bitmap's from it
I have found some very efficient ways of altering RGSS Bitmaps, and I am quite pleased with the performance thus far. I have not really encountered any type of lag or performance loss while testing yet, and I look forward to seeing how much performance I can get from it. I have devised a way of copying the RGSS Bitmap data to .NET Bitmaps through a combination of using Window's "MoveMemory" function and the .NET Bitmap's "LockBits" to just shift around memory without any actual casting to types, etc. That combined with all that is available in .NET's Graphics class and the use of a ColorMatrix, there are some neat things that can be done that Ruby cannot perform efficiently.
What I was hoping to get from this thread was some feedback and ideas on other things that could be implemented. I already have a few ideas that I already have plans for, or have already begin implementing, which I will list here, but please feel free to share your thoughts.
Planned or Partially Implemented: ShowHide [li[Anti-aliasing[/li]
[li]Tilemap rewrite to finally make a good custom resolution system without the performance loss and graphical errors[/li]
[li]Animated color fills (invert, rainbow, etc.)[/li]
[li]HUD (because it updates every frame performance can be an issue in Ruby)[/li]
[li]Tilemap effects (zoom, hue change, etc.)[/li]
[li]Mouse-wheel functions. (Actually already partially implemented a new Input API)[/li]
[li]Change window icon[/li]
[li]lighting / shadows[/li]
[li]Make some suggestions to see them here![/li]
[/list]
- particle effects
- outlines or tooltips (think quest icons from MMORPGs, teammate outlines from Left4Dead, etc.)
- Networking
[/list]
Quote from: ForeverZer0 on July 14, 2014, 05:25:55 pm
- Tilemap rewrite to finally make a good custom resolution system without the performance loss and graphical errors
I love you so fucking much, dood. <3
Quote from: ForeverZer0 on July 14, 2014, 05:25:55 pm
- Setting the resolution
- Added methods to get/set the saturation, brightness, contrast, and gamma
- Save a bitmap as *.jpg, *.png, *.gif, or *.bmp
- Implemented draw_arc function
- Implemented draw_line function
- A "snapshot" function that returns a copy of the current client area of the game as a Bitmap
I need this in my life
If you can manage to get networking to work without lag, AND, really easy to implement to the non-scripter scripters (basically, those of us that can read a script, kind of understand it, troubleshoot it on our own, but don't write our own and need help sometimes), well, then I would probably send you a nice little chunk of whatever profit is made off of any game I make with your stuff in it. You never cease to amaze me sir.
- tilemap with zoom & tone change features
- bitmap anti aliasing
- draw_3d (from 3dmax / blender) function
- get bitmap from *.psd & *.tiff function
<3
question, why would you need a bitmap from a .psd?
Will Do:
- tilemap with zoom & tone change features
- bitmap anti aliasing
- get bitmap from
*.psd & *.tiff function
Maybe In the Future:
Probably Not:
- get bitmap from *.psd &
*.tiff function
- draw_3d (from 3dmax / blender) function
As far as 3D goes, I highly doubt. It would be easier to simply add RGSS support to an existing 3D game maker.
these are all off the top of my head, feel free to choose which ones you want:
lighting / shadows
particle effects
animated color fills (invert, rainbow, etc.)
HUD (because it updates every frame performance can be an issue in Ruby)
outlines / tooltips (think quest icons from MMORPGs, teammate outlines from Left4Dead, etc.)
Well I look forward to that tilemap rewrite 'cuz I've been having difficulties trying to find a universal implementation that works for both XP and XPAce. But I'm pretty sure it's the sprites that are the problem of performance, not the bitmaps.
ah, I forgot to include mouse wheel function to suggestion
http://www.mundorpgmaker.com.br/forum/index.php?topic=10055.0
Quote from: Zexion on July 14, 2014, 06:47:40 pm
question, why would you need a bitmap from a .psd?
because I think it probably will save time, instead save as png for every edit, you can save the file as it is for just CTRL + S
Quote from: ForeverZer0 on July 14, 2014, 06:58:36 pm
*.psd &
oh well....
This is REALLY epic!
Once I tried to get and set the game's small icon with Win32API according to the chapter, but I was no able to do it.
It's not very useful but i'm not inspired... xD If you can get the window handle maybe this will be easy.
actually that's probably not an impossible idea. if you can use window hooks and manipulate bitmaps than you should be able to change the window icon.
Yeah, its an easy thing. I think there is even a simple API function for it.
There is. You can load the icon image and get its handle like this:
hIcon = (HICON)LoadImage(NULL, "new_icon.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
And then just change it.
SendMessage(windowHWND, WM_SETICON, ICON_SMALL, hIcon);
In other words: This can be done with play Win32API. And you have to get the window handle. And constants are not there in Ruby so you have to use their numeric values.
After a little looking into it, adding support for opening *.psd files is going to be added.
Obviously due to the size of *.psd files it will be slower to open them than a *.jpg or *.png, but at least for debugging purposes it can be used.
EDIT:
Implemented loading Bitmap's using from *.psd format. It was actually much simpler than I anticipated.
For some reason, the edits I make to fix the BB code in the OP do not save, and the formatting is off, so I apologize.
* DOUBLE POST *
Mwahahaha. Basic particle system now working. Not a single loss in frame-rate.
That is sick f0. KK20 and I used an existing particle system which caused a noticeable drop in frames in maps that used it.
Also, what exactly do you mean by HUD? Is there some kind of default HUD that I'm not aware of xD ?
Quote from: Zexion on July 19, 2014, 03:31:05 pm
That is sick f0. KK20 and I used an existing particle system which caused a noticeable drop in frames in maps that used it.
It's all about how the drawing is implemented. Directly accessing the memory of bitmaps without any converting, using buffers, and drawing all once is what I have found successful. I am not working with actual Bitmap objects, but merely the area on the RAM where they are located. They are simply stored as a long line of bytes, where every 4 bytes is a color in BGRA format, so knowing that, a lot of manipulation can be done without any casting/converting. I haven't used anything other than GDI for a lot of drawing methods, and I simply copy the C# Bitmap's memory into the place of RGSS's Bitmap's memory.
Quote from: Zexion on July 19, 2014, 03:31:05 pm
Also, what exactly do you mean by HUD? Is there some kind of default HUD that I'm not aware of xD ?
No, there is no existing HUD, but I could probably implement some sort of API to handle the drawing of a HUD.
Ah that sounds like the complicated stuff that kk20 is doing. I know nothing of casting D:
Quote from: ForeverZer0 on July 19, 2014, 03:55:40 pm
No, there is no existing HUD, but I could probably implement some sort of API to handle the drawing of a HUD.
Ah I see. Combined with your bitmap methods, this could replace my entire HUD xD