Evonet

v1.0 Beta
This is Lite-C/mySQL. This template is not for real-time multiplayer. These examples will only cover the basics of creating and updating your project data. To learn more, you will need to review the comments in the Lite-c and PHP files.



There is a lot to this template, but it is easy to manage once you understand how things have been designed. In the below examples you will learn how to start creating an online 3D GameStudio project. This could be a game, an editor, personal software, or anything else that you want to create. It's designed to be an online wrapper for your projects, allowing you to get any project connected and online. Even an older project can be wrapped with the template and set up in your online database. The information below will give you a quick start at updating the template and creating new content. I will continue to add new examples once beta testing has been completed.

Creating Project Data

When a user registers, their new account data is stored in the database. Evonet uses a formatted data method to read/write large amounts of data using only 6 database slots. Open the data manager and you will see your user data from the sql database. Find your account and click the update button. In the data_1 slot, you will see how this data is formatted.


Evonet Beta Tester , Acknex Knight , 160 , 1200 ,


Open "evonet_register.php" and scroll down to the verification area, you will see where this data is being created. The area you need to focus on is the data_1 - data_6 section. This is where you will create all your default project data.


To create new data for your project, review the comments in the script and add new content. Just make sure to remember that the seperator for the format is " , " (space-comma-space). This is set to $strdiv to use in the code.


'data_1' => "Evonet Beta Tester" . $strdiv . "Acknex Knight" . $strdiv . "160" . $strdiv . "1200" . $strdiv,
'data_2' => "",
'data_3' => "",
'data_4' => "",
'data_5' => "",
'data_6' => ""

Initiating Your Project and Reading Data

Evonet takes care of your login details. Your project does not initiate until a user has logged in. This happens in the "evonet_initiate.php" file that is found in the servers project folder. This script activates when a user is verified and this is when you read your projects first data. (Whatever it may be) (Startup data). Below is an example of how to read users data. (This code is included in the template as example data)


The first 3 are the users name, registration date and gem value. Then to read a formatted data string, it will use explode to store the data string into an array. Then just pick out what data you what and send it back. The client then reads it in as a file and allows you to assign strings and vars to each line of data that is echoed. (Must be read in the client in the same order it was sent)


echo $account_user_name ."\n";
echo $account_user_regDate ."\n";
echo $account_user_gems ."\n";

$data_arr = explode(" , ", $account_data_str_1);
echo $data_arr[0] ."\n";
echo $data_arr[1] ."\n";
echo $data_arr[2] ."\n";
echo $data_arr[3] ."\n";

Then open "evonet_initiate.c" and find the function named "evonet_initiate_project()". Within the verification area you will see where this data is being read into the client and stored in your strings and vars. The client creates a temporary file, reads the echoed data from "evonet_initiate.php", saves it into your data, then deletes the temp file.


var filehandle = file_open_write ("tempdata");
file_str_write(filehandle,datastr);
file_close (filehandle);

filehandle = file_open_read ("tempdata");
file_str_read(filehandle,project_user_name_example);
file_str_read(filehandle,project_user_regDate_example);
project_user_gems_example = file_var_read(filehandle);

file_str_read(filehandle,project_user_rank_example);
file_str_read(filehandle,project_user_class_example);
project_user_health_example = file_var_read(filehandle);
project_user_gold_example = file_var_read(filehandle);

file_close (filehandle);
file_delete ("tempdata");

Updating Project Data

Updating your data is very similar, however there are a few extra things that must be done to be able to update the data that is within a formatted data string. The update example is found in the server project folder, "evonet_update_example.php". Open it and scroll to the verification area and you will see how this data is being read and updated.


This example only updates 2 things, the users Gems value and the 3rd value in the data string, which is used as the players health. It first reads the gem value and adds +5 to the database value. After that it uses explode to add the data string to an array. Then it selects the 3rd value from it and adds +150 to it. This updates the data in the database once saved. But this time, we need to re-format the data string back to its original format. $strdiv will seperate it correctly and implode will put the array back together. After the data is correctly re-formatted and saved, you can use the data and updated array to echo out and update any new information to the user on the client.


$account_user_gems += 5;
$strdiv = " , ";
$data_arr = explode($strdiv, $formatted_data_str);
$data_arr[2] += 150;

$new_data_1_str = implode($strdiv, $data_arr);

DB::update('users', array( 'gems' => $account_user_gems, 'data_1' => $new_data_1_str ), "id=%s", $account_id);
DB::insertId();

echo $account_user_gems ."\n" . $data_arr[2];

Below you will see the lite-C code for reading in the example update. This is found in "evonet_initiate.c" and is called from the function "evonet_update_user_data()". As you can see, the process is basically the same as before. It reads the data and saves it to a temporary file, then allows you to set whatever strings and vars you want to store the data, then closes and deletes the temporary file.

var filehandle = file_open_write ("tempdata");
file_str_write(filehandle,datastr);
file_close (filehandle);

filehandle = file_open_read ("tempdata");
project_user_gems_example = file_var_read(filehandle);
project_user_health_example = file_var_read(filehandle);

file_close (filehandle);
file_delete ("tempdata");



Copy the Lite-C "evonet_update_user_data()" function and rename it.

Create a copy of "evonet_update_example.php" and rename it.

Create your new data in "evonet_register.php"

Create a new account to generate the new data or just manually add the formatted data with the data manager to your account."

Edit your data for these files to include your own data and update.

Then set up a new connection in the lite-c config file for connecting to your new PHP file.

Use the host name you created for the PHP connection and add it to the Lite-C function.

Then connect to it and use the data manager to help debug your code.



It may sound complicated, but its actually simple once you start understanding how everything is created. To learn more, go through the Lite-C and PHP code to get an idea of how the system was put together. The files are fully commented and will help explain the rest of what you need to know. This Beta Version is still in development and I will continue to try and keep it updated.