Site Announcements

  • Account registration restricted. Email lord.ixzion AT gmail.com and I will get you set up. Thanks.
  • RPGMM Discord Channel - https://discord.gg/YJnAfVr

  • New to the site? Let us know!! - Check here.
  • RPGM Magazine Mission Statement. - Check here.
  • We now have a forum up specifically for the races, check it out. - Check here.


[Continue]

It is currently November 25th, 2024, 1:22 am
View unanswered posts | View active topics


All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 18 posts ] 
Author Message
PostPosted: August 17th, 2007, 1:55 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
A guy at GameFAQs was asking about variables on the RPG Maker 3
board. From what I could gather, he knew next to nothing about them. I
took it upon myself to attempt to disseminate my knowledge in a way that
someone with no programming experience can wrap his mind around and
grab onto. Much to my surprise, he said that my explanation was very
helpful (I hadn't thought that it would be).

I'm posting this here because GameFAQs eventually purges old messages,
and who knows... It may be a helpful variable resource to someone. As
always, I'm just trying to help.

~*~*~

A variable is one of the most basic things in programming. Being able to
manipulate variables enables us to create video games.

A variable is a "thing" that holds a number. It can be any number that you
(the programmer) choose. All variables start with a value of zero. A
variable's value can mean anything that you want it to. The value of the
variable is what the computer is interpreting. The programming that we
(the programmers) do with variables enables us to communicate with the
computer in such a way that we and the computer are on the same page.
The computer is interpreting what we've programmed and is acting on it,
and we are giving the numbers a meaning.

So, Shared Variable 01 has a value of 0 (zero) at the start of the game.
This value of zero can mean anything that you want it to mean. Let's
explore some examples.

The player needs to collect five emeralds and trade them to a merchant
for a useful weapon. We would use a variable here that tells the computer
how many emeralds the player has collected. Make a treasure item and
name it "Emerald". Now create five separate events and place them on
the map. Each event where we find an emerald gives the player the
treasure item and increases the variable by 1. The computer is tracking
how many of these emeralds the player has collected. The merchant
should use a Val Condition Branch that checks the value of the variable to
see if it equals 5. If it equals 5, then the merchant can offer to trade a
weapon for the five emeralds we've collected.

Another example: A townsperson says that a dragon has been attacking
the village. The player needs to find this dragon and defeat him. For this
situation, we would use a variable.

If Variable = 0 then [dragon hasn't been defeated yet]
If Variable = 1 then [player defeated the dragon]

The values I'm assigning to the variable here mean something to me, and
they also mean something to the computer. I'm communicating with the
computer to achieve my desired result. So when you talk to the
townsperson, he should have a Val Condition Branch that checks the value
of the variable. If it = 0, then he should tell you that the dragon has been
attacking the town. If it = 1, then he should congratulate you for defeating
the dragon.

Edit: Logically, the event where we defeat the dragon should increase the
variable by 1 or modify it so it =1.

These are simple examples. You can take it much further than this, and
add whatever you want. You can add any number of other conditions and
meanings for variable values.

Use a different shared variable for each thing that you're keeping track of
in your game. Internal variables work the same way, except that they are
associated with specific objects (characters, events, and things). You can
use shared or internal variables. Doesn't matter.

What's important to understand is that at any given time during the game,
each variable has a value that means something. The value (number) that
the variable holds is what the computer is interpreting (what it means to
the computer). The meaning that you give the variable is how you are
interpreting it. You and the computer are working as a team, each
interpreting the variable in a different way but achieving the same desired
result with it.

Increasing a variable's value adds to it. Decreasing it subtracts an amount
from it. Modifying a variable sets the variable's value to that number
regardless of what it was before. i.e. Shared Variable 01 = 5. I modify it
so it = 10. It now = 10.

"Shared Variable 01" is the designation of which variable it is. It's the
variable's name.

~*~*~

I'll give you something more to ponder.

Computers work with numbers. That's how they operate. It's
the "language" that computers understand. They interpret numbers and
give the numbers meaning for us, the users. Right now, as you read this,
your computer is interpreting numbers and using them. It uses numbers
to create the graphical display of this webpage.

When I type the letter "W" on my keyboard, the computer is rapidly
interpreting the keypress of the "W" key, understanding what it means,
and using numbers to generate a graphical representation of the
letter "W" on my screen. It looks like a "W" to me, but to the computer is
has a completely different meaning. The letter "W" is composed of
numbers that the computer understands. It interprets the letter "W" as a
bunch of numbers. We interpret it as the letter "W".

Your PS2 works the same way. It interprets numbers and uses them to
generate the graphical display, text, animation, music, everything that
goes on in a video game. The PS2's CPU (computer) speaks in a language
of numbers. That's what it understands. The trick for any programmer is
to understand how the computer thinks and what it understands. It
understands numbers.

We give all those numbers a meaning. The graphical display is full of
numbers that designate color, texture, and everything you see onscreen.
It means something to us because it's been programmed to do that. The
computer is speaking in its native language, and the programming is
translating it into images that we understand.

Variables work the same way. The computer interprets a variable in its
native language of numbers. We give the numbers a meaning.

Understand that you need to communicate with the computer in terms that
both you and the computer can understand. The computer doesn't
understand our language or the way we think. It understands numbers.
The trick for any programmer is to learn the computer's language and use
it to communicate with the computer. Then you can achieve whatever
results you desire.

A variable is a way that you are communicating with the computer. It's a
number, and you can use it any way you want and give it whatever
meaning you want.


Top
Profile  
 
PostPosted: August 17th, 2007, 4:14 pm 
Rank 8: Adept Fighter Rank 8: Adept Fighter
Offline
User avatar

  Level 73
 

Joined: May 19th, 2006, 8:42 pm

Posts: 3632

Location: Ohio
Just so you know, people don't understand variables until they make a topic and have someone explain them directly to their (online) face.

Yeah, I know its weird but that's how most people are. You could have 50 stickied variable understanding topics, and people would still feel the need to make their own topic and ask about it.

Anyway, pretty good guide.

_________________
Image Image Image Image


1) Statement 2 is true
2) Statement 1 is false


Top
Profile  
 
PostPosted: August 17th, 2007, 4:21 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
H2SO4
Offline
User avatar

  Level 0
 

Joined: June 25th, 2006, 2:09 pm

Posts: 993

Location: Maine, USA
myoky wrote:
Just so you know, people don't understand variables until they make a topic and have someone explain them directly to their (online) face.

Yeah, I know its weird but that's how most people are. You could have 50 stickied variable understanding topics, and people would still feel the need to make their own topic and ask about it.

Anyway, pretty good guide.


qft

_________________
Image

87% of statistics are made up on the spot.


Top
Profile  
 
PostPosted: August 17th, 2007, 6:18 pm 
Rank 1: Untrained Thief Rank 1: Untrained Thief
H2SO4
Offline
User avatar

  Level 0
 

Joined: July 26th, 2007, 9:55 am

Posts: 222

Location: Over the hills, through the woods, and past the grumpy old lady who only eats oats so her breath sme
Nice guide, Cry! You even explained how computers use numbers! (I don't know exactly how to do it, but I know how they work. I respect the work gamemakers have to do, just like you.)

_________________
Legacies Character Stats-Dreem named Jerod. :angel
2/10 'till lvl up

Battle Magic-
XP-85
Gold-0
Attack Level-1 (That means PWNAGE!)
Spell Level-0
Red Village Keys-0
Blue Village Keys-0


Queyland Epics RP stats- :draygone: !GM! :draygone:


Top
Profile  
 
PostPosted: August 18th, 2007, 12:13 am 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
Let's see if I can remember some stuff from my old programming days.
It's been quite a while. My memory may be hazy.

The graphical display is pure graphics across the board. We like to
separate text from graphics. In our minds, text is words and graphics are
pictures. To a computer, everything is a picture that it draws. Every
letter in every word is a graphical picture.

Let's break it all down. Our language is no different from ancient Egyptian
heiroglyphics. A word is composed of letters. Each letter is a symbol (or
picture) that carries a meaning with it. We understand the words and
letters because we've been taught to comprehend the language. Our
minds comprehend words and pictures. A computer, on the other hand,
thinks in terms of numbers. Everything is a number. At the very basic
level, everything is a one or a zero. On or off. Yes or no. The ones and
zeros are used to generate larger numbers. 1, 2, 3, 4, 5, and so on.

Now each letter in the alphabet has a number that is its identifier. In fact,
every text symbol has an identifying number. Letters, numbers,
punctuation. Everything on the keyboard gets its own number, starting at
zero and going up to 255. This is called a "character set". Each letter or
symbol is a "character". That's how the computer is interpreting text.

To display the text in a way that we can understand, the computer
generates graphical pictures of the characters. Each character is an 8x8
grid of squares (I think... That's the way it was on my Atari computer. It
may be an 8x10 grid on PCs. I'm not sure.). Each square in this grid is a
pixel. The computer uses numbers to fill in the squares with color (black,
or whatever color you've selected for your text). A square that's "turned
on" is given color, while a square that's "turned off" is blank.

Each collumn of the grid is assigned a number, as follows...

0 1 2 4 8 16 32 64 128

Edit: I got this whole thing wrong. There are 9 numbers here. :lol
I think the zero shouldn't be there. I remember for sure the 128 was at
the far right collumn. It's been well over a decade since I last worked
with this stuff.


To decide which squares in each row are filled with color, the computer
uses a number that is the sum of all collumns that are "turned on".

0 1 2 4 8 16 32 64 128
X X . . . . . . . X X . . . . 97 (0 + 1 + 32 + 64)

97 is the number assigned to the top row of the character.

Let's create the letter "W".

0 1 2 4 8 16 32 64 128
X X . . . . . . . X X . . . . . 97 (0 + 1 + 32 + 64)
X X . . . . . . . X X . . . . . 97
. .X X . .X . . .X X . . . . . 107 (1 + 2 + 8 + 32 + 64)
. .X X . .X . X X X . . . . . 123 (1 + 2 + 8 + 16 + 32 + 64)
. .X X . .X X X. . . . . . . . 59 (1 + 2 + 8 + 16 + 32)
. .X X X X X X . . . . . . . .63 (1 + 2 + 4 + 8 + 16 + 32)
. . . X X . .X X . . . . . . . .54 (2 + 4 + 16 + 32)
. . . . . . . . . . . . . . . . . . 0

Edit: Again, the whole thing is technically wrong because I set up 9
collumns, but you should get the general idea.


That's a pretty crude representation that I did on the spot, but it works.
The numbers on the right are what the computer uses to "light up" the
squares that are meant to be turned on. So this letter "W" would look like
this in computer code...

97, 97, 107, 123, 59, 63, 54, 0

That's our letter "W". The blank 128 collumn provides a blank space
between letters (each character in the character set should have a blank
collumn, otherwise the graphics would blend together when displayed side
by side). Likewise, the blank bottom line provides a space between lines
of text.

I used to design custom fonts with Atari Basic for my text adventures. I
did archaic looking letters, cursive, all kinds of fonts. This was
called "redefining the character set". I was telling the computer to
temporarily replace its default graphics of letters and symbols with what I
wanted them to look like. I used this same technique to design simple
arcade style graphics by replacing letters and symbols with ... well,
whatever I wanted them to look like. Walls, floor tiles, weapons,
monsters, treasures, human-looking characters. The color that each pixel
is filled with also gets an identifying number.

This is one example of how a computer uses numbers to communicate
with us by generating pictures that we understand.


Top
Profile  
 
PostPosted: August 18th, 2007, 10:18 am 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
H2SO4
Offline
User avatar

  Level 0
 

Joined: June 25th, 2006, 2:09 pm

Posts: 993

Location: Maine, USA
Hey, that's pretty cool. Thanks for sharing.

_________________
Image

87% of statistics are made up on the spot.


Top
Profile  
 
PostPosted: August 19th, 2007, 8:40 am 
Rank 1: Untrained Thief Rank 1: Untrained Thief
H2SO4
Offline
User avatar

  Level 0
 

Joined: July 26th, 2007, 9:55 am

Posts: 222

Location: Over the hills, through the woods, and past the grumpy old lady who only eats oats so her breath sme
Interesting... would it be the same with three graphics? Or do you not know?

_________________
Legacies Character Stats-Dreem named Jerod. :angel
2/10 'till lvl up

Battle Magic-
XP-85
Gold-0
Attack Level-1 (That means PWNAGE!)
Spell Level-0
Red Village Keys-0
Blue Village Keys-0


Queyland Epics RP stats- :draygone: !GM! :draygone:


Top
Profile  
 
PostPosted: August 19th, 2007, 12:50 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
Three graphics? Do you mean three dimensional graphics?


Top
Profile  
 
PostPosted: August 19th, 2007, 3:31 pm 
Rank 1: Untrained Thief Rank 1: Untrained Thief
Offline
User avatar

  Level 0
 

Joined: July 26th, 2007, 9:55 am

Posts: 222

Location: Over the hills, through the woods, and past the grumpy old lady who only eats oats so her breath sme
yea.. oops! But would it be the same?

_________________
Legacies Character Stats-Dreem named Jerod. :angel
2/10 'till lvl up

Battle Magic-
XP-85
Gold-0
Attack Level-1 (That means PWNAGE!)
Spell Level-0
Red Village Keys-0
Blue Village Keys-0


Queyland Epics RP stats- :draygone: !GM! :draygone:


Top
Profile  
 
PostPosted: August 19th, 2007, 7:34 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
I don't know how three dimensional graphics are rendered or interpreted
by a computer. That goes way beyond my understanding. The most I
ever worked with was two dimensional game worlds (classic side-view or
overhead view).


Top
Profile  
 
PostPosted: August 19th, 2007, 7:57 pm 
Rank 1: Untrained Thief Rank 1: Untrained Thief
Offline
User avatar

  Level 0
 

Joined: July 26th, 2007, 9:55 am

Posts: 222

Location: Over the hills, through the woods, and past the grumpy old lady who only eats oats so her breath sme
Do you still have those 2-D games? Or did they get erased along with your Atari Computer?

_________________
Legacies Character Stats-Dreem named Jerod. :angel
2/10 'till lvl up

Battle Magic-
XP-85
Gold-0
Attack Level-1 (That means PWNAGE!)
Spell Level-0
Red Village Keys-0
Blue Village Keys-0


Queyland Epics RP stats- :draygone: !GM! :draygone:


Top
Profile  
 
PostPosted: August 19th, 2007, 10:34 pm 
Rank 6: Potent White Mage Rank 6: Potent White Mage
Keep it cool
Offline
User avatar

  Level 13
 

Joined: August 16th, 2005, 1:09 am

Posts: 2672

Location: Where am I?
Very informitive.

I believe the computers language is called binary. And it simply consists of two numbers:

0-False
1-True

And that's it. By stringing those together you can get what you want. Fastinating stuff.

On rpgm3, how many varible sets are there?

_________________
ImageImageImageImage
I'm 1ce (previously Gitaroo). Nice to meet you.

Image

My studio is Quixotic Productions! Check it!


Top
Profile  
 
PostPosted: August 20th, 2007, 1:01 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
Linkman712 wrote:
Do you still have those 2-D games? Or did they get erased along with your Atari Computer?


They're gone forever. Only computer that can run them is an Atari
computer, and mine finally crashed in the early 90s. I still have the prep
work I did for many of them, in the form of redefined character sets
planned out on graph paper, level designs on graph paper, and other
paperwork.

1ce wrote:
On rpgm3, how many varible sets are there?


I think there's 60 individual shared variables you can use. Each object in
the game (character, event) gets some internal variables that are
associated with it. So far, I've only had occasion to use shared variables.


Top
Profile  
 
PostPosted: August 20th, 2007, 2:46 pm 
Rank 6: Potent White Mage Rank 6: Potent White Mage
Offline
User avatar

  Level 0
 

Joined: February 12th, 2007, 6:10 pm

Posts: 2648

Location: near Washington D.C.
Internal variables are limited to 16 variables each per field/dungeon/town/room (or building)/character.

So an event itslef does not have it's own variables assigned to it, but you get so many with respect to the things mentioned above, that it really isn't necessary because you can always use those, let alone the fact that Crythania can complete his games only using the 60 shared varaibles.

_________________
Modal Realms
"a proper designation of universal existence"


Top
Profile  
 
PostPosted: August 23rd, 2007, 4:29 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Dark Rift Believer
Offline
User avatar

  Level 0
 

Joined: August 17th, 2007, 5:17 pm

Posts: 609

Location: Bay Area, California
Finally I get to thank you Crythania! I had also read about this variables discussion on the GameFAQs board, and I have to say, if it wasn't for your wealth of knowledge, I'm afraid I would STILL be stuck on variable problems, now I know how to do so much more than I thought possible-Thanks again!! :)


Top
Profile  
 
PostPosted: August 25th, 2007, 3:35 pm 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
Pheonix008,

You're welcome. I am glad that my attempt at variable education was
successful.

Rock on! And good gaming! :)

Bo,

"Raiders Of Lekunder" uses 30 shared variables. There wasn't a whole lot
that required the use of variables. There are other ways to go about
doing simple things that would otherwise require a variable. Modify to a
second mode, for example. I'm always looking for the easiest way to do
things with the least lines of code (goes back to the old programming
days; we didn't have gobs of memory to work with back then).

There is one variable that pretty much runs the entire game. It's
a "where are we in the story?" variable. Each time the story gets
advanced a notch further, this variable gets increased by 1. Almost
everything runs off of it. Townspeople dialogue, optional story scenes on
the side, anything that changes when the story advances. It's a very
structured game with a simple progressive design.

I think I used a couple "have we done this yet?" variables. The rest of the
30 mostly track how many of each collectable item the player has.

If you're doing a nonlinear game where the player can go anywhere and
do anything at any time, there'd be much more to keep track of.


Top
Profile  
 
PostPosted: August 25th, 2007, 10:33 pm 
Rank 1: Untrained Thief Rank 1: Untrained Thief
Offline
User avatar

  Level 0
 

Joined: March 7th, 2006, 8:38 pm

Posts: 206
hehe....yeah....I should see if I can find my notebook filled with Series 1 notes, and see how many variables I used in that....

Quite a few, I'd imagine.


So I'm guessing your "how far into the game are we" you referred to, Cry, relates directly to the quest journal...which, incidently is one of the best parts about your game (yeah, I'm actually playing it :))


Top
Profile  
 
PostPosted: August 26th, 2007, 1:46 am 
Rank 3: Studying Black Mage Rank 3: Studying Black Mage
Offline

  Level 23
 

Joined: July 10th, 2006, 8:24 pm

Posts: 914
Perversion wrote:
hehe....yeah....I should see if I can find my notebook filled with Series 1 notes, and see how many variables I used in that....


Yeah, dig that puppy out and tell us how many variables you used for it.
Would be interesting to hear.

Perversion wrote:
So I'm guessing your "how far into the game are we" you referred to, Cry, relates directly to the quest journal...which, incidently is one of the best parts about your game (yeah, I'm actually playing it :))


Yeah, the Quest Journal runs off of it, too. I knew I was forgetting
something, but I couldn't remember what it was. The "where are we in
the game?" variable is, like, the core of the whole game. The whole thing
runs off of a single number.

And yeah, Quest Journals are golden. I need a place where I can go at
any time and get an update on what to do and where to go next,
especially in a nonlinear game world where the movement isn't restricted
to a linear path.

Thanks for playing, Perv. Hope you're liking it.


Top
Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 28 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
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group