Multiplayer Interactive-Fiction Game-Design Blog



Download 8.87 Mb.
Page113/151
Date02.02.2017
Size8.87 Mb.
#15199
1   ...   109   110   111   112   113   114   115   116   ...   151

10 cStoryline – Storylines


Information about what storylines are and how to create them.


cStoryline - Storylines

Many MUDs and MMORPGs let players choose a character from a

good race or an evil race. Depending upon the goodness or

evilness, their character begins in a different location

in the virtual world.

This is an example of a storyline; the player can choose

the good storyline or the evil storyline. The MMORPG, Dark

Age of Camelot, includes three storylines, one for each

of three realms.

An interactive fiction title could use storylines in

different ways. Perhaps new players must first play a specific

race. Once they have completed all the quests for that race, they're

allowed a larger selection of races. This would create

a world with two storylines.


The basic IF library comes with a placeholder storyline

object called oStorylineGeneric. If you are just

playing around, or only have one storyline, then you can

just use this object.


Creating a storyline

To create a storyline:







  1. Create an object, and base it off of cStoryline.



  2. Set the object's pNLPNounName and pNLPParseName to the

    storyline's name, such as "The good side". This name will

    be displayed as once of the storyline choices when a character

    is created. (If the world only provides one storyline then the

    player won't be given a choice.)





  3. Fill in pExamingeGeneral with a description about

    the storyline, such as "Play an evil character and fight the

    treacherous forces of good."







  4. pStorylineRaces should be filled in with a list

    of races that the user can choose from if they select the

    storyline. For example, the races in a good storyline might

    include humans, elves, dwarves, and halflings. The races in

    an evil storyline might be humans, orcs, and trolls.





  5. pStorylineRoomStart should be filled in with the

    room where new characters should first appear. If there

    is more than one room, then create a list of rooms.


  6. You can also provide a StorylineRoomStart() method

    and select the room based upon the character's race or gender.

    The default behaviour for StorylineRoomStart() is to return

    pStorylineRoomStart.


  7. If you wish your storyline to be off-limits to players until

    they have completed another storyline, or until they have

    paid, then write a StorylineQuery() method

    to check any properties assigned to the user. If the storyline

    can always be played then ignore the method.





  8. If you wish your storyline to provide the character with

    special equipment or skills then provide

    a StorylineSetup() method, which will be called

    after the character has been created.



  9. Finally, add the storyline object

    to gStorylines so the user creation code

    knows what storlines are available.




  10. gStorylines is accessed through the

    function, StorylinesEnum(), which begins with

    the list in gStorylines but pairs it down based upon

    SotyrlineQuery() calls.





11 cSaveToDatabase – Automatically saved objects


An easy way to save objects (such as NPCs) to a database.


cSaveToDatabase - Automatically saved objects

If your interactive fiction title is designed to be offline,

then the entire world setup (including all the objects

in the world) will be saved when the user saves a game; you don't

need to worry about this section.

However, if you are using Circumreality to create a MUD or MMORPG, when

a user quits, only their character information is saved.

If the server is shut down (or crashes) then all NPCs will

be deleted and started afresh the next time the server

is rebooted.


For a traditional MUD, this is no problem. However, NPCs in Circumreality

can remember quite a lot about players, information that

shouldn't be forgotten.


To make an object that automatically saves itself to the database

and then reloads when the IF title is restarted, just

base it off of cSaveToDatabase. That's all you need

to do.

The cSaveToDatabase class keeps a log of all the objects

belonging to it in gSaveToDatabase. When the IF title is

shut down, all these objects (namely NPCs) are saved to

the gDatabaseSaveTo ("SaveToDatabase") database. All the objects they

hold are likewise saved; this way NPCs will continue to hold

equipment.

Just to be paranoid, oDatabase sets up a timer to trickle-save

all the cSaveToDatabase objects. That way, if there is a crash,

most of them will have been saved recently.


When the IF title starts up, oDatabase sets a timer to occur

in 0-seconds that loads in all the objects that were saved

in gSaveToDatabse. Thus, all NPCs and their equipment will

be reloaded.

The reload process involves some gotchas that you should

be aware of:



  • If an object saved by cSaveToDatabase is also based on

    class X, but class X is deleted or renamed, then the object will

    fail to load.





  • If a NPC/object based on cSaveToDatabase holds item Y when

    it is saved, when the NPC/object is reloaded, it will automatically

    move item Y into its possession. This might cause some

    confusion if you thought you modified your code to place item Y

    someplace else, but it keeps popping up in the NPC's hands.







  • If a player kills a NPC that's defined in your code, such

    as oNPCFrank, then the next time you reboot oNPCFrank will

    be recreated. This happens because when oNPCFrank is killed,

    he is deleted from the oDatabaseSaveTo database. The next time

    the IF title starts, it doesn't find an entry for oNPCFrank

    in the database,

    so it starts with a fresh one.



  • If you delete the "SaveToDatabase.mdb" file, all the information

    saved by cSaveToDatabase will be forgotten and you can start

    afresh.






Download 8.87 Mb.

Share with your friends:
1   ...   109   110   111   112   113   114   115   116   ...   151




The database is protected by copyright ©ininet.org 2024
send message

    Main page