Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (AndrewAMD, fogman, Grant, juanex), 972 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Best way to code an RPG??? #275379
07/01/09 08:11
07/01/09 08:11
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Hey there guys. I have come to a bit of a snag in my game. I am trying to make a Tales style of RPG where the player will essentially have 3 modes. A "Battle" mode, an "Exploration" mode, and a "Cutscene" mode. Since I have mostly been focusing on the games combat, I already have the "Battle" mode completed. The problem, however, is with the other modes.

What do you guys think the best way to execute this style would be? My goal is to have the player running around the world until he touches an "Enemy" entity. Once the entity is touched, the game then goes to the Battle Arena level, and once the player wins the game re loads the last position in the last world he was in. It's hard for me to describe, so here is a quick video demonstrating what I am talking about.

Demonstration

I currently have the "Main" script act as the test level for my combat system. Should I make three seperate scripts for all three modes? I was thinking of using a "Mode" variable. Something like this...

var mode = 0;
Code:
function game_modes()
{
IF (mode ==1)
{
\\Exploration code goes here.
}
IF (mode ==2)
{
\\Combat code goes here.
}
IF (mode ==3)
{
\\Cutscene code goes here.
}


I am NOT asking for code or anything, merely advice on the best way to achieve this style. Thanks for your help guys, cheers.

Last edited by exile; 07/01/09 08:19.
Re: Best way to code an RPG??? [Re: exile] #275381
07/01/09 08:39
07/01/09 08:39
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Its a bit tough to say without knowing how you game "flow" is put together.
Not something that you could easily explain I think.

But as an idea, how does this sound.

Have three separate player "action"s and when the player shifts from
one game-mode to another, the currently running action calls the next
action type and then aborts itself.

EG.
Code:
action player_explore()
{
   player = me;
   ...
   while(1)
   {
      if(key_w)   c_move(me, forward_vec, NULL, ....
      ...
      wait(1);
      if(mode==2)   {    player_combat();     break;   }
      if(mode==3)   {    player_CutScene();   break;   }
   }
}

action player_combat()
{
   player = me;
   ...
   while(1)
   {
      if(key_w)       c_move(me, forward_vec, NULL, ....
      if(key_space)   attack();
      ...
      wait(1);
      if(mode==1)   {    player_explore();    break;   }
      if(mode==3)   {    player_cutscene();   break;   }
   }
}

action player_player_cutscene()
{
   player = me;
   ...
   while(1)
   {
      if(key_w)   camera.tilt += time_step;
      ...
      wait(1);
      if(mode==1)   {    player_explore();    break;   }
      if(mode==2)   {    player_combat();     break;   }
   }
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Best way to code an RPG??? [Re: EvilSOB] #275387
07/01/09 08:52
07/01/09 08:52
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
(I first thought that video is your game, in wich case you dont need any advice wink

The cleanest way to have the different game modes, is
to have one main game-loop that acts as a state machine.

Depending on the case wich gamemode is running, the mainloop
executes the sub functions for each mode.
Any actions should observe if they are running in the
correct game-mode. If not, they should pause or delete the entity.

In case that your exploration and fighting area are different locations, you should use level-load to make a clean
new state for every fight / run-around.
All persistant data should not be stored in entity-skills,
but stored or saved to some global variables/fields.

After the level-load you can recreae the exploration-scene
from the stored data.
The fights usually dont need to save anything else than the
result to points and attributes.

The cuscenes could just pause the game and show the slides/video,
or when using the ingame-rendering, do the same as
the fights -> using a clean new level-load state.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1