cat as cat can
- Feb 20, 2016
- Reaction score
- First Language
- Primarily Uses
Tutorial - Part 1: Installation & Basics
With this tutorial I will give you some guides how CBAM can be used. Well, to be fair, English is not my native language so there may be some misspellings and most screenshots will be on German too. But don't worry, the plugin and the scripts are commented in English and the plugin game language can easily switched.
And if you have questions, feel free to ask and I will do my best to give you an answer.
Download the latest Plugin version from the Plugin Release forum.
The CBAM system comes with 3 files:
- CBAM.js: The RPG Maker MV plugin
- cbam.php: The server side companion script
- cbamm.php: Notice the 2nd m, it stands for manager. So it's the CBAM Manager script
First open cbamm.php on a text editor and change username and password (line 42 and 43) as you like. This is just to protect the CBAM Manager a little bit. Default username is "Admin" without a password. Then you have to move the js plugin file to your projects js/plugin folder and both php files to your server.
Now you should create and initialize your database. Open cbamm.php on a browser, enter your username and password and after login select "Initialize database"! A new file named cbam.sqlite should be created.
Depending on your game (plugin) settings, your work with the server has done here.
To work, your server must have PHP 5.x installed. On my test system I have 5.6 installed, an unfinished version was running with PHP 5.4 too. SQlite3 and PHP PDO support for SQLite (pdo_sqlite) are necessary for the scripts to work out of the box.
Well, I'm using SQlite as database backend because of simplification. There is no need to setup a whole database server like MySQL. But if you like, it should be easy to do, because of using PDO.
Let's have a look at the plugin settings you can change on the RPG Maker MV plugin manager and CBAM Manager.
- gameName: This is the unique identifier of your game. This can be the name of your game or any other labeling you want. All settings and data on the server are matched to this name. You can have several games at the same time managed by CBAM on your server but all this games must have an unique gameName here.
- gameVersion: The game version must be an decimal number (0.9, 1.0, 1.1, etc.). This version is stored within the savegames on the database. So an older game (client) can't load a newer savegame. This is important to know.
- gameLanguage: CBAM has a built-in translating function for game text like menu labels, welcome messages, etc. By default you can set the language to "EN" (English) or "DE" (German). If you want you can add new languages easily (I will eplain this in a tutorial later). Beside this, console and server logs and error messages are only on English.
- url: This is the url where the plugin can find the cbam.php script. Please enter the fully qualified domain name but without a slash "/" and the script name on the end. So if your server address is www.mygameserver.com and you have stored cbam.php on folder rmmv there, just enter "http://www.mygameserver.com/rmmv".
- allowCreate: This can be set to 1 (yes) or 0 (no) and it's only important if no settings for the game (see gameName property) are saved on the database. If an user starts a game with CBAM, it connects to the server to synchronize the settings. If there is no data on the database and allowCreate is set to 0, nobody can play the game. But if allowCreate is set to 1, the settings from the plugin will be stored for the game on the database and it's possible to join the game (depends on this settings).
IMPORTANT: The following settings are only relevant if no game data is stored on the database (server) and if allowCreate set to 1! This is because this settings will be overwritten with the values from the server database. This allows you (as the admin) to change settings on the fly without to recreate and distribute the whole game again.
° loginActorId: This is the id of the login and guest actor. This actor has a special function and should not be used as a normal player actor. The face image of this actor will be used on the login screen and the walking sprite for guests.
° maxUsers: Here you can set how many players can join the game simultaneously. If you have allowed player can register themselves this is also the max number of this players.
° partyMode: This setting is important for your game, because it determines who CBAM will manage your player actors and parties. I will explain this on separated tutorials (you can also look at the FAQ).
° afterNewEvent: I you want to execute a common event after a new game has started, you can enter the event number here. This is normaly done for party setup.
° afterLoadEvent: If you want to execute a common event after a player has joined an existing game (has loaded a savegame), you can enter the event number here. This is normaly done to display a welcome back message and switch to the players actor.
° beforeSaveEvent: If you want to... well, I think you know it. ^^ But this event is a little bit tricky because it will be executed only after saved the game on command menu, not on back to title autosave (because the map was closed then).
° allowRegister: You can set this to 1 (yes) or 0 (no). If set to yes, player can only be added on CBAM Manager by the admin. Otherwise a player would be reigstered automatically after entered a new login and password as long as new max user number hasn't exceeded.
° allowPassive: As described in the FAQ with CBAM only one player can be inside the game as the active part. If set this option to 0 (no) only this one person can join the game at the time. All other players must wait until this player has exit the game. If set to 1 (yes), player can login and join the game on passive mode. This means they can load the latest savegame and walk around but they can't save the game. Beside this, what passive player can do and what not is part of your game design.
° allowGuests: Do you want to share your game with others to look? If guests are allowed (set this to 1), every user can join your game without login. As a guest you will be a special actor on the game (see loginActorId). What guests can do and what not is part of your game design. This settings will only be used, if passive players are allowed too.
° allowResetGame: This is an admin only option. If set to 1 (yes), an admin can overwrite all server side settings with the default plugin settings. Be careful with this option.
° allowResetUser: This is an admin onlay option. If set to 1 (yes), an admin can kick the active player from the game. If the player had joined the game at this time, he will be changed to a passive player. This can be usefull if the game has crahed oder the player has quit the game window without exit to title menu.
° firstUserAdmin: This is only be used if the user list of the game on the server is empty. If set to 1 (yes) and allowRegister is set to 1, then the first player who logged in will become a game admin.
° saveOnEnd: This should be set to 1 (yes). If so, every time an active player goes back to title, the game will be saved automatically.
° homepage: Here you can set a link to a (game) homepage. This link can be choosen on the title menu.
° wbMessageActive: CBAM has a build-in welcome message function with default text. With this option you can replace this text by your own without to change the plugin. This is the welcome text for the active player.
° wbMessagePassive: CBAM has a build-in welcome message function with default text. With this option you can replace this text by your own without to change the plugin. This is the welcome text for the passive player.
° wbMessageGuestCBAM has a build-in welcome message function with default text. With this option you can replace this text by your own without to change the plugin. This is the welcome text for your guests.
° logLevel: Here you can set how many informations the plugin will write to the console. Allowed options are 0 (only script errors), 1 (error messages), 2 (error messages and warnings), 3 (error messages, warnings and server response messages) and 4 (give me all).
CBAM gives you some script commands you can use on your events or own plugins. Feel free to contact me if you need more functions.
This will open a welcome back message, dependent on the players mode (active, passive, guest).
This will return you the current game mode (mainly 2 for passive and 3 for active).
If this function returns 1, this is a new started game, instead of a loaded savegame.
This returns the id of the guest actor (see loginActorId setting).
This returns the id of the current player.
This returns if the current player is a guest (0), a normal player (1) or an admin (99).
This returns the username (login name) of the current user.
- CBAM.userPaty() or CBAM.userParty(actorId)
This looking for the party of the given actor. If no actorId was specified the current player actor id is choosen.
It will return the party id (if you are using HIME Party Manager) or 1, if the player is in the game party.
With this you can get the last server response message, if you want.
- CBAM.setLeader(partyId, actorId)
With this function you can set an actor as the leader (first actor) of a party.
- CBAM.saveGame() or CBAM.saveGame(true)
You can use this function to save the current game on the database if you are the active player (will be checked before game save).
If you set the optional parameter to true, you will use the quicksave slot instead of a normal savegame.
- CBAM.loadGame() or CBAM.loadGame(true) or CBAM.loadGame(true/false,switch)
You can use this function to load a saved game instantly. Without a parameter the latest normal savegame will be loaded. If the first optional parameter is set to true, the game will be loaded from the quicksave slot.
As a second parameter you can set a game switch that will be set to true after the game was loaded. This can be used to activate an common event after a game was loaded at runtime.
This function can be used for an CBAM timer. In conjunction with the quicksave slot you can use this for auto-updates / auto-refresh.
Frequently Asked Questions
Q: Is this some kind of MMO?
A: Definitive no. Period. A basic feature of a MMO (or just online multiplayer) is, several player can join and play the game simultaneously. This ist not the intention for this plugin.
Q: What does "asynchronous multiplayer" mean?
A: This type of game can be described as a turn-based multiplayer gameplay between two or more players that can check in and play their turn when it's convenient. Similar to play-by-mail games and, more electronically, play-by-email or play-by-post forum games.
Typical examples are trading card games or tabletop/board games.
Q: How will "asynchronous multiplayer" work on CBAM?
A: With CBAM all players concerned on a game will share the same savegame. Every player who joins the game will load the same, latest saved game. Although several player can join the game and load the same savegame on the same time, only one of them has the ability the save the game too. Moreover every player can have it's own actor on the game.
Important: After the game was joined and the savegame was loaded, all players "play" their own game stand-alone. One player doesn't notice any others until the game was saved and new loaded.
Q: What's the matter with this party modes?
A: The simplest mode (0=none) is just a savegame sharing. On this mode, CBAM will not make any change on players party. However, it's the best way for a real multiplayer experience too. But later on that.
With the re-group mode (1) the player party will new sorted every time a player joins the game. The members of the party are the same but the players actor will become the leader (first person) of the party.
Only one actor (2) goes one step further and kicks all actors from the player party except the players one.
Q: Your where talking about a "real multiplayer experience"?
A: Yes, CBAM can highly benefits from the incredible HIME Party Manager. If you add this plugin to your project too, every player can have it's own player party. Every player can be on a different place on a different map but other players can see them there. And players can merge there parties too. CBAM can activate the current player actor party every time a player joins the game.
Q: Why cloud based?
A: Well, of course you could save a game and send it to the next player like on good old play-by-email games. But CBAM makes it easier. All savegames are stored on one server. Wherever you are you can play the game immediately (if you have an internect connection). And without server side storage keep the savegame up-to-date would be a pain, believe me.
Q: What's the difference between active, passive and guest mode?
A: Only one player can be an active player at the same time in the game. Not before this player has left the game (or the admin has taken this state) another player can join the game as an active player. Only the active player has the ability to save the game - even if you try to execute the save function, the server will check if you are realy the active player right now.
Beside the active player several other players can join the game at the same time but they are all passive players then. As a passive player they can't save a game and have lesser options on the ingame command menu. But as passive player you can move around the map as you like (by default).
A guest is a user who has joined the game without login. As guest has no access to the command menu (only back to title is an option) and of course a guest can't save a game. Like passive players there can be several guest on the game at the same time.
It's possible to disable passive player and/or guests.
Q: Who needs an admin?
A: By default an admin has some special rights on the game. As an admin you can kick the active player (e.g. if the game was crashed). If the player has joined the game at this time he becomes an passive player.
As an admin your are able to restart a game (overwrite the savegame with a new once) or rewrite the server settings of a game. Because the admin state can be checked on the game it can be used on game events too, if you like.
Q: What's about security?
A: We are talking about cheating here. Well, RPG Maker MV was not made to be a high securtiy multiplayer engine. And with some knowledge it's easy to get a whole bunch of information from a game. And I'm sure CBAM has security gaps as big as an aircraft carrier in this case. But like a game on a table with friends, I hope others will play fair.
- Basic setups with party mode 0, 1 and 2: done
- Use CBAM together with the incredible HIME Party Manager: done
- How to use this quicksave thing : done
- The Guide to the CBAM Manager
- Expand the plugin
Last edited by a moderator: