Rpg.NET
Authors: ForeverZer0
Version: 0.28A
Type: Managed RGSS API
Key Term: Scripting Tool
IntroductionRpg.NET is an API built using the .NET Framework for both improving performance and enhancing the RPG Maker series (XP, VX, and VXA). Contained within are various functions and classes that extend the ability of RPG Maker in areas such as graphics, audio, and Windows API interop. Included is a Ruby script that is the wrapper around the library, so it can be used as any other script within your game.
FeaturesGraphics
- Lag-Free Particle Engine
- Save Bitmap as *.png, *.jpg, *.bmp, *.gif
- Load Bitmap from *.psd, *.tif
- Get/Set Bitmap Hue
- Get/Set Bitmap Saturation
- Get/Set Bitmap Contrast
- Get/Set Bitmap Brightness
- Get/Set Bitmap Gamma
- Bitmap#draw_text_vertical
- Bitmap#draw_arc
- Bitmap#draw_bezier
- Bitmap#draw_beziers
- Bitmap#draw_closed_curve
- Bitmap#draw_curve
- Bitmap#draw_ellipse
- Bitmap#draw_line
- Bitmap#draw_lines
- Bitmap#draw_polygon
- Bitmap#draw_pie
- Bitmap#fill_closed_curve
- Bitmap#fill_ellipse
- Bitmap#fill_pie
- Bitmap#fill_polygon
- Bitmap#fill_gradient_rect
- Bitmap#fill_gradient_ellipse
- Bitmap#fill_gradient_polygon
- Bitmap#color_mask
- Bitmap Effect - Invert
- Bitmap Effect - Pixelate
- Bitmap Effect - Change RGBA Color Components
- Bitmap Effect - Soften
- Bitmap Effect - Gaussian Blur
- Bitmap Effect - Sharpen (Multiple algorithms)
- Bitmap Effect - Edge-Detect (Multiple algorithms)
- Bitmap Effect - Emboss (Multiple algorithms)
- Bitmap Effect - High Pass
- Bitmap Effect - Grayscale
- Bitmap Effect - Poster Effect
- Bitmap Effect - Bitonal
- Bitmap Effect - Median Filter
- Bitmap Effect - Tint
- Bitmap Effect - Color Balance
- Bitmap Effect - Solarise
Audio
- Get duration of audio files, in milleseconds (*.mid not supported)
- Get duration of audio files, in frames (*.mid not supported)
Utility
- Get RTP Path(s)
- Get Full-Path to Resource File
- Change Window Resolution
- Show/Hide Output Console
- Screenshot Window (with or without window frame)
ScreenshotsOriginal Image(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue0.png)
Hue: 60
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue60.png)
Hue: 120
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue120.png)
Hue: 180
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue180.png)
Hue: 240
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue240.png)
Hue: 300
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Hue/hue300.png)
Saturation: 0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Saturation/sat0.png)
Saturation: 50
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Saturation/sat50.png)
Saturation: 100 (Default)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Saturation/sat100.png)
Saturation: 150
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Saturation/sat150.png)
Saturation: 200
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Saturation/sat200.png)
Brightness: 0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright0.png)
Brightness: 25
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright25.png)
Brightness: 50
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright50.png)
Brightness: 100 (Default)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright100.png)
Brightness: 150
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright150.png)
Brightness: 175
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright175.png)
Brightness: 200
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Brightness/bright200.png)
Contrast: 1
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast1.png)
Contrast: 50
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast50.png)
Contrast: 100 (Default)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast100.png)
Contrast: 150
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast150.png)
Contrast: 200
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast200.png)
Contrast: 250
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast250.png)
Contrast: 300
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast300.png)
Contrast: 350
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast350.png)
Contrast: 400
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Contrast/contrast400.png)
Gamma: 1
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma1.png)
Gamma: 50
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma50.png)
Gamma: 100 (Default)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma100.png)
Gamma: 150
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma150.png)
Gamma: 200
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma200.png)
Gamma: 250
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma250.png)
Gamma: 300
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma300.png)
Gamma: 350
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma350.png)
Gamma: 400
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gamma/gamma400.png)
Converts an image to two colors only. The dark and light colors are specified with a threshold to determine what a "dark" color and what a "light" color are.
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Bitonal/bitonal1.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Bitonal/bitonal2.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Bitonal/bitonal3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Bitonal/bitonal4.png)
There are numerous types of blur filters included, and a custom filter that allows you to specify the factor applied, but here are a few examples:
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur0.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur1.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur2.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur4.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur5.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Blur/blur6.png)
Uses convolution filters to detect edges between pixels. There are numerous types of filters to use, and likely going to be many more added to get different effects, but here are some of the built-in ones, including both colored and grayscaled versions:
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect0.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect0_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect1.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect1_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect2.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect2_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect3_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect4.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Edge%20Detect/edgedetect4_grayscale.png)
Uses convolution filters to apply an emboss effect. There are numerous types of filters to use, here are some of the built-in ones, including both colored and grayscaled versions:
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss0.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss0_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss1.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss1_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss2.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss2_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Emboss/emboss3_grayscale.png)
I implemented the methods to calculate kernels for Gaussian Blurs, therefore you are not forced to only use built-in blurs, but can customize them for your own images, specifying the kernel size and weight. Some examples:
Kernel Size: 3, Weight 11.0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gaussian/gaussian3-11.png)
Kernel Size: 5, Weight 5.5
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gaussian/gaussian5-5_5.png)
Kernel Size: 9, Weight 13.0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gaussian/gaussian9-13.png)
Kernel Size: 11, Weight 7.0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Gaussian/gaussian11-7.png)
A Median Filter can be applied to images in order to achieve image smoothing or image noise reduction. The Median Filter in contrast to most image smoothing methods, to a degree exhibits edge preservation properties. Here are some examples, including grayscaled versions:
Matrix Size: 3
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median3_grayscale.png)
Matrix Size: 5
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median5.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median5_grayscale.png)
Matrix Size: 7
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median7.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Median/median7_grayscale.png)
Allows you to define the pixel size of a Bitmap, removing detail.
Pixel Size: 2
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Pixelate/pixelate2.png)
Pixel Size: 4
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Pixelate/pixelate4.png)
Pixel Size: 8
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Pixelate/pixelate8.png)
There are numerous filters to sharpen images, but here are a few examples of the effect's achieved:
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen0.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen1.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen2.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen3.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen4.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen5.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Sharpen/sharpen6.png)
Image Solarisation can be described as a form of Image inversion/colour inversion. A distinction can be made between solarisation and colour inversion when taking into regard threshold values implemented when performing image solarisation.
R:0 G:200 B:32
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Solarise/solarise0-200-32.png)
R:96 G:255 B:255
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Solarise/solarise96-256-256.png)
R:128 G:255 B:192
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Solarise/solarise128-255-192.png)
R:192 G:224 B:64
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Solarise/solarise192-224-64.png)
Allows you to add a tint to a Bitmap by specifying percentage of each color component to increase.
R:0% G:45% B:15%
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Tint/tint0-45-15.png)
R:10% G:20% B:30%
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Tint/tint10-20-30.png)
R:32% G:64% B:0%
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Tint/tint32-64-0.png)
Applies the color balance to the image, using the specified color.
R:0 G:200 B:32
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Balance/color_balance0-200-32.png)
R:96 G:256 B:256
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Balance/color_balance96-256-256.png)
R:128 G:255 B:192
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Balance/color_balance128-255-192.png)
R:192 G:224 B:64
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Balance/color_balance192-224-64.png)
Gets a mask from the specified color and threshold.
R:0 G:0 B:0 A:0, Threshold: 0
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Mask/color_mask0-0-0-0_0.png)
R:228 G:83 B:63 A:255, Threshold: 32
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Mask/color_mask228-83-63-255_32.png)
R:228 G:167 B:16 A:255, Threshold: 48
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Color%20Mask/color_mask228-167-16-255_48.png)
Runs a high-pass filter across the Bitmap. Here are examples of both normal and grayscale:
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/highpass.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/highpass_grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/grayscale.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/invert.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/poster.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/sepia.png)
(https://dl.dropboxusercontent.com/u/20787370/Rpg.NET/Images/Misc/soften.png)
DemoRpg.NET Developer Release Demo (v.0.25) (http://db.orangedox.com/LM7R42y2TY5jCmRRk7/Rpg.NET%20Dev-Release.zip)
ScriptInside demo. (v.0.25)
Version 0.28AScript (http://pastebin.com/VPKerCmM)
Rpg.NET.dll (https://sourceforge.net/projects/rpgnet/files/Rpg.NET.dll/download) (701 kB)
InstructionsAs this is not currently a stable release build, I would not suggest using it in a release game at this current time. Although everything within at this time will remain in it, and you can begin to utilize what it has in your game, there are numerous improvements that need to be done,
CompatibilityShould work with RPG Maker XP, VX, and VXA, although testing has only been done with RPG Maker XP. Before final release, all versions will be tested to ensure compatibility.
Requires Microsoft .NET Framework 3.5 (http://www.microsoft.com/en-us/download/details.aspx?id=21). This is standard on Windows 7 and higher operating systems, and USUALLY installed on Windows XP and Vista systems if updated normally. If distributing with your game, I would suggest providing the above link just in case.
Credits and Thanks
- ForeverZer0, for the library and script
- All those on Chaos-Project who have offered ideas on functions to implement, and those who will continue to do so
Author's NotesThere are still quite a few things to implement, I wouldn't even consider this library 1/4 finished at the current time, so please keep that in mind. I have many planned features that have been suggested yet to implement, as well as many others not yet mentioned, such as Input and Audio extensions, Tilemap rewrites to support greater resolutions, and additional Graphic functions. I would appreciate if you have any ideas, to please share them, I am compiling a list, and slowly working through them, this release is simply to show how progress is coming, and to inspire new ideas.
If you encounter any bugs and/or crashes, please report them here in this thread so that they can be addressed. As I stated earlier, testing is currently only being performed on RPG Maker XP, so there may be errors with VX and VXA that I am currently unaware of.
I would like to hear about your experience as far as performance goes with the graphical functions. I have done my best to maintain the highest degree of performance with Bitmap manipulation, using only pointers to unmanaged memory wherever possible. As of right now, the only functions that do not implement this are the hue, saturation, contrast, brightness, and gamma methods, they use a color matrix, but I am in the midst of re-writing them functions to use unmanaged methods, and compare benchmarks.
The particle generators are rather lame at the moment, and only three very basic types currently exist. I was working more on just getting the underlying engine to work and perform efficiently than develop nice effects, but expect more to come in that area in future releases.
Lol, Sepia. Now everybody can use it on Instagram.
I don't know if I should go with XX Pro or Valencia--I wanna look tan
I'll be sure to give this a spin and test for performance and the like. Meanwhile, what's your plan for the Tilemap rewrite--using the same theory/method as your Custom Resolution or following the traditional RMXP standards?
Working on it right now, actually.
At the moment I am loosely following the same formula as the script, using a sprite for each priority, but if I can't remember if there were bugs with that aspect of the script or not. Once I get a working version going, I can make alterations from there.
I do remember I was having some issues with autotile updates, but that problem is now taken care of.
EDIT:
Oops, just noticed I had a link to a page that wasn't there except for admins. Changing it now.
The main issue with that method was wonky z-level sprites. But because of its simplicity and lack of sprites, it provides a better performance at higher resolutions. One of my biggest problems was calling the DLL to redraw the screen many times led to a significant drop in FPS (1024x576 resolution). While I could make bitmaps as big as the map itself (like how Custom Resolution did it) and avoid having to update every frame now, it also eats up my -now- dismal memory. So I tried using 24 sprites/bitmaps as big as the window, redrawing only when I really needed it to. It didn't use as much memory and the update times were pretty solid (~50+ FPS standing still and 45 FPS when moving).
I don't know if this is because of my processor (Intel first gen), but more modern computers seem to handle this fine and keep a steady 60 FPS. It's probably because of my heavy use of memcpy.
I'm pretty sure there's no way to cater to everyone's needs when it comes to larger resolutions. Maybe I should just accept that and stop finding a way to keep performance good for computers built in 2010 or older.
I don't understand why you would need to redraw so many times. Aside from autotiles, the map only needs drawn once, and for them you only need to redraw that specific area if it's within the visible screen.
As for using memcpy, have been steering clear of that method so far. I started using RtlCopyMemory (same as memcpy), but I found it far more efficient to just edit the bytes in place when it comes to Bitmaps, and there is far less RAM use not making copies of everything.
If you plan on drawing a whole 500x500 map, you're going to need 3GB+ of memory to pull that off. Even a 200x200 requires 1GB or so. Thus, to combat this, I only make bitmaps as big as the game's window so I have to still redraw but at a fraction of the cost.
I'll take a look at that method and see if I notice any changes.
True, I did some quick math and a 500x500 map with 6 bitmaps (each priority) comes to 6.144 GB.
That's pretty bad, lol.
Only drawing the screen is pretty good on RAM. The standard 640x480 screen with 6 bitmaps is a little less than 7.5 MB.
I think I will do some blend of the two. I created an RMXP editor using XNA a year or so ago (never quite finished yet...), and I had good performance only drawing the visible screen, but obviously my methods there were different.
for some reason, chrome does not even let me touch this xD
Quote from: Zexion on July 23, 2014, 04:35:31 pm
for some reason, chrome does not even let me touch this xD
As in, you can't go to the page, or you just can't download it? I only ask because I am trying out Orangedox right now, which tracks download counts from Dropbox, thought maybe it has something to do with that. You could always try a different browser, Chrome is funny like that sometimes...
@KK20:
I was thinking about the Tilemap thing again. Since recalculating and drawing the whole window every time the ox or oy changes is obviously inefficient, what if you only draw the a new row or column of tiles, depending on which way the origin changed, and simply copy the rest of the screen over. Just keep like a 64 pixel buffer around the screen of drawn material, and update it every time the origin moves more than 32 on either axis. Your actual Bitmap sizes will only be 768x608 at the max (if using 640x480) resolution, but will only need updated a fraction of the time, and most of that is just a large block transfer, only a the new edge will need recalculated and drawn from scratch.
I think I am going to attempt something similar to this. It should *hopefully* be a minimal on RAM, and vastly limit the number of times and how much of the screen needs redrawn.
Well at first I couldn't go to the page, but a few minutes later I could :b
Then chrome did that thing where it marks the file as malicious and deletes it automatically. Downloaded it in IE
Edit:
Is it possible to do anti-aliasing on the drawn bitmaps? Like the ellipse/line/etc. ?
Quote from: Zexion on July 23, 2014, 05:22:12 pm
Is it possible to do anti-aliasing on the drawn bitmaps? Like the ellipse/line/etc. ?
Yes, I just haven't implemented it yet. I need to add Bitmap#.anti_aliasing = BOOLEAN property, and then edit all the drawing methods to draw different ways depending on how it is set. I can also include a static property for the actual class which will set the default for all new Bitmaps so you don't need to set it for everyone. Using higher quality means lower performance, but I don't think its going to make any difference at all with the drawing methods, there isn't much overhead with them at all. There are some optimizations I would like to make them anyways, so I will update them both at the same time when I get the time.
Dunno if anyone else has noticed this, but as long as I'm moving the mouse over the RGSS window, the game lags or stands still.
I was testing some mouse input stuff, I may have forgotten to remove it from the demo.
I will check it out and update it.
suggestion :
- can you separate bitmap effects with destructive & not destructive method (like MACL)?
ex :
[/list]
bitmap = Bitmap.new("Pictures.png")
inverted = bitmap.invert
a = Sprite.new
a.bitmap = bitmap # returns original image (not modified)
b = Sprite.new
a.bitmap = inverted # returns inverted image
original bitmap is not modified so it can be used for other methods without reloading the bitmap
bitmap = Bitmap.new("Pictures.png")
bitmap.invert!
a = Sprite.new
a.bitmap = bitmap # returns inverted image
this one modifies the original bitmap
- add flip_horizontal, flip_vertical
about the tilemap, I was thinking about combining your method & King's method
- for priority 0 & 5, combine all tile in all layers into one bitmap like custom resolution v9.4
- for priority 1-4, split it into several bitmap & calculate all the z value like King's tilemap does.
this probably will solve the z glitch
- if I can illustrate it, it will be like this:
(http://i.imgur.com/rz2rAeK.png)
- after drawing all the bitmaps, save the bitmaps as external files so when visiting same map / reload the game,
you can just load the bitmaps & skip all the drawings
@F0
I just recently tried to do that. Even though my redrawing of the edges is wrong, it's still running through the typical amount of code I'd expect it to. FPS went from 50 (standing still) to about 33 (scrolling). And how would one move large blocks of bytes? I just passed in how much ox/oy changes and use memcpy(layer, layer + shiftamount, shiftamount * 4) or something of the like.
@Drago
Well, priority 5 is wrong :P It should follow suit of the 1-4 priority levels as well. But if we can alter the idea of priorities, that'd help cut down on the sprites and bitmaps. I mean, XP is the only engine that has this. All the others have a "*" priority that just symbolizes it's floating in the air.
Also, how big are those bitmaps supposed to be? Screen-sized or entire map-sized? If it's screen-sized, you still have to do some redrawing. Entire-map sized and you're just playing with memory.
Levels Earned F0, Levels Earned.
F0, my babies.
Just have them.
I love you!
@kk20
I was thinking for small / mid sized, entire map is okay,
but for bigger maps, maybe it will be like continuous maps,
and if we can save the drawed tilemaps into external files,
probably it can save some memory if carefully played.
(dispose & reload the bitmap & skip redrawing entire map) .
also, we can cut down the number of sprites if there is no tile in specific rows / priority.
ex: if there are no 'priority 5' tiles in the map,
then we can dispose & replace all 'priority 5' sprites into a dummy (like I did in custom resolution 9.7e)
Quote from: LiTTleDRAgo on July 23, 2014, 11:07:34 pm
can you separate bitmap effects with destructive & not destructive method (like MACL)?
Yes, will do. Done.
Quote from: LiTTleDRAgo on July 23, 2014, 11:07:34 pm
add flip_horizontal, flip_vertical
Done.
Quote from: KK20 on July 24, 2014, 12:36:50 am
And how would one move large blocks of bytes?
The same way one moves any amount of bytes. It takes a couple calculations to factor in the new stride, etc. since you are moving a rectangle of data out of something that is aligned in linear fashion, but it would have to be more efficient than moving the same number of bytes in 1000 separate operations.
EDIT:
I implemented anti-aliasing for all the drawing methods, I just made it do it by default. There is no loss in performance, and I don't see someone not wanting to use it, so there I didn't include a setting for it, which would just add more to arguments/methods to the Bitmap class.
Quote from: LiTTleDRAgo on July 24, 2014, 01:42:47 am
@kk20
I was thinking for small / mid sized, entire map is okay,
but for bigger maps, maybe it will be like continuous maps,
and if we can save the drawed tilemaps into external files,
probably it can save some memory if carefully played.
(dispose & reload the bitmap & skip redrawing entire map) .
Sounds logical, but who knows what the computer will think. Drawing the tilemap is not the issue--it's updating the bitmap too frequently. Saving a bitmap drawing I don't think will help with speed. As for the breaking up the map into smaller ones, what if I'm at a location where all four corners of 4 separate maps meet? You'd need to save the bitmaps in memory for that, following your idea. Otherwise, we come full circle back to "updating the bitmap frequently" again.
Quote
also, we can cut down the number of sprites if there is no tile in specific rows / priority.
ex: if there are no 'priority 5' tiles in the map,
then we can dispose & replace all 'priority 5' sprites into a dummy (like I did in custom resolution 9.7e)
I found that calling
Sprite.new gets pretty slow. The dummy idea was probably one of the reasons for the lag I was getting. And I think "cutting priority" should be left as a configuration option. Don't forget about $game_map.data[x,y,z] = n. It's a necessity for my project.
Quote from: KK20 on July 26, 2014, 06:29:35 pm
I found that calling Sprite.new gets pretty slow.
@F0: How are you organizing the sprites?
* UPDATES SCRIPT AND LIBRARY *I added a bunch of stuff, I don't even remember everything, lol. Here's what I do remember:
- Added custom Input module to script, with high efficiency input handling in the library. Allows for detecting double-clicks, mouse movement, mouse-wheel, etc. I hope to improve this by the next release to also, maybe add some new stuff like vibration. I also need to add an easier way to find the configuration, its buried at the bottom of the script, but since this isn't a final release, I am not worried about it yet.
- Added anti-aliasing to the bitmap drawing methods
- Add vertical text drawing
- Added gradient text drawing (both horizontal and vertical)
- Added non-destructive variations for all the bitmap effects
- Various Sprite effects
- Added script call window
Quote from: Blizzard on July 27, 2014, 02:25:17 am
Quote from: KK20 on July 26, 2014, 06:29:35 pm
I found that calling Sprite.new gets pretty slow.
@F0: How are you organizing the sprites?
Sorry, didn't see until now. I haven't figured out exactly yet. I was messing around with simply using multiple Tilemaps, and not rewriting the class at all, but ran into Viewport problems. I don't know if I will start from scratch again, or continue to see what I can do to fix the Viewport bugs. The multiple tilemap method is very efficient and simple to execute aside from that one detail, so it is definitely something to look into further.
But then it won't be compatible with the other engines I presume, definitely for XPA.
True, but worse case scenario is make a couple different types. Tilemap is on the backburner right this second.
Quote from: ForeverZer0 on July 30, 2014, 05:15:47 pm
Sorry, didn't see until now. I haven't figured out exactly yet. I was messing around with simply using multiple Tilemaps, and not rewriting the class at all, but ran into Viewport problems. I don't know if I will start from scratch again, or continue to see what I can do to fix the Viewport bugs. The multiple tilemap method is very efficient and simple to execute aside from that one detail, so it is definitely something to look into further.
I remember creating such a script: http://littledrago.blogspot.com/2014/01/rgss-drago-custom-resolution.html
to solve the viewport problem I had to create multiple instance for everything such as fog, panorama, etc
and in the end it became full of problem when used with other scripts that relies on Spriteset_Map
Quote from: LiTTleDRAgo on July 31, 2014, 05:44:04 am
I remember creating such a script: http://littledrago.blogspot.com/2014/01/rgss-drago-custom-resolution.html
to solve the viewport problem I had to create multiple instance for everything such as fog, panorama, etc
and in the end it became full of problem when used with other scripts that relies on Spriteset_Map
I made it in a way where the "main" viewport is the size of the screen, and the surrounding viewports are 640x480, and the primary viewport overlaps them. The only problem is that priorities get screwy when a character is on the far right or bottom of the screen, outside the top-left tilemap. Depending on the order of creation and Z values, they either go "underneath" the outer tilemaps, or are "on top", where tiles with higher priority are under them.
I though of maybe trying to use multiple character sprites as well, one for each viewport, but now I feel things are starting to messy with that approach. I could only create them as needed, but the very fact I need to do that tells me the approach might just be flawed.
My idea now is to figure out how to scroll the screen, playing with the ox and oy values where the screen can remain centered and move appropriately, but the main viewport is always covering the entire screen. Don't even ask how I plan to accomplish this yet, lol, I haven't figured it out yet.
Sorry for the necro, but is this still being worked on at all?