Nelson Wylie's profile

GoldRun Quiz Game - Team Project - C# & Flash

https://playerio.com/ -  has been taken over by Yahoo -> http://gamesnet.yahoo.com/
PlayerIO offers developers features such as:
 
BigDB – A database solution built especially for games that scale transparently with any amount of usage and load, for the development of infinitely scalable and persistent games.
PayVault – Your own virtual currency, micro transactions, secure items management, analytics, great administrative interfaces and more.
Multiplayer – Build realtime multiplayer games with your own serverside code and run it on our dedicated game servers.
Sitebox - The easiest way to build and host a Facebook app or host a game website on your domain.
GameFS - GameFS is a scalable file system for your game, where you can store all your game-related files and assets, with no limits on how much data you can store.
QuickConnect – Easily and securely connect and authenticate with users from Facebook and Kongregate or register and authenticate your own.
 
https://gamesnet.yahoo.net/documentation/
https://gamesnet.yahoo.net/
GoldRun Team Project
Team:     Nelson Wylie,   Edward Mc Evoy,   Adrian Fielding
Team project undertaken was to develop a game created by Edward McEvoy.  Each Player can select five categories which are placed in a pyramidal fashion with your strongest category being the last category one picks which is placed on top.  
 
C# Code & Dynamics
C# and Microsoft Visual Studio Express
 
To develop an online game using PlayerIO you need to have knowledge of C# because this is the language used on the server side. To run and modify the C# code you need to set up the development server for it, which is Microsoft Visual Studio Express 2010. Once set up, you can run the C# code for your game and add to it or modify it as or if needed. PlayerIO provides an API for the Multiplayer C# and also for the .NET Client.
These are essential resources for developing a game. Messages from the clientside are handled on the serverside using C# so it was essential for the team to get to grips with the language and the API. For security reasons it is important to have all the essential code running on the serverside because if it is on the clientside it is suspect to hacking.
C# and Microsoft Visual Studio Express 2010 were completely new to all members of the team and like PlayerIO and BigDB they had to be learned from scratch. C# is one of the most popular programming languages and is considered to be easy to learn and to use. The early stages of the project were spent trying things out and researching C# and Microsoft Visual Studio Express 2010 thoroughly using the PlayerIO documentation, the PlayerIO forums and other online resources.
C# Code Examples
 
Send a message to individual Player
 
Message q = Message.Create("Question details here"); //create a variable string to send message through to client
player.Send(q);
 
//player.Send("You are Logged in");
 
Broadcast a message to all Players
Broadcast("BroadcastMessage", "Question1", “This is the first Question”);
 
Broadcast(q);   // Broadcast message to all players
 
Create object details into User Table
var user = new DatabaseObject();    \\ create variable for database object to enter items into table
user.Set("username", message.GetString(0));  //set the username from entered name
user.Set("password", message.GetString(1));  //set the password from entered text
user.Set("userid", player.Id);         // allows set of user Id from logged in player in the PlayerIO server
user.Set("UserJoined", player.ConnectUserId); // sets the type of user – Guest or Paying
PlayerIO.BigDB.CreateObject("PlayerObjects", null, user, null);
 
 
 
Actionscript Side Receiving and Sending Messages
 
Listen for the message and put it into string when it arrives
connection.addMessageHandler("Question1", function(m:Message){
trace("Question Type: " + m.type);     //
trace("Real Question here -- :" + m.getString(1));//receives message from server
question = m.getString(1);// put the message into a String variable on client side
)
 
Send Message to Server
TheConnection.send(Category1 ", cat1); // send 1st category picked for first Question
TheConnection.send("Score", currentScore); // send score to server where it will update
 
C# Receiving Message and Sending back to Client
 
case "Category1":  // Category1 Switch Case message sent from Client
 
PlayerIO.BigDB.Load("Categories", message.GetString(0),delegate(DatabaseObject obj)
{  // loads Categories table with the Key picked from 1st category type – i.e. sport
string CatConfirm1 = "none";  //create a String to check table
if (obj.ExistsInDatabase)  // Checks table for that string key i.e. sport in table if it exists in the database
{
 CatConfirm1 = "true";   if it finds it – string is set to true
Broadcast("Category1", message.GetString(0), CatConfirm1);  // Send back message to client “Category1, “sport”, “true”
string category1 = message.GetString(0); //set category into string for checking in console
Console.WriteLine("Category name is " + category1); //write to console for checking results
Console.ReadLine(); // read it into the console for checking results
 
System.Random rand = new System.Random(); setups a random number creation in C#
int n = rand.Next(1, 15); // create a int random number between 1 & 15
 
 
if (message.GetString(0) == "sport")
{ //checks message from client in this example its sport and is equal to
 
PlayerIO.BigDB.Load("Questions", "spq" + n, delegate(DatabaseObject question) // loads Questions table, sport + random int and sets up databaseObject for checking
{
string question1 = question.GetString("QuestionText"); //create a string variable to get question
 
Console.WriteLine("Question 1 is " + question1); //write this to the console for checking
Console.ReadLine();  //read it to the console for checking
Broadcast("Question1", "Question 1 is ", question1);  //send question of type sport to Client
});
 
PlayerIO.BigDB.Load("Questions", "spq" + n, delegate(DatabaseObject answer) //loads Questions table, sport + random int and sets up databaseObject for checking
{
string answer1 = answer.GetString("Answer1"); //setup String variable for 1st answer
Console.WriteLine("Answer 1 is " + answer1); //output to console for checking results
Console.ReadLine();  //output to console window for checking
Broadcast("Answer1", "Answer 1 is ", answer1);// send message to Client with 1st answer
 
string answer2 = answer.GetString("Answer2");//setup String variable for 2nd answer
Console.WriteLine("Answer 2 is " + answer2);
Console.ReadLine();
Broadcast("Answer2", "Answer 2 is ", answer2); // send message to Client with 2nd answer
 
string answer3 = answer.GetString("Answer3"); //setup String variable for 3rd answer
Console.WriteLine("Answer 3 is " + answer3);
Console.ReadLine();
Broadcast("Answer3", "Answer 3 is ", answer3); // send message to Client with 3rd answer
 
string answer4 = answer.GetString("Answer4");//setup String variable for 4th answer
Console.WriteLine("Answer 4 is " + answer4);
Console.ReadLine();
Broadcast("Answer4", "Answer 4 is ", answer4); // send message to Client with 4th answer
});
 
 
PlayerIO.BigDB.Load("Answers", "spqans" + n, delegate(DatabaseObject answer)
{  //loads Answers table, spqans(key) + random int and sets up databaseObject for checking
string correctans = answer.GetString("CorrectAnswer"); //gets the answer from table and key spqans and random because of the random int
Console.WriteLine("Correct Answer is " + correctans);
Console.ReadLine();
Broadcast("CorrectAnswer", "Correct Answer is", correctans); //sends correct answer for question back to Client
});
} // End of Sport Question / Answers
 
Update the Score on Server side
 
case "Score":
 
                    var updatescore = new DatabaseObject();
 
                    updatescore.Set("username", playerName);
                    updatescore.Set("Date", DateTime.Now.Date);
                    updatescore.Set("UserConnected", player.ConnectUserId);
                    updatescore.Set("userid", player.Id);
                    updatescore.Set("Score", message.GetString(0));
                    PlayerIO.BigDB.CreateObject("Scores", null, updatescore, null);
 
                    break;
 
Save the User Player Name when log in
 
                case "UserName":
 
 
                    var user = new DatabaseObject();
 
                    playerName = message.GetString(0);
 
                    if (!user.ExistsInDatabase)
                    {
                        user.Set("username", message.GetString(0));
                        user.Set("userid", player.Id);
                        user.Set("UserJoined", player.ConnectUserId);
                        PlayerIO.BigDB.CreateObject("Users", message.GetString(0), user, null);
                        Console.WriteLine("Username is " + message.GetString(0));
                        Console.ReadLine();
                        Broadcast("UserName", message.GetString(0));
                    }
                    else
                    {
                        user.Save();
                    }
 
                    break;
 
 
Updating the score after each question answered – tried code
 
case "Score":
 
var updatescore = new DatabaseObject();
 
// Create a new score
 
int playerScore = Int32.Parse(message.GetString(0));  // converts string to int
 
int totalScore = Int32.Parse(message.GetString(0)); // new variable to push each score into array
int[] intArray;
intArray = new int[15]; // array size is 15
 
                 for (int i = 0; i < 1; i++)                   // loops around once
                 {
                     intArray[i] = 0 + playerScore;  // push the player score into the array
                 }
 
 
               int LengthOfNumbers = intArray.Length; // gives the length of the array
 
int sum = 0;
Array.ForEach(intArray, delegate(int i) { sum += i; });  //runs through the array and adds them up
Console.WriteLine("This is the Array "+ sum); write the total to playerio console to view
 
int updatedScore = playerScore; // used the sum variable instead from the totalled array
 
 
if (!updatescore.ExistsInDatabase)
{
 
                    updatescore.Set("username", playerName);
                    updatescore.Set("Date", DateTime.Now.Date);
                    updatescore.Set("UserConnected", player.ConnectUserId);
                    updatescore.Set("userid", player.Id);
                    updatescore.Set("Score", sum);   // set the score into this Score object in table
                    PlayerIO.BigDB.CreateObject("Scores", playerName, updatescore, null);
}
 
else    
 {
PlayerIO.BigDB.Load("Scores", "playerName", delegate(DatabaseObject obj)
{
int updatedscore = sum;  //puts the Array sum into the database object to save to Score Object in table – this string was set under Case ‘Score’ at top
//obj.score += 1; //Add 1 to current score
Console.WriteLine("UPDATED SCORE =" + sum); //check the calculation to console
 
obj.Save(); //Save changes
 
                   });  
         }
 
             break;
 
 
C# Code done in Visual C# Express 2010
Player IO Server side programming to check 
and update database
 
Flash Code and Messaging in Actionscript to Connect
and Message with Player IO Server Database
Database Design
 
BigDB is not a classic relational SQL database, but rather a modern NoSQL document database, like MongoDB or CouchDB. It has automatic partitioning and scaling, without any developer interaction. BigDB is a great choice for persisting data such as character configuration, levels, world-state, save games, quiz questions, auctions, ban-lists, high-scores, ranking lists, game configuration, items and anything else you would like to save between game sessions.
Essentially BigDB consists of tables just like a traditional database. Every table has a name and can have indexes for fast queries and access rights unique to it. Every table can hold an unlimited amount of objects. Every item in the table is as an object and can have multiple properties. Every object in a table must have a unique key
 
Wireframe & First look Draft
Design Analysis
 
The Quiz of Consequence started out as a concept that existed solely on paper. It had some distinctive ideas incorporated into the design that the team hoped to carry forward into the finished game. These were;
Ten categories of questions – Choose five
Put the five categories into a sequence – Maintained throughout the game
A triangular playing grid displaying the five categories in the sequence
Taking the concept from paper to digital format involved a lot of stages and iterations before the project was finished. These stages included;
 
Graphics Design
Database Design
Game Play
Game Flow
Game Screen
Sound Design
Name Change
Coding on the client and server side
 
C# and Microsoft Visual Studio Express 2010 were completely new to all members of the team and like PlayerIO and BigDB they had to be learned from scratch. C# is one of the most popular programming languages and is considered to be easy to learn and to use. The early stages of the project were spent trying things out and researching C# and Microsoft Visual Studio Express 2010 thoroughly using the PlayerIO documentation, the PlayerIO forums and other online resources.
GoldRun Quiz Game - Team Project - C# & Flash
Published:

GoldRun Quiz Game - Team Project - C# & Flash

Team Project - Game Development Design

Published: