# Basic RPG structure?

## Recommended Posts

Hello reader. For the past few weeks now ive been working on an RPG game I would like to make. Writing design doc, designing, artwork, ect... but now I think im ready to start coding. The problem is I have no idea how the games structure would work. I dont know if im asking the right thing here but let me explain. Pong Game Structure: { initialize graphics draw graphics to screen load player input run game loop (where ball bounces back and fourth} if win/lose end else run unload everything } Now for an RPG I have no idea how the structure would work. Ive been looking around the net for a long time now trying to find anything, and I cant find anything. Can you please incite me a little bit here, thanks :).

##### Share on other sites
Well the structure would be pretty much the same for any game. Are you talking about a turn based RPG or a real time RPG? Something like this could be done:

while game_not_over do  get_input()  move_player()  foreach monster do    monster.DoAI()  end  draw_stuff()end

##### Share on other sites
i spend some time using RPG maker 2000 befor i got into actual coding and the suprising thing is that it DID actully get me primed for programming in terms of variables and switches

i think the way the game should run is that you should have your map and imput for your player then you should have events at diffrent areas that trigger "switches" weather a bool variable or an int then just use those switches in if statements to see if you grow a lvl or if you should go to a cut scene or what ever other then that you also have to relize that in an RPG you are dealing with more maps and other data then pong and having all this data open all the time is just impractical so you should have a way of loading only the map (or set of maps your using) and making sure to deal only with objects that concern what your working with NOW other wise your game will take some performance hits. Im starting an RPG here as well (my (maybe) last 2d project before jumping into 3d) and im couting on it taking quite a while any way good luck to ya [grin] and i hope i helped

##### Share on other sites
you should encapsulate the different portions of the game and have them update themselves each frame.

for example, in pong, you would need 2 paddles and a ball. your main loop would look like this:

while(!game_over){   paddle1.Update();   paddle2.Update();   ball.Update();}

inside the update(), each object will do their own collision detection, rendering, etc.

now, in an RPG, there are many more objects (and systems) needed. you need some sort of map system, player object, npc/enemy system, etc. so it would look something like this:

while(!game_over){   map.Update();    player.Update();   npcs.Update();}

something like this is what you would to go for. just try to encapsulate everything as good as possible.

##### Share on other sites
It really all depends on what you are writing your language in and what type of game you are writing (2D side scroll, 3D, etc.) and how you want the play to be. To write a game where a PC's and NPC's speed determines who gets to attack first in a turn based style combat mode is completely different than one that is using real-time gameplay action.

##### Share on other sites
Take a look here there is a nice rpg engine, the csrpg engine don't copy it but look at it for an example. . .
http://rav.realitybytes.tk

##### Share on other sites
The structure of any RPG is pretty simple.

while game is running    get input    move player    check for player collisions        if item collided with is enemy, fight        if item collided with is item, use/add item        if item collided with is trigger, script    for each enemy in the player's current area        do monster ai    render the screen

Like they said, pretty much the same structure as any game.

##### Share on other sites
Quote:
 Original post by Jason The Great To write a game where a PC's and NPC's speed determines who gets to attack first in a turn based style combat mode is completely different than one that is using real-time gameplay action.

Yes, remember this. My RPG is all the way turnbased and I didn't do much planning on the combat system. I had a bit of problems with it but it turned out ok. Now if you're doing real time game with real time combat or a real time game with turn-based combat you have to keep that mind when designing (how to balance, the interface etc.)

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627638
• Total Posts
2978327

• 10
• 12
• 22
• 13
• 34