RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
Guest






PostPosted: Sun Jul 06, 2003 7:57 am    Post subject: How to program conversations...? [quote]

EY guys im currently working on my first ever game.... and im having problems in implementing conversation in my game.... would i need to hardcode all conversation or is there better way to do it?
Back to top  
DarkDread
Wraith Lord


Joined: 28 May 2002
Posts: 422
Location: behind your bushes

PostPosted: Sun Jul 06, 2003 4:45 pm    Post subject: [quote]

It's not too difficult to script your conversations. All you really need to do, is write a quick routine, which reads a few lines from a file, then displays 'em on screen, and loops back again for the next few lines. That alone, is enough so that you can write super long convos, and lots of convos, without having to add a lot of code. Just call your little routine, and pass it the name of the text file you want it to read from, then in the routine, have it open that textfile, and do its thing.

Hope that helps a little.
_________________
"Goth is a way for ugly people to be interesting."
Back to top  
Bjorn
Demon Hunter


Joined: 29 May 2002
Posts: 1425
Location: Germany

PostPosted: Sun Jul 06, 2003 7:32 pm    Post subject: [quote]

Unless you want to continue other stuff at the same time... our conversation box is like a state machine with logic update and render functions being called on it all the time. That makes it more complicated.

Maybe a simple solution to that problem would be using another thread. But threads introduce many other stuff to keep you mind on, so until now I've been evading them.
Back to top  
Jebediah
Pretty, Pretty Fairy Princess


Joined: 07 Jun 2003
Posts: 7
Location: Calgary

PostPosted: Mon Jul 07, 2003 4:30 am    Post subject: Conversation [quote]

To avoid hard coding conversations you are going to hafta make scripts as already said. Easy stuff.

Use conditions and pages with scripts to make building conversations easier. RPGMaker does this.

A script can have up to .... say 4 pages. A page is a part of the script. Each page has conditions that hafta be met before that script page is executed.

So....if you wanted someone to say something different the second time you talked to him use the following:

Code:
<Script "npc test">
<Page #1>
  <Conditions>
    <Switch 001=OFF>
  </Conditions>
  <Switch 001=ON>
  <Msg "Hello">
</Page #1>

<Page #2>
  <Conditions>
     <Switch 002=ON>
  </Conditions>
  <Msg "Stop talking to me!">
</Page #2>   


Hmmmm....hope that isn't too confusing. Is that even helpful? Does anyone have a better method?
_________________
- Jebediah
Nostalgic Studios
Back to top  
valderman
Mage


Joined: 29 Aug 2002
Posts: 334
Location: Gothenburg, Sweden

PostPosted: Mon Jul 07, 2003 9:27 pm    Post subject: [quote]

IMO, a good scripting language should be more flexible than that, but it all depends on your needs, I guess.
_________________
http://www.weeaboo.se
Back to top  
Rainer Deyke
Demon Hunter


Joined: 05 Jun 2002
Posts: 672

PostPosted: Mon Jul 07, 2003 10:54 pm    Post subject: [quote]

In my opinion the scripting language should be "nicer" than the language in which the game is written. Otherwise why bother with a scripting language at all? Too many people use scripting just because they heard that it's the thing to do, rather than for some sort of concrete benefit.

Here's a sample script from Feyna's Quest:
Code:

width 64
height 64
immune all
appearance npc 0 0

on interact:
  if $Raerl == 0:
    story_box(0x0000c0, "\"Too late...  Ceiling collapsed... All dead...  "
      "You need to escape or you will be killed.\"")
    story_box(0xc000ff, "\"But how?\"")
    play_sound("chimehi")
    story_box(0x0000c0, "\"Here, take this key and enter the basement.  "
      "There you will find... magic portal...  But you will need the "
      "necklace.\"")
    story_box(0x0000c0, "\"The necklace should be in my lab, if the rats "
      "haven't gotten it.  It is the key to the magic portal.  Get it, then "
      "step through the portal...  It will take you far away...\"")
    $Raerl = $Raerl + 1
    player_receive("MAGIC_GUILD_BASEMENT_KEY")
  else:
    story_box(0x0000c0, "\"Go...\"")
    if player_has("HEALING_POTION"):
      story_box(0xc000ff, "\"But you're hurt.  I've got a healing potion...\"")
    else:
      story_box(0xc000ff, "\"But you're hurt.\"")
    story_box(0x0000c0, "\"Don't worry about me.  ...already dying...  "
      "Just save yourself.\"")
Back to top  
Jebediah
Pretty, Pretty Fairy Princess


Joined: 07 Jun 2003
Posts: 7
Location: Calgary

PostPosted: Mon Jul 07, 2003 11:09 pm    Post subject: RPG scripting [quote]

If we are talking rpg scripting then there is no point in building something more flexible. What can you not do with pages and conditions in a rpg that any other script can't?

Pages and conditions only appeal to rpg's although. I am not taking credit for this design tho....stole it from rpgmaker. Works for them and works for me.
_________________
- Jebediah
Nostalgic Studios
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Mon Jul 07, 2003 11:43 pm    Post subject: Re: RPG scripting [quote]

Jebediah wrote:
If we are talking rpg scripting then there is no point in building something more flexible. What can you not do with pages and conditions in a rpg that any other script can't?

Pages and conditions only appeal to rpg's although. I am not taking credit for this design tho....stole it from rpgmaker. Works for them and works for me.


Flexibility is a nice thing to have. It really isn't too difficult to set up a parser for a relatively complex language. Although, there is of course the fact that a scripting language should be something that you are comfortable to program in. (Rainer: that looks very Pythonish to me, heh.) The more rigid your language, the more you'll have to refine it upon finding that you missed a specification in designing it. A good scripting language should be able to handle not only event code, but conversation-based code as well. (I.E. it is flexible.)
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
valderman
Mage


Joined: 29 Aug 2002
Posts: 334
Location: Gothenburg, Sweden

PostPosted: Thu Jul 10, 2003 6:04 pm    Post subject: [quote]

If you have a flexible scripting engine, not only can you use it for a lot more things than conversations and cutscenes in your game, it is also very nice to have a reusable scripting system, which doesn't have to be altered depending on the game/utility you're making.
For example, when building a map you might have some "sequences" of tiles/objects you are using a lot, or perhaps you want to get a nice random look to your forest, then creating a script for each of these actions will speed up the creation of your map a good deal. The best thing is, if your scripting is flexible enough, you only have to add ~5 lines of code to your map editor. (More if you want to integrate it nicely in the interface.)
_________________
http://www.weeaboo.se
Back to top  
spearor2
Guest





PostPosted: Tue Jul 22, 2003 7:27 pm    Post subject: [quote]

Valderman, integrating it in the map editor is indeed a great idea.
Though it's hard managing it, right now i'm busy incorparating some script
options in my map editor to a certain extent. But i find it hard as hell.

Best thing is i think to have some script (as talk, and npc inventory etc. char related stuff) attached with the npc, and other things like npc AI, behaviour and location of course in a map script.
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Wed Jul 23, 2003 5:49 am    Post subject: [quote]

spearor2 wrote:
Valderman, integrating it in the map editor is indeed a great idea.
Though it's hard managing it, right now i'm busy incorparating some script
options in my map editor to a certain extent. But i find it hard as hell.

Best thing is i think to have some script (as talk, and npc inventory etc. char related stuff) attached with the npc, and other things like npc AI, behaviour and location of course in a map script.


This would be a reason why your map file format should be an extension of your script file format; i.e. your maps are themselves scripts, which can be read by your scripting engine. Then, assuming either an OOD or a modular delineation, you could pretty much just integrate the scripting engine seemlessly into whatever superflous development programs you write.
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
valderman
Mage


Joined: 29 Aug 2002
Posts: 334
Location: Gothenburg, Sweden

PostPosted: Wed Jul 23, 2003 10:09 pm    Post subject: [quote]

spearor2 wrote:
Valderman, integrating it in the map editor is indeed a great idea.
Though it's hard managing it, right now i'm busy incorparating some script
options in my map editor to a certain extent. But i find it hard as hell.
For extensibility, the scripts are allowed to call functions from DLLs, to make data sharing and integration easier. So far, it's proven to be great. I have yet to try it with a larger project, though.
_________________
http://www.weeaboo.se
Back to top  
gnuthole
Lowly Slime


Joined: 01 Sep 2002
Posts: 1
Location: Sydney, Australia

PostPosted: Fri Jul 25, 2003 11:49 pm    Post subject: [quote]

If you really are new to this conversation scripting and programming thing, I highly recommend that you don't overcomplicate matters. If not, then read this anyway for some free advice :).

Just keep in mind what exactly you want to accomplish with this textbox. For example, you might want the box to appear in a certain position on the screen, maybe character-by-character displaying of text, or perhaps something as simple as a window that shows some pre-wrapped text, waiting for the player to press a key.

Equally as important, make sure you have an idea on how you are going to accomplish programming these features. For example, if you haven't a clue on how to make a text parser that makes sense of a complicated script, just don't make one. Opt instead for the simple textfile approach, just a bunch of lines of text organised into a series of .txts. If you can't make text appear char-by-char, don't worry about it. Achieve the the goal of getting the text box itself to appear (from external files or otherwise), and, on the presumption that you are putting the routine itself in its own module/function/whatever, you can reprogram it at a later stage to include more advanced features.
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
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 vote in polls in this forum