[WIP] Rpg.NET

Started by ForeverZer0, July 14, 2014, 05:25:55 pm

Previous topic - Next topic

ForeverZer0

July 14, 2014, 05:25:55 pm Last Edit: July 16, 2014, 02:15:11 pm by ForeverZer0
    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:

Utility: ShowHide

  • 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



Bitmap Class: ShowHide

  • 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]


Possible: ShowHide


  • particle effects

  • outlines or tooltips (think quest icons from MMORPGs, teammate outlines from Left4Dead, etc.)

  • Networking


[/list]
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Spaceman McConaughey

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

Zexion

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

PhoenixFire

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.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

LiTTleDRAgo

July 14, 2014, 06:38:46 pm #4 Last Edit: July 14, 2014, 06:47:05 pm by LiTTleDRAgo
suggestion?: ShowHide

  • tilemap with zoom & tone change features

  • bitmap anti aliasing

  • draw_3d (from 3dmax / blender) function

  • get bitmap from *.psd & *.tiff function



<3

Zexion

question, why would you need a bitmap from a .psd?

ForeverZer0

Will Do:

  • tilemap with zoom & tone change features

  • bitmap anti aliasing

  • get bitmap from *.psd & *.tiff function



Maybe In the Future:

  • Networking



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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

winkio

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.)

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

LiTTleDRAgo

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....

Wecoc

This is REALLY epic!

Probably dumb suggestion: ShowHide

  • Icon changer



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.

Ryex

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.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

ForeverZer0

Yeah, its an easy thing. I think there is even a simple API function for it.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ForeverZer0

July 15, 2014, 08:04:42 pm #14 Last Edit: July 16, 2014, 12:21:10 pm by ForeverZer0
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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ForeverZer0

* DOUBLE POST *

Mwahahaha. Basic particle system now working. Not a single loss in frame-rate.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zexion

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 ?

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zexion

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