Multiplayer Interactive-Fiction Game-Design Blog


Documentation – Basic Administration Library



Download 8.87 Mb.
Page117/151
Date02.02.2017
Size8.87 Mb.
#15199
1   ...   113   114   115   116   117   118   119   120   ...   151

Documentation – Basic Administration Library


Code for basic administration commands.

This library handles many/most administrator commands and features that allow administrators to remotely monitor and control the IF title.


1 Administrator accounts


How to create administrator accounts.


Administrator accounts

Online virtual worlds need administrators with special powers,

such as the ability to kick off users.

The user whose name is "Administrator" will automatically

have a level 100 (maximum) for the pUserAdmin property.

That means, you must log on and claim the user name

"Administrator" before a player does.

Once you log on as an administrator, any character used

by the administrator will be able to use administration

commands that allow you to create other administrator

accounts. (See the online help for details.)

If you want your master administrator account to have a

different name then change gUserAdministrator.

You should also create a character named "Administrator" that

will receive game-mail send to "[Admins]" and complaints

about griefers.



2 Safety measures


Some built-in crash protection.


Safety measures

Circumreality contains some built-in crash protection code and settings.

You might wish to adjust the following:





  • gSafetyMaximumCPU - This is the maximum CPU that

    the server will (attempt) utilize. Once the CPU level reaches this

    amount then no more users will be able to log on. This defaults

    to 0.8 (out of 1.0) of the CPU.







  • gSafetyMaximumMemory - If the server's memory footprint

    exceeds this amount then the server will automatically shut down

    and restart. This is protection against memory leaks of various

    sorts. This defaults to 1.5 GB, since Windows 32 runs out of

    memory at 2 GB.





  • gSafetyMaximumNetwork - Use this to (approximately) limit the amount

    of bandwidth used. If the recent bandwidth usage is more than this

    value then users won't be able to log on. This is

    in megaBYTES per second. Thus, an 8 megabit line would be 1.0.

    A 56 kBaud modem is 0.007.





  • gSafetyMaximumUserAccounts - If the number of user

    accounts is greater than this, then no more new-user accounts

    will be allowed. This defaults to 10,000.





  • gSafetyMaximumUsersConnected - New users won't be able to

    log in if the number of connections is greater than

    gSafetyMaximumUsersConnected. This defaults to 500.





  • gSafetyMaximumIP - How many users can be connected

    from the same IP address. This defaults to 4 to allow family members

    to play together.




3 Keeping performance statistics


How to keep performance statistics.


Keeping performance statistics

If you want to keep statistics about your world's performance, such

as the number of users logged on at any one time, the number of

characters created, etc. then use

the cStatistics class.





  1. Create a new object based on cStatistics.



  2. Set pNLPNounName and pNLPParseName to

    the name of your statistics, such as "Illegal password attempts".



  3. Set pExamineGeneral to a description of the

    statistics.





  4. pStatisticsDatasets and pStatisticsUnits should

    be filled with string labels so viewers of the data know what they're

    looking at.



  5. If you want players to be able to see the statistic then

    set pUserAdmin to 0. This defaults to 1, and is the

    minimum administration level necessary to see the statistic.





  6. Set pStatisticsSamplesPerDay to the number of numbers

    you wish to store in your statistics per day. In the case of

    illegal password attempts, you may only need one per hour, so

    a number like 24 would do.



  7. Normally, only the 1000 most recent entries will be kept. If

    you wish to keep more or fewer entries then

    change pStatisticsMaxEntries.





  8. Whenever an event occurs, such as a failed password attempt,

    then call pStatisticsIllegalPassword.StatisticsTick(1);.

    This will record the event.





That's it. Administrators will now be able to see how many wrong

passwords were entered, with an accuracy of once per hour.


Statistics based on other statistics

The illegal password statistics object will only keep 1000 entries, at

once every 24 hours, is about 40 days worth. If you wished to keep

several years worth, you could increase the maximum number of entries,

but that would end up storing more data than you need.

Alternatively, you can create a statisic, "slow" illegal password, that's

based on the illegal password statistic and only takes a measurement once

a day:






  1. Create a statistics object just like you created

    the one for illegal paswords, except...





  2. Set pStatisticsSamplesPerDay to 1, or 4 is you want to

    keep statistics ever 6 hours.





  3. Don't call StatisticsTick() for this object when

    a bad password is entered.





  4. Set pStatisticsBasedOn to oStatisticsIllegalPassword.

    This tells the new "slow" object to get all its information from

    the faster oStatisticsIllegalPassword, using StatisticsQuery().





The result will be two statistics object, a "fast" one that measures

data every hour, and a "slow" one that sums up the fast one's data

once a day.




Non-counter statistics

To make a statistic that keeps track of values, such as the

number of simultanous users logged on, as opposed to the number

of users logging on in the last 10 minutes, you'll need to

write some code:



  1. Write your own StatisticsSnapshot() method for the object.

    This will get any values, such as gConnectionList.ListNumber(), and

    return it. The returned value (or values) will be stored in the

    statistic object's database, along with a time stamp.



  2. You may need to write your own StatisticsStarted(). This

    method is called when the statistics object is first started, and can

    be used to initialize as settings.





  3. When a set of values are "combined", are the summed or averaged?

    In the case of the number of users logged on, you wish to average them,

    so set pStatisticsSumToPairDown to FALSE. If

    you were keeping track of the amount of data sent or received then

    you'd sum the values, so

    set pStatisticsSumToPairDown to TRUE.



Again, easily done. And, just like with the counters, you can create

a slower version of the number of users logged on.



Other things







  • StatisticsQuery() will get the statistical information

    from the statistics object.







  • StatisticsStartStop() will start or stop keeping the

    statistics.





  • If you want to keep track of how long a quest took, or when players

    started/stopped it, then create statistics objects based

    on cStatisticsQuestDuration and/or cStatisticsQuestStartEnd and

    reference the objects in the quest's pQuestStatistics.




4 Improving text-to-speech


Using the speech log to improve text-to-speech


Improving text-to-speech

Circumreality relies heavily on text-to-speech. Unfortunately, text-to-speech

is of questionable quality because the AI and simulation needed to

produce quality text-to-speech is a long-long ways away.


However, you can take some steps to improve text to speech:







  1. Use less text-to-speech - I know this may sound strange,

    but minimizing the amount of synthesized speech helps. One of the reasons

    I added voice-chat to Circumreality was to minimize the amount that text-to-speech

    was used.







  2. Don't mix text-to-speech with real speech - One sure

    way to make text-to-speech sound lousy is to put it side-by-side

    with real recorded speech. However, if you still wish to use

    recorded speech, MIFL will let you do it.







  3. Use transplanted prosody - This technology takes a recording

    of your voice, "copies" the prosody (pitch, timing, and volume) from the

    recording and "pastes" it onto the synthesized voice. It significantly

    improves the quality of text-to-speech, but it's a lot of work,

    and is only useful for pre-canned phrases. Automatically generated phrases

    can't be pre-recorded for text-to-speech.

    The speech log is useful for transplanted prosody. See below.





  4. Use automatic transplanted prosody - See below.





  5. Use quick transplanted prosody - See below.





  6. Create a prosody model - Part of the reason why text-to-speech

    sounds so bad is because its prosody (pitch, timing, and volume) are so

    wrong. Prosody is wrong because the text-to-speech system doesn't really

    understand what it's speaking, so it doesn't know what words to emphasize.




  7. You can "Create a prosody model" specific to the text your game world uses.

    It will require you to record 500-1000 phrases that are commonly spoken

    by the text-to-speech engine, and then learns the prosody for those

    phrases, or ones similar.

    The speech log is useful for transplanted prosody.

    Also, the Easy recording tool might come in handy. See below.




  8. Make your own TTS voice - Making your own text-to-speech voice

    is a lot of work (about 5000 recorded phrases), but will help for two reasons.







    1. In the act of recording your own text-to-speech voice, you end

      up creating a prosody model, as above.



    2. Text-to-speech synthesizes a word, like "lantern", by attaching

      smaller recordings it copied from other words. For example: "lantern"

      may be constructed from the "lan" part of "land" and the word "turn" that

      were recorded in the training sentences. If a recording of the word

      "lantern" exists in the training sentences, then that will be used

      in preference to "lan(d)" + "turn". A recording of the original word

      will sound better than combining two smalelr bits.

      However, "lantern" may not actually have been in the text-to-speech

      training set, or may not have occurred enough to be considered important

      enough to keep. If you create your own voice using the 5000 most-common

      phrases used in your game world, the words that you

      most commonly use will sound better

      as a result.






    The speech log is useful for transplanted prosody. See below.

The speech log keeps track of the 5000 most-commonly used

text-to-speech phrases. You can use this list of phrases as (a) a

way to decide what sentences to record for transplanted prosody,

(b) sentences to record for your prosody model, or (c) sentences to

record for your own text-to-speech voice.


To see the list of phrases, type "Show speech log" using

your administrator account. This will display the most common 2500 phrases,

sorted by the most common ones first. (This assumes that your world has

been running long enough to actually speak 5000 different phrases.) It doesn't

display the last 2500 since they have probably only occurred once or twice,

and aren't statistically signifcant.

As a programmer, you should be aware of the following:







  • oSpeechLog is the object that stores the speech

    log. It is a sub-class of cSaveToDatabase, so it will be

    saved away and reloaded.





  • oSpeechLog.SpeechLog() is called whenever SpeakNarrator()

    and SpeakObject() are called. If you bypass these two functions you

    may wish to append call oSpeechLog.SpeechLog() yourself.





  • gSpeechLogMax controls how many spentences will be stored

    in the speech log. You can lower or raise this value. 5000 is a

    good value, even if you are creating your own text-to-speech voice, since

    many of the sentences you record for text-to-speech should be

    "phonetically balanced" (look it up on the internet) and not taking

    from your game's phrases.







Easy recording

The chances are, you'll be play-testing your IF title and hear text-to-speech

speak a phrase that ends up sounding lousy because of the prosody.

You would always run M3DWave.exe and record the wave then and there, but

there's an easier solution:



  1. When you first run CircumrealityWorldSim.exe, check

    the Enable tools in the client checkbox at the bottom of the

    page. This will enable some author-specific tools in the client that

    are normally hidden from typical players.



  2. In the client, select the "Settings & Options" menu item,

    following by the "Speech settings" dialog. In

    that dialog, type in a Record-wave-to directory where

    you want any recorded waves to be saved, such as "c:\\MyDirectory".


  3. If you're recording waves for your own text-to-speech voice then

    type in the directory where all the TTS recordings are saved. If

    you want to the use wave for a prosody model, type in that

    directory. Or, if you're using automatic transplanted prosody (see

    below), then type in the directory where all those files go.

  4. Whenever you hear a text-to-speech phrase that has lousy

    prosody, bring up the transcript window. Next to

    each sentence, you'll see a red link for "(Record)". To

    record a version of that sentence, press (Record).

    The file will automatically be saved in the "Record-wave-to

    directory".


  5. If you are using the wave file for a text-to-speech voice or a

    prosody model, you'll still need to run MNLP.exe

    and add the recording to the list of wave files

    used for the voice or model. Assuming that the directory where

    you saved the file is only meant for the specific text-to-speech voice or

    prosody model, you can press the "Add all visible wave files" at the

    bottom of the wave-file open dialog box.

    Likewise, if you're using the wave file for transplanted prosody,

    you'll need to rebuild the automatic transplanted prosody resources.




Quick transplanted prosody

The MIFL editor makes it easy to record transplanted prosody for strings and

spoken strings in some resources (such as conversation scripts, cut scenes, and

speak-scripts.)


Whenever you modify a string, or other appropriate resource, you'll see

options for "Spell check", "Speak", "Record transplanted prosody", and

"Delete trans. pros.".







  • "Spell check" makes sure all of the words are in the

    text-to-speech voice's vocabulary. If they aren't, they'll probably be

    mispronounced, and you'll need to add them using 3D Outside the Box's

    "Natural Language Processing" application.







  • "Speak" has the text-to-speech engine speak the

    phrase without using transplanted prosody. This will help

    identify words not in the voice's vocabulary, as well as detect

    gramatical mistakes.







  • "Record transplanted prosody" lets you easily record a

    transplanted prosody resource for the string. The resource is named,

    "rTransProsQuick_XXX", where XXX is a randomly generated number.

    Whenever you use Speak(), SpeakScript(), SpeakNarrator(), etc., the

    transplanted prosody that you just recorded will be used.


  • This is the easiest way to use transplanted prosody.


  • "Delete trans. pros." deletes a rTransProsQuick_XXX resource

    for the given text.







Automatic transplanted prosody

If you're trying desperately to improve the quality of a text-to-speech

voice, you should first try to use "Easy recording" (above) to record

wave files for a prosody model.


However, a prosody model may not be able to speak a specific sentence with

the correct and subtle prosody. If that's the case then the next step

is to use "Automatic transplanted prosody".


To use "Automatic transplanted prosody", do the following:





  1. Use "Easy recording" (above) to record problem sentences as .wav files.

    Store them all in the same directory.





  2. Create a new library in your project where you will store

    the automatic transplanted prosody resources.





  3. In the Misc menu, select the Automatic

    transplanted prosdy tool.





  4. Fill in all the fields, especially the directory where

    you have saved all the troublesome .wav files.





  5. Press Create transplanted prosody resources from .wav files and

    the computer will process for awhile. (If you have just recorded some

    new .wav files, this may take a long time.)





  6. Switch to your List of resource, also in the "Misc" menu.




  7. You will see a number of new resources labelled "rTransProsAutoXXXXX", where

    XXXXX is replaced by a number. These are the transplanted prosody resources

    automatically generated by the .wav files you stored in the directory.

  8. When you have a NPC SpeakScript(),

    or the narrator SpeakNarrator(), if

    the text exactly matches the transplanted prosody text, then

    the transplanted prosody resource will be spoken instead of the text.


  9. You should be able to hear the difference in quality. If you're not 100%

    convinced, then have the NPC speak the text string, but with an added space,

    so the automatic transplanted prosody resource won't be used.




5 Log-on notices


Showing a notice when players log on.


Log-on notices

If you want to show a notice when players log on, such as, "The mountains

are under rennovation. Please E-mail me if you find any bugs," then

do the following:






  1. Override rLogonMainNotice with your own notice.





  2. Change gNoticeVersion to a new number so that players

    will be shown the notice. (A notice will only be shown once, and the

    unique ID in gNoticeVersion is used to determine if the notice has

    already been seen.)






Download 8.87 Mb.

Share with your friends:
1   ...   113   114   115   116   117   118   119   120   ...   151




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

    Main page