Combu  3.2.2
Unity API Documentation
Server and Client configuration

In this section you will learn how to setup your server and client.

Server configuration

We really suggest to navigate to http://yourserver/combu_folder_path/_setup of your development environment to get the content for your configuration file, because it's mantained up to date with all the settings that can be configured with detailed descriptions.

The configuration file is located at lib/config.php and contains the PHP defines of every configuration setting (if you are new to PHP, "define" is the equivalent of "const" in C#):

  • Generic
    • URL_ROOT (default: /combu/): Define the relative URL of Combu folder, including the last path separator (e.g.: /your_combu_path/)
    • WS_DEBUG (default: FALSE): Debug the web services data: if TRUE then the data is loaded from both GET and POST, else it is loaded only from POST (set to FALSE or comment in the production environment)
    • DEFAULT_LIST_LIMIT (default: 20): Default size of a records list when limit is not specified in the REQUEST (must be greater than zero)
    • RANDOM_CODE_CHARS (default: bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ0123456789): Alphanumeric characters used to generate a random code (e.g.: Activation Code and Reset Password Authorization Code)
    • RANDOM_CODE_LENGTH (default: 10): Default length of a random code (e.g.: Activation Code and Reset Password Authorization Code)
  • Database connection
    • GAME_DB_USE_PDO (default: TRUE): Should use PDO for the database functions? (If FALSE then it uses mysqli)
    • GAME_DB_TYPE (default: mysql): Database engine (only if PDO is enabled, this must be supported by PDO)
    • GAME_DB_SERVER: Database Server hostname or IP (if the engine is running on the same machine use 'localhost')
    • GAME_DB_PORT (default: 3306): The port of the database connection (default MySql port is 3306)
    • GAME_DB_NAME: The name of the database
    • GAME_DB_PREFIX: Prefix for table names
    • GAME_DB_USER: The username of the database connection
    • GAME_DB_PASS: The password of the database connection
  • Security
    • RSA_PRIVATE_KEY_BITS (default: 2048): Key bits length for RSA generation (higher values increase security but require more time to generate keys), can be 1024, 2048 or 4096
    • RESPONSE_ENCRYPTED (default: TRUE): Should encrypt the server response to web services? (TRUE increase security but requires more resources/time both in server and in client)
    • DENY_UNVERSIONED_CLIENT (default: FALSE): Should refuse the connections when the clients don't send their version number?
    • MIN_CLIENT_VERSION (default: empty): Minimum version of client's CombuManager.COMBU_VERSION to be considered as out of range
    • MAX_CLIENT_VERSION (default: empty): Maximum version of client's CombuManager.COMBU_VERSION to be considered as out of range
    • DENY_OUTRANGE_VERSIONS (default: FALSE): Should refuse the connections with out of range versions?
  • Email
    • EMAIL_SMTP (default: FALSE): it allows to send the emails through SMTP server
    • EMAIL_SMTP_SECURE (default: NULL): secure authentication type for the SMTP connection (can be: NULL, 'ssl' or 'tls')
    • EMAIL_SMTP_HOSTNAME (default: NULL): server hostname or IP for the SMTP connection
    • EMAIL_SMTP_PORT (default: NULL): server port for the SMTP connection (e.g. 465)
    • EMAIL_SMTP_USERNAME (default: NULL): username for the SMTP connection
    • EMAIL_SMTP_PASSWORD (default: NULL): password for the SMTP connection
    • EMAIL_SENDER_ADDRESS (default: norep.nosp@m.ly@y.nosp@m.ourse.nosp@m.rver.nosp@m..com): the sender address of outgoing mail
    • EMAIL_SENDER_NAME (default: Your App Title): the sender name of outgoing mail
  • Email
  • User Registration
    • REGISTER_EMAIL_REQUIRED (default: FALSE): it will require a valid email address upon new user creation
    • REGISTER_EMAIL_MULTIPLE (default: FALSE): it allows to use the same email address for multiple accounts
    • REGISTER_EMAIL_ACTIVATION (default: FALSE): it will create an activation code during user creation and sends it by email, then will require to activate the account before being able to login
    • REGISTER_EMAIL_SUBJECT (default: Confirm account registration): the subject text of the user registration email
    • REGISTER_EMAIL_MESSAGE (default: email_register.html): Name of the HTML/text file containing the mail message (the file must exists in /email_templates); the HTML/text file can contain the following special words:
      • {ACTIVATION_URL}: it will be replaced with the URL to activate the account (if REGISTER_EMAIL_ACTIVATION is TRUE)
      • {USERNAME}: it will be replaced with the chosen username
    • REGISTER_EMAIL_HTML: it establishes if the user registration email is in HTML or text
    • RESETPWD_EMAIL_SUBJECT (default: Reset your password): the reset-password mail subject
    • RESETPWD_EMAIL_MESSAGE (default: email_resetpwd.html): Name of the HTML/text file containing the mail message (the file must exists in /email_templates); the HTML/text file can contain the following special words:
      • {CODE}: it will be replaced with the code to pass to User.ChangePassword to set a new password (if the user has an e-mail address stored)
      • {USERNAME}: it will be replaced with the username
  • Users
    • ONLINE_SECONDS: time interval in seconds to consider a user online from last action registered
    • CLEAR_PLAYER_SESSIONS: if set to TRUE then every time a player logs in, the system will delete older login sessions to maintain the sessions table cleaned and as smaller as possible
    • GUEST_PREFIX: the prefix string attached to the id for guest accounts (ex.: "Guest-")
    • FRIENDS_REQUIRE_ACCEPT (default: FALSE): if set to TRUE then the friend add action will require the destination user to accept or decline the request before it appears in the friends list
  • Upload
    • UPLOAD_DELETE_OLD_FILES (default: TRUE): if TRUE will keep your upload folder clean with latest changes to UserFile by deleting old file upon upload of new content
  • Log
    • LOG_FILENAME (default: app.log): Name of the log file (in the folder /_logs)
    • LOG_MAXFILESIZE: it is the maximum size in bytes of the log file
    • LOG_BANNED (default: FALSE): if set to TRUE then the system will add the requests from banned IP address in the log file
    • LOG_MAXFILESIZE (default: FALSE): if set to TRUE then the system will add the unauthorized/invalid requests in the log file

Client configuration

In the inspector of CombuManager script (the prefab is just a GameObject with CombuManager script attached) you will find the following properties:

  • Dont Destroy On Load (default: TRUE): if checked, this GameObject will be alive for the whole lifetime of your game/app; if you want to login in one scene (for example main menu) and last until the game quits then you should enable this flag
  • Set As Default Social Platform: since Combu implements the Unity ISocialPlatform interface, if you enable this flag the Combu will be set as current platform on Unity and you will be able to use it also through Social.Active
  • Url Root Production: is the URL to the folder where you installed the web services on your production server (e.g.: http://www.yourserver.com/combu/)
  • Url Root Stage: is the URL to the folder where you installed the web services on your stage/development server, usually local machine (e.g.: http://localhost/combu/)
  • Use Stage: if checked, the web services calls will be directed to the stage server instead of production
  • Log Debug Info: if checked, all the calls to webservices will add the result text in the console log
  • Remember Credentials: if checked, the last successful login action will store the username and password (encrypted) in PlayerPrefs to be used with User.AutoLogin() later
  • Ping Interval Seconds (default: 0): it's the interval in seconds to send auto-ping to server in order to maintain the online state of local user; to disable auto-ping set this to 0
  • Online Seconds (default: 120): it's the time in seconds from last action registered to be considered as Online (last action and online state are cached in User class, you will need to reload over time if you need a precise info)
  • Playing Seconds (default: 60): it's the time in seconds from last action to be considered as Playing
  • Language (default: en): the language for server response messages localization
  • Achievement UI Object: the GameObject that handles the user interface of Achievements
  • Achievement UI Function: the name of method to call on Achievement UI Object as result to Social.ShowAchievementsUI
  • Leaderboard UI Object: the GameObject that handles the user interface of Leaderboard
  • Leaderboard UI Function: the name of method to call on Leaderboard UI Object as result to Social.ShowLeaderboardUI