ZACHARY_BRAUN'S PROFILE

I'm a webcomic author. One of my webcomic stories is going to be in the form of an RPG maker game.

Search

Random Screenshots Archive

Hello,

Befoe RMN's current iteration, there was a section of the website that browsers could access by clicking on the "Random Screenshot" on the front page. This section was filled with random screenshots.

Is that page gone now?

[RGSS] Can the Z-coordinate be negative?

Hi everyone,

A simple question: When creating a new sprite, can the sprite's Z coordinate be negative?

If the Z-coordinate has boundaries, what are they?

Thank you,
Zack

Freeing Memory in Ruby

Hi everyone,

I was wondering about best practices for freeing up memory in Ruby programs. For example,


@memory_hog = []
memory_piglet1 = Piglet.new(gigantic_number) #Create new piglets.
memory_piglet2 = Piglet.new(gigantic_number)
memory_piglet3 = Piglet.new(gigantic_number)


@memory_hog.push memory_piglet1, memory_piglet2, memory_piglet3
#Add piglets to memory hog array.

create_crap = true
@memory_hog.each do |i|
i.feed(create_crap)
#Call the function "feed" for each piglet, which creates the new object
#"crap" out of a gigantic_number.
end

@memory_hog = [] #Get rid of all piglets?

In running this code, is there any crap left over?

Event Structures of Commercial RPGs

Hello everyone,

Recently, I've been coding an RPG from scratch. But the more I progress, the more I find that I'm just recoding features that are found in RPG Maker. Loading "events" with executable data in a list format.

Does anyone know the design initiative behind RPG Maker's event commands? Were they an industry standard?

How do commercial RPGs, such as, say, Final Fantasy IV, or Chrono Trigger, or SaGa handle their own "event commands"?

(If there are any people who have made ROM hacks of such RPGs, I'd expect them to weight in here.)

Place Game Abstracts Inside a Table

A simple suggestion for the Games page: Place the little abstract underneath the game's title inside of <table> and <tr>,<td> tags. This keeps the words from wrapping around to beneath the preview picture off to the left, which looks kind of weird, especially when it ends up being only a single word that wraps around.

[RMXP] Ruby's Incredible Referential Ability is Roadblock

Hello,

I'm attempting to store a sprite and some of its values into a premade array "grid". Like so:


sprite = Sprite.new
sprite.x = x_value
sprite.y = y_value
sprite.z = z_value
@sprites[nested_array_1][nested_array_2][nested_array_3][0] = sprite
@sprites[nested_array_1][nested_array_2][nested_array_3][1] = sprite.x
@sprites[nested_array_1][nested_array_2][nested_array_3][2] = sprite.y
@sprites[nested_array_1][nested_array_2][nested_array_3][3] = sprite.z


The "nested_array"s change around depending on which variable is active. This is inside a small method which is remaking the same graphic called "sprite" over and over, different each time, and storing it into a grid array. Or at least, that's what I'd like to do.

My problem, is that storing the items into the array in this fashion... well... because Ruby is so amazingly referential, it's storing the last value of the last code execution of "sprite" into EVERY array I operate on. These "sprite"s aren't copies, they're references to that one single object. If I have a whole bunch of "sprite"s that are at X 0 and then the very last sprite is at X 640, then all of them in my arrays become 640.

My question is, how do I copy "sprite" to the array without making it a reference? I know that .push does this, but .push always copies the object to the end of an array. How do I copy the object into a specific position in the array?

Pure Ruby differences between RPGXP and RPGVXAce

The way I've been experimenting lately, I open RPG Maker XP, start a new project, then take every script in the Script editor and throw them all out. Then I just start coding in Ruby.

For these new RGSS scripts which don't draw on anything from the default script library, what would be needed to allow RGSS3 to parse them?

What are the differences between the engine of RGSS and RGSS3? (Has the Sprite class changed? Do I need to add extra commas somewhere? Were some methods removed? New ones added? etc.)

[Ruby] Finding coordinates along a line using an angle

I'm writing this here in order to leave a message for those who attempt this in Ruby. Having been hunting for this equation for a while, I though it was important to share, especially since I'm an artist, not a programmer. The formula for this is available online as various programmers help each other out in diverse places--this one comes from "morechilli" at stackoverflow.com on October 15th, 2009--but it comes with a few RGSS quirks.

Given x1 and y1 on any chart, to find x2 and y2 along the same line:

x2 = x1 + (distance * cos(angle))
y2 = y1 + (distance * sin(angle))

RPG Maker is programmed so that cos and sin are accessed using Math.cos and Math.sin, which returns the answer in radians. This threw me for a loop when I tried it, because I had my angle in degrees. Angles must first be converted into radians before they can be used in Math.cos and Math.sin. This is done through the following:

radians = (angle * pi) / 180

This is where we are now:

radians = (angle * pi) / 180
x2 = x1 + (distance * Math.cos(radians))
y2 = y1 + (distance * Math.sin(radians))

Now, for the twist ending. I conceptualized 0-degrees as pointing straight up; 0 degrees was 12 o' clock. But Math.cos and Math.sin consider 0 degrees as flat; instead, 90 degrees is pointing straight up, like the right angle of all of those math problem triangles in high school.

Conceptualizing 0 degrees as up, the final look of the equation is this:

corrected_degrees = (angle + 450) % 360
radians = (corrected_degrees * pi) / 180
x2 = x1 + (distance * Math.cos(radians))
y2 = y1 + (distance * Math.sin(radians))

[Ruby] Rotating a Sprite along its center axis [Solved]

Hi everyone,

The Sprite class in RPG Maker's RGSS allows the developer to rotate the sprite, in such a manner:

sprite = Sprite.new
sprite.angle = [Desired angle here]

However, this rotation occurs based on the upper-left hand corner of the sprite. I know how to find the center of a sprite's image (sprite.bitmap.width / 2, sprite.bitmap.height / 2), but I don't know how to adjust the sprite's position after it's been rotated, so it appears as if it's rotated about its center.

Are any math wizards present who can point me in the right direction?

Sincerely,
Zack


-------------

The answer was in the .ox and .oy methods. sprite.ox and sprite.oy set the reference point for rotation. By default, they are at 0 and 0, the top-left of the sprite. Setting them to sprite.bitmap.width / 2 and sprite.bitmap.height / 2 finds the center of the sprite and uses that as a reference point for all calculations, including changing the x, y, and so on.

Ruby Alone

Hi everyone,

Let's say that I wanted to make a game entirely in Ruby, via RPG Maker's shell. Just deleting all of the default scripts. Is there something I should know about the way RPG Maker runs the Ruby scripts?

I recently learned that when a new class is created during gameplay, the class's method named "initialize" is called automatically, if it exists. I didn't know that before. I'm talking about things like that... for instance, does RPG Maker run a script called "Main" no matter what?