Tutorial: RPG Maker RGSS ‘Hello World’

RPG Maker (RGSS)

Tutorial: RPG Maker RGSS ‘Hello World’

First RPG Maker RGSS 'Hello World' program.

There is an ancient folklore in computer programming that says that your first program in any language should be a ‘Hello World’ display program. This tradition also states that such program should be very easy, as few lines as possible.

Without further ado, let’s follow these steps:

1-) Open RPG Maker VX and open the Script Editor (F11).
2-) Delete every pieces of code there. Absolutely everything.
3-) Insert a new entry and name it something like ‘My New Script’
4-) Enter the following piece of code in the editor.

my_sprite = Sprite.new()
my_bitmap = Bitmap.new(544, 416)
my_sprite.bitmap = my_bitmap
my_sprite.bitmap.draw_text(0, 0, 320, 300, "Hello World!", 2)

loop do
Graphics.update
end

How does it work under the hood?

Let’s break the code down.

To display text on the screen, we use two built-in classes from the RPG Maker class library: Sprite and Bitmap. Beware: the Bitmap class alone isn’t enough to display something on the screen. It may sound a bit confusing for a newbie, but the best analogy for both Bitmap and Sprite classes is a soul/body relationship. The bitmap object contains the data (soul), and the sprite object is the visual container for the data (body). The Sprite class possesses a property called ‘bitmap’, which is nothing else than an encapsulated Bitmap class object. So, it makes it easy for us to branch things together: my_sprite.bitmap = my_bitmap.

This Bitmap class requires a bit more labor. We initialize it to (544, 416), which is the same dimension of the smallest screen resolution. Then we used its method draw_text to print our ‘Hello World!’ message on the screen.

Finally, we use the RGSS2 built-in module ‘Graphics’ and its update method Graphics.update. It refreshes the game screen and advances time by 1 frame. So, set it inside a loop statement: loop do(…)end; otherwise the screen is going to be black

Leave a Reply

Your email address will not be published. Required fields are marked *