ASOE (Asynchronous Online Engine) is a collection of scripts that allow you to create, host and play asynchronous multiplayer online games in RPGMaker VX Ace. ASOE is perfectly suited for turn based games, but it can enrich the gameplay of any VXA game by adding online features to it.
[!] Note: If you use the demo project, there is no setup required - its all plug-and-play. But if you want to change the existing systems like the title screen or change the behavior of register, login and logout - understanding this chapter is crucial.
the glorious default login screen
Let's start at the Start
Welcome to another chapter in the ever growing ASOE documentation! Today we talk about some of the basics of the engine, the things each and every game based on ASOE requires: Registering Accounts, Logging in, Updating data to the server as well as Logging out.
The default title screen uses just a single auto run event that calls a common event. This common event (asoe_sys_login_register) handles all the basic stuff like registering a new account, logging in and deleting a existing account again. You can use it as it is - or you take a look at the common event itself and make use of its parts to build your own login system.
[!] Remember: To provide an entry point to your online game, all you have to do is to call the common event Nr. 1 (asoe_sys_login_register).
Keyboard Input translated to RGSS3 by Efeberk
1. Registering a new account
The second menu point is actually the first one a player will choose: Registering a Account. The player will be prompted to enter a name as well as a password for his character (this is done via keyboard input and not via Input Name). You can dissect the asoe_sys_login_register common event if you want to alter the process, but thats not mandatory. A few important things must be noted:
* Entered data is always case-insensitive.
* All account names are unique, there can be no duplicates.
* Both names and passwords are limited to 4 (min) and 15 characters (max) (this can be changed).
Next, the script contacts the server and creates the account. Its important to understand that account data is NOT actor data. An account can hold any number of characters (even 0). Accounts include lots of other data instead that is not directly tied to a single actor. The most important account parameters are (will be expanded in the future):
Accountname, Password, Guild, Gold, Score, Level, Rank, logDate, steps, items, weapons, armors, mapLocation, usergroup and code
Gold, steps, items, weapons, armors and mapLocation is obvious and included in the account data as they affect a players party at whole.
Guild holds the current guild ID of a player. While Score, Level and Rank will be used at a later stage to maintain a online highscore list like seen in many online games.
logDate is required to know when the account logged in the last time. usergroup is used to differentiate between players and admins (to be implemented later). Finally code is the current security code of a account, like explained in the previous chapter.
Selectable actors are limited by server configuration
Finally, the script calls the character selection scene that allows the player to choose the first actor for his adventuring party. The available actor IDs can be specified in the servers config file (explained later), so you can limit the selection to just a few of them. This is the default character selection, if a game designer wants something different or more fancy, it is required to dissect asoe_sys_login_register to point to another scene.
[!] Remember: Changing the character selection requires scripting and access to the scripts themselves. How to do this will be explained in a future blog post in detail.
When everything went right, the player is now teleported to the starting map as stated in the server config file. The chat as well as the hotkeys are activated and the update timer starts (to be explained later).
This one is quite simple: The player just enters the name and matching password for an already existing account. The script then performs a few checks and loads both the account data as well as the data of all the players actors to the client. Finally the player is transferred to the last saved location of the party (this can be the default location for a new account).
Two important things to mention: First a version number check is done, please note that this version is NOT the version of the ASOE script itself. Its a version number game designers can add to both their server and their clients when updating their games. Should the version numbers match, the player can proceed and enter the game.
Second: When the versions do not match, the client requests a download link from the server and opens up the default browser (depends on system settings, the script has no influence on that). This download can be configured in the server settings and it is recommended to point it directly to a ZIP or RAR file. This file will be automatically downloaded (default behavior of any browser). Then the game prompts the player to update his project folder and quits.
The only thing left to the player is to unzip the archive and copy it over the previous game folder. This will also update the version number. After relaunching the game, login should be possible without any problems.
[!] Note: The standard version/patch system requires the user to locate, unzip and copy the new project to his project folder. There are patch scripts for VX Ace out there (like THIS ONE by the legendary Tsukihime)- but I did not include them because I want to keep the script to the very basics, without any 3rd party code installed. Game designers who want fully automated and optimized patch functionality, have to add this on their own.
[!] Note: Some games use both: A online mode as well as a offline mode. It is basically possible to do that using ASOE but this functionality is not fully supported. There is a switch that you can check in a conditional branch to see if the player is logged in or not. Its not recommended to use the same game content for both modes, there should be strict online maps as well as strict offline maps as well. Almost all of the core features require data to be transferred to or from the server in order to function. As the script was not concipied for dual use you will have to create NPCs (like vendors) for both modes in order to make your game work properly. I will see what I can do to improve this situation in the future.
3. Delete Account
Even more simple, a player can delete any account if both name and password are entered correctly. Players are encouraged to never share their account password.
4. Ingame Updates
As you can see in the picture below, the save button is greyed out. This means there is no way for a player to save the game manually. This is because its an online game: All data is saved on the server side instead, save files are obsolete when using ASOE. Even more important is to know that the game makes in game updates on a regular base.
Every minute, the current account and player data is transferred to the server. This includes switches and variables for this player as well. This periodic update is your first line of defense against data loss, but both players and game designers should never completely rely on this update. Many things can happen in just a minute and if the game crashes, the server disconnects or the player quits via X-out - vital data might be lost!
Circle should be trice as big because this point is SO IMPORTANT
5. Logging out of the game
FInally, as you can see in the picture above there is a logout button that replaces the game end button. Whenever a player quits the game, this logout button must be used. I cannot stress this issue enough: players should not just be encouraged but enforced to make use of this button! When the player logs out, the current data is transferred to the server and all of his characters are saved (and therefore considered SAVE).
If you forget to logout properly and the last automatic update dates a few seconds back, the worst thing that can happen that a player loses that shiny new piece of equipment he or she just acquired!
Another wall of text finished and this ends this chapter about ASOE - the asynchronous online engine for RPGMaker VX Ace!