Welcome Guest ( Log In | Register )

HOME FORUMS DISCORD GAMES RPG MAKER SEARCH




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next
    Untra
  Fri May 07, 2010 1:45 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Additonal Bitmap Methodsv0.9
By: Untra and Glitchfinder

Introduction

This is a set of additional methods that can be applied to desired bitmaps by scripters to make interesting things happen to them. Most of them are irreversible, but I intend to change this in the future so that the effects are not only reversible, but also so that they can be applied to the course of entire viewports, or the whole screen so as to make unique transitions or screen effects (as well as make battle animations more interesting). The script comes coupled with a .dll file that makes the affect instantaneous, minimizing stress on the game process.

Current Features
I swear to god I'll remake this mountain of spoiler tags. Argh!
Brighten

Darken

Invert

Grayscale

Pixelate (in v0.5 only)

Frost (in v0.5 only

Hyper Contrast

Monochrome

Emboss (still buggy)

Sepia

Sharpen

Soften

Crosseye (coming soon)



Script
There are two versions currently out; v0.9 and v0.5. Version 0.5 has the frost and pixelate methods, while version 0.85 works with a .dll that makes the methods work instantaneously, and comes with many more additional methods. The v1.0 release should have a functional Frost working.
v0.5

v0.9


Instructions

Stick right above main, like you know you should.
This script is mostly for more advanced scripters that want to do more complex things with graphics. Its still a tad buggy, and more features will come (if sporadicly.)

FAQ

maybe later.

Compatibility

Not that I know of.

Credits and Thanks
To Glitchfinder, who deserves just as much credit for this as I do.
To the makers of the MACL; that script inspired me to write this
And to Paint.Net, which helped me figure out how to make the Frost and Pixelate methods.

Authors Note
Feel free to ask for some new features. If they're not too complex, I might (try to) add them in.

Terms and Conditions
Licensed under the WTFPL public licence. Click here for more information.

_________________
indeed.


Last edited by Untra on Fri Jun 04, 2010 3:52 am, edited 7 times in total.

Top Top
Profile      
 

    Glitchfinder
  Fri May 07, 2010 4:58 am
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
My first impression of this script is favorable, since it is well formatted and properly commented. Regarding your comments about speed, you might find that, for the most part, it will be slow on any computer. This is because RMXP uses a very poorly designed series of methods to edit and display graphics, and it does not significantly improve on faster computers.

As to reversing the effects, it can't really be done. The closest you can do for some of these methods is cloning the bitmap and saving it to use later. On others, like the brighten, it is possible to undo, but to a point. For example, it won't be able to undo the changes made to a bitmap when the colors hit their maximum or minimum values before the process is finished. The grayscale is also impossible to undo without cloning the image first, since you are effectively removing the color information and modifying the remnants.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Fri May 07, 2010 11:19 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Glitchfinder wrote:
My first impression of this script is favorable, since it is well formatted and properly commented. Regarding your comments about speed, you might find that, for the most part, it will be slow on any computer. This is because RMXP uses a very poorly designed series of methods to edit and display graphics, and it does not significantly improve on faster computers.


Heh, I kinda imagined that might be the case. I'm banking on a future release of the ARGSS being able to tackle the issue, so more complex methods can be added on a broader scale. My goal: Touch fuzzy get dizzy effects.

Quote:
As to reversing the effects, it can't really be done. The closest you can do for some of these methods is cloning the bitmap and saving it to use later. On others, like the brighten, it is possible to undo, but to a point. For example, it won't be able to undo the changes made to a bitmap when the colors hit their maximum or minimum values before the process is finished. The grayscale is also impossible to undo without cloning the image first, since you are effectively removing the color information and modifying the remnants.


I'm thinking of possibly making a method to refresh any bitmap that was changed by certain effects by recalling it, or by adding additional properties to it by using alias to change the RPG::Cache module. I'm not sure what the next step to take is regarding this. (This is especially frustrating if you want to pixelate a bitmap from a higher value to single pixels, to create the look that the screen is transitioning, as it requires the original bitmap to be recalled and redrawn every iteration.)

egh...

_________________
indeed.


Top Top
Profile      
 

    BlueScope
  Mon May 17, 2010 7:20 am
The Third Man
User avatar



Location: Germany
You almost entirely qualify for The Third Man's Golden Left-Sided Shoe Of Great Scripting, however, you sadly used the very weird indentation of 3 spaces. We're sorry to announce to you that you're a failure.
(seriously now, I can only second what Glitch said: Well coded, well documented - you just made me happy! :grin: )

As far as the performance issues go, the bottleneck very rarely is the hardware. I don't know about you, but I'm running a 2.4GHz core2quad, 3GB RAM machine that was not too bad a year ago; nevertheless, I get performance issues with RPG Maker games (more precisely, RGSS Player games) on a regular basis, and everyone knowing me knows it's not because of my inefficient scripting :p The RGSS Player is known as a relatively slow interpreter, so while I'm not trying to discourage you, I think getting the effects you linked to work via an effect (as opposed to moving 1px-wide images up and down or something) would be pretty much close to impossible if you aim for a broad user spec (which, as a game designer, you do).

Oh, and in general, very nice effects you got there! :D

Keep up the good work (and maybe get your very own Golden Left-Sided Shoe Of Great Scripting next time!).

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    Glitchfinder
  Wed May 19, 2010 7:17 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
To continue what BlueScope said, an alternative to scripting this via the slow RGSS-based Ruby interpreter might be programming a .dll file in a much faster language, such as C++. In point of fact, I could even provide you with the necessary code to get you started with bitmap methods in a .dll file, since I've dabbled with it myself. (Including creating several of the filters you have here) It is much faster, with no noticeable lag, and if you code it correctly, it will produce the exact same effect.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sun May 23, 2010 3:42 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
I know very little C++ to actually code in it, but If you provided me the code for what I've done so far I could teach myself by looking at your code and working from there.

In terms of software to work with, all I have is Microsoft Visual C++ 2008. Would this be enough?

I haven't made a ton of progress in terms of finding out how to "refresh" an altered bitmap, but I have been working on something else:
Crosseye

It makes two copies of the same bitmap at half transparency and moves them both x pixels away from the center. Still a bit buggy, and I'd like to figure out how to also make them move at a degree measure as opposed to just left and right.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sun May 23, 2010 10:14 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
All right. Sorry for taking so long to get back to you with the code, but I have it right here. Right now, it's a mix of C and C++, but it works as long as you set it to compile as a .dll file. Some of the header files I included are for things that I had in my dll, such as the time classes used for random number generation for a splatter effect. You might want to note that RMXP and RMVX store bitmaps in the BGRA format, instead of the more common RGBA format, which is reflected in the example bitmap method below. Microsoft Visual C++ should be enough, though I would recommend getting the newest version, which was just released.

Expand to see the code.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sun May 23, 2010 10:49 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Hey thanks! I'll take a better look into this and see where to begin coding these into C. Once I get a few methods working, I'll see how calling them through the .dll improves the latency. This will keep me busy once school lets out.
Thanks a million :thumb:

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sun May 23, 2010 11:39 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Untra wrote:
Hey thanks! I'll take a better look into this and see where to begin coding these into C. Once I get a few methods working, I'll see how calling them through the .dll improves the latency. This will keep me busy once school lets out.
Thanks a million :thumb:


Trust me, it improves the latency by quite a bit. By the way, if RMXP crashes when you call the .dll file, it's probably because you are trying to read or set pixels that are outside the bitmap's range, or because of some other error caused by your input. Also, to send a bitmap to the .dll file, you have to use the .__id__ method. Basically, bitmap_variable.__id__

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sat May 29, 2010 3:36 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
I'm getting a few errors trying to compile:
Expand to see the code.


That line (57) is:
RGSSBMINFO *bitmap = ((RGSSBITMAP*) (object<<1)) -> bm -> bminfo;

I'm not quite sure what to do. Help?

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sat May 29, 2010 4:23 am
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
you left the arguments out of the method name. Note that the method was named as method_name(long object). In this case, the method would be fed one bitmap, following the bitmap.__id__ advice I gave you earlier. Don't drop the long, or the object, or you'll get an error.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sat May 29, 2010 7:46 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Thanks! I got it working!

http://www.box.net/shared/9m54d8hkzu

Alright, first working dll... Now what? :huh:
I'm not quite sure how to go about calling it though. Win32API.new of course, but just what arguments would I put in it?
I feel so very, very new at this... :blush:

Edit: for reference, heres the sole working method:
Expand to see the code.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sat May 29, 2010 7:23 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
First you have to get a properly compiled .dll file. Then you'll do the following:

Expand to see the code.


Let me explain.

"dll name": the name of the dll file, with or without the extension. (case insensitive, crashes if not found)
"function name": The name of the function you wish to call. (case sensitive, crashes if not found)
"LlIiNnPp": The arguments. This is a string of characters, which are explained below.
"LlIiNnPpVv": The return value. A single character, follows the same rules as the arguments.

Arguments:
"L" or "l", "N" or "n": A long number. This can be used to pass booleans, where 0 is false and anything else is true.
"I" or "i": An int. This can be used to pass booleans. (see above)
"P" or "p": A pointer to a string. With more advanced programming, can be used to pass other variable types, such as structures.
"V" or "v": Void. May only be used as a return value.

One other thing I would like to note is that if the dll crashes, so will RMXP or RMVX, and that you will receive a non-specific error message regarding the event.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sat May 29, 2010 8:49 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Ah, I see what I did with the dll. This should be it fixed then:
http://www.box.net/shared/9m54d8hkzu

It did however crash. :sad:
Expand to see the code.


I cannot thank you enough for all your help Glitchfinder! Ive learned a lot working with this code, and you've helped me just about every step of the way. You kick ass, sir.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sat May 29, 2010 9:36 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Instead of feeding it amount, you need to feed it bitmap.__id__, and, if you need the amount, you need to make a second argument for the function in the .dll file, so that it can take the amount as an int. This is because it takes object, which is essentially a pointer to the bitmap in system memory, and uses it to access the bitmap data. So, try this:

Expand to see the code.


Keep in mind that you'll also want to add a bit of checking to force the values for the new colors into the proper range, since they will give an error if they are less than 0 or greater than 255.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Sun May 30, 2010 12:07 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
It works!


I tested a 640x480 image of a julia fractal brightened by 100, which would normally kill it outright. It took less than a second. :thumb:
I'll finish the rest of the methods before I release the full .dll.
You've helped a ton! Thanks!

_________________
indeed.


Top Top
Profile      
 

    Untra
  Sun May 30, 2010 1:14 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Version v0.85
http://www.box.net/shared/9m54d8hkzu


Expand to see the code.


The first four methods work like a charm!

But Pixelate and Frost don't change the colors of each pixel; they either redraw the pixels over a set course or draw them somewhere else. I'm gonna do some more research on how to write them (as you've helped more than enough), but otherwise these first four work quickly and flawlessly.

_________________
indeed.


Top Top
Profile      
 

    silver wind
  Sun May 30, 2010 11:39 am
Chompil
User avatar
Member

It's working great, :)

I may have found a bug: when I change an event's graphic with this, every other event with the same sprite/tile also change.
I'm doing something like:
Expand to see the code.

I could be doing it wrong, though.


Top Top
Profile      
 

    Untra
  Sun May 30, 2010 2:08 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Thats because they all share the same bitmap id. Hmm... I'll take a look into how you could force it onto just one event. Its not so much a bug than a simple oversight.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Sun May 30, 2010 11:31 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Untra wrote:
Thats because they all share the same bitmap id. Hmm... I'll take a look into how you could force it onto just one event. Its not so much a bug than a simple oversight.


You'd have to make individual events clone the bitmap before using it. I've encountered this issue in the past.

_________________

Just call me Glitch.


Top Top
Profile      
 

    silver wind
  Tue Jun 01, 2010 11:32 am
Chompil
User avatar
Member

Expand to see the code.

Tiny edit. only 170 lines o.o;
The 4 last methods are meant to keep the call short in the script box.
Send the event name or number as parameter:
brighten("EV001",64)
invert(2)


Top Top
Profile      
 

    Glitchfinder
  Tue Jun 01, 2010 6:22 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Silver Wind, were you aware that any methods or variables defined within the Interpreter class (Or Game_Interpreter for VX) will be accessible to the evented "call script..." command? That means that you would only have to define those methods inside the interpreter, instead of making them globally accessible. Another thing to note is that the Interpreter has a neat little method called get_character(parameter), that will return $game_player if the parameter is -1, or the event that called it, if it is 0, or, even better, will return the event whose ID you gave it as a parameter, if the parameter is above 0. This makes it extraordinarily easy to modify events on the fly. Another thing to note is that you never want to use the variable @index in the "call script..." command, because that is used to determine where in the event's command list you are operating from, and will result in an infinitely looping event, or, even worse, a crash. (You can define instance variables with @variable_name that will be accessible by future call scripts, if you want to.)

_________________

Just call me Glitch.


Top Top
Profile      
 

    silver wind
  Tue Jun 01, 2010 9:14 pm
Chompil
User avatar
Member

Thanks for the tip :)
I'll modified my script to use get_character.
I never touched @index, but yeah, better leave it alone :P


Top Top
Profile      
 

    Untra
  Thu Jun 03, 2010 2:35 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
aanndd... I'm stuck.
Expand to see the code.

I think I'm completely off by line 25 there. This would be a lot easier with a set_pixel function :sad:
Edit: Sudden realization the original RGSS Method would be useful for comparison:
Expand to see the code.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Thu Jun 03, 2010 4:54 am
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
I think you're in need of some more source code. Here's the full source code of my .dll file, from the last time I updated it. At the time, I was working on adding in all the effects from theory's Character Shaders. Go ahead and add effects from that to your project, since all of them were open source or unsourced ruby code that has been floating around foreign-language RM* communities for years.

Expand to see the code.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Untra
  Thu Jun 03, 2010 10:20 pm
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
I've been playing around with these methods, and I'm astounded! All of them work excellently. In particular, I like the splatter method; its code is actually the frost method, making things a ton easier. I'll incorporate all of these into the .dll and release them.

Oh, thank you so much! :biggrin:

_________________
indeed.


Top Top
Profile      
 

    Ellie
  Thu Jun 03, 2010 11:13 pm
User avatar
Staff

Omnipresent Merchant
Very cool, sorry I can't comment much on the technical side, however these are definately useful and functional, nice work.


Top Top
Profile      
 

    Untra
  Fri Jun 04, 2010 4:18 am
Jack of all Trades
User avatar
Sponsor


Location: Denver, CO
Update: New version out now!
v0.9


As for the methods, most of them have been added in, but all of them could certainly use some tweaking. I'm hoping to apply arguments to the Sharpen and Soften methods, and the Sepia looks fairly off (it looks more like its been dipped in a bath of urine than sodium sulfide). I'm still working with the Frost to get it to work more accurately. For some reason, pixels that get pushed off the left side of the bitmap by the frosting wind up on the right, while pixels pushed to the right are simply lost.
Content Hidden
It only becomes really noticeable with smaller bitmaps at higher passes. The answer will come to me, but for now its a strange quirk thats been bothering me.

_________________
indeed.


Top Top
Profile      
 

    Glitchfinder
  Fri Jun 04, 2010 5:28 am
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
I thought that, since I provided you with some of the methods, I might as well go a bit further. Here is a more permanent link for the current version of the .dll file. You might also want to try hosting it at [url]bb.ohsk.net[/url], which is hosted by shadow, owner of the Slacked IRC network.

Also, what in particular do you mean when you say that the emboss doesn't get every color. When I tested it, it seemed to work fine. I could be wrong, though. Also, below is the original set of Ruby methods that I was basing this stuff on:

Expand to see the code.


As a final note, your "Hyper Emboss" filter is looking very similar to Photoshop's "Glowing Edges" filter.

_________________

Just call me Glitch.


Top Top
Profile      
 

    silver wind
  Fri Jun 04, 2010 4:16 pm
Chompil
User avatar
Member

Those new effects are looking great, especially the sepia.


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group