Game Development Community

Create login page for keeping track of players entry to the T3D desktop game

by farzad alamdar · in Torque 3D Professional · 01/08/2014 (4:34 pm) · 12 replies

I am developing a desktop T3D game to be used by students to submit their assignments. What I need is to create a login page at the beginning of the game so that players can first login with their allocated username and passwords and in case they provide correct username and password, they will be directed to their assigned stage of the game. Could someone please help me through solving this by proving links, or anything that can direct me? Thanks.

#1
01/08/2014 (8:44 pm)
I need some more information please. I do not understand because unfortunately I am not there to see what kind of set up you have. Do you have a separate computer with a separate Torque install for each student? If so, then I might be able to help you, but if everyone is feeding off a central computer then this is beyond my current abilities to help. Also what is the purpose of having a login? Do you have multiple classes that use the same computers?
#2
01/08/2014 (8:54 pm)
We recently did something like that for a player stats tracking project we are working on... we used a TCPObject in torquescript communicating with Python (www.twistedmatrix.com/ ) which did all the DB work. Players are authenticated by a .cs file key that's generated when they register and they place in a clientside autoexec folder. The server asks the client to send the key if they have it and talks with python to ID them.

I think the more accepted way is an HTTPObject communicating with something like php though.
#3
01/08/2014 (9:50 pm)
@ Gods and Nememis,

Thank you for your response. As you mentioned in the first part of your comment, I want to give separate Torque to be installed by each group of students on their own computers. There is no need that everyone could feeding off a central computer. The only thing I need is to have for example a text file containing a number of allocated "username" and "passwords" for each group of students. Then, each group could login and enter to the game. The purpose of having a login page is that I have 10 groups of student and customized 10 different worlds and each world will be the playing environment for each group. Thus, I need a login page to first authenticate each group and then giving access to each authenticated group to their assigned world throughout their interaction with the game. I found a resource "http://www.garagegames.com/community/resource/view/7605/2#comments" that suits for my purpose, but the problem is that it was developed for old versions of T3D and the scripts addresses and names has been changed and outdated. I hope I could explain clearly. Your help will be greatly appreciated.
#4
01/08/2014 (10:26 pm)
@ Matt T,

Thank you for your comment. I totally agree with that. However, I have limited programming background so that I am more inclined with simple solutions with as less as possible coding effort requirements. I will serve your solution for my future T3D development purposes. Many thanks.
#5
01/09/2014 (6:57 am)
In that resource he states immediately that he's using a SQLite database for user information. Not a bad idea, actually, even for the simpler case you describe - but because it doesn't sound like you're doing this you will have to change your user lookup.

Will all 10 groups be logging in at the same time? Or any two groups, for that matter? Torque isn't built to handle loading more than one mission per session (the server loads one mission and all clients connected to that server see the same mission). So, if you need more than one group connected at a time you will want more than one physical server (or alter the engine to be able to load multiple missions and handle players in different missions on the same server). And then, if you have multiple servers the simple thing is to just have each class join their assigned server - unless again each student has their own customized mission - in that case I'm at a loss.
#6
01/09/2014 (7:24 am)
Here's a simple solution for flat-file user information. Just a very basic scratch idea.

// below are space delimited data fields.  broken into classes for no really good reason
// except to make sorting out appropriate mission names easier I guess.
$UserList::Class1[0] = "JJohnson password mission1";
$UserList::Class1[1] = "BBobson password mission1";
$UserList::Class2[0] = "PPatterson password mission2";
$UserList::Class2[1] = "LLineman password mission2";
$UserList::Class3[0] = "RRothchild password mission3";
$UserList::Class3[1] = "SStevens password mission3";

function UserList::getUserInformation(%userName, %classNum)
{
    eval("%data = $UserList::Class"@%classNum@"[0];");
    for(%index = 0; %data !$= ""; %index++)
    {
        %name = getWord(%data, 0);
        if(%name $= %userName)
            return %data;
        eval("%data = $UserList::Class"@%classNum@"[%index];");
    }
}

echo(" -- $UserList::Class1[1] : " @ UserList::getUserInformation("BBobson", 1) );
#7
01/09/2014 (8:24 am)
Richard,

I think that what you have is the best solution. I was thinking of having the teacher create a separate mission named after the student. Then the student would click on their mission name and type their password to gain access. This would require that the teacher make the load mission button on the load screen "push" a simple gui where the password is needed. Then after they type the correct password it will push the gui button that has the actual load mission function.
#8
01/09/2014 (10:34 am)
This is an interesting challenge from both a security and a server vs. client standpoint. And of course I saw the word "login" in the thread title, which as about 90% of the torque community knows is an attractant for my eyes to read. ;)

Here's how I'd go about this, and actually Richard, you could have one computer act as the "server", or in his case, for the instructor to use.

1. Create a PHP/SQL system on the "server". This would be the "teacher" of the class. You would then define in the SQL table a set of usernames, passwords, and progressions (you could do mission) or if you were clever and made use of %obj.save() properly, could even store mission progress on the "server". For everyone's knowledge here, the "server" is actually a PHP/SQL interface. One with HTML/JS experience could make something really... really cool.

2. Now on the Torque side of things, you'd store all of the mission files in the game and all of the necessary files as well. As Network Security Law #1 states, The server always has the final authority, so do not store important client information, on the client (we don't want to introduce little script kiddies who are "magical" at torque).

3. To handle the groups and connections, use the SQL portion to define all of that. and then generate connection requests to the server (PHP) via TCPObject or HTTPObject. There are plenty of good resources out there (Me, having wrote a few of them myself) on how to do these kinds of tasks in torque.

4. And so Richard isn't left in the dark, modify the connection functions of your game (query tools) to instead connect to the PHP aspect of your server to pull the current "mission" they are on, and then by means of CreateAndConnectToLocalServer, create a clientside "server" in which the "student" may play on. Further connections if in groups could then be allowed by checking the PHP/SQL side of things and seeing who goes where, and if a server is already up and running on a local machine.

Feel free to ask if you need any more help!
#9
01/09/2014 (11:49 am)
Of course, Robert has the "real" answer - he's got that stuff down to a science and his way is definitely very secure.

My answer is about as drop-dead simple as possible and totally not secure.

And we still have the question of how many missions you have to serve simultaneously. I like Robert's idea of using the same mission and just populating it on each client based on the user's progress.
#10
01/09/2014 (4:33 pm)
@Richard,

Really appreciate your helpful comments. With regards to your question "Will all 10 groups ...?", I have several physical servers in a way that each student install a copy of the game on their own PC. You have clearly point to my purpose with your sentence "if you have multiple servers the simple thing is to just have each class join their assigned server" which is my exact goal. Thus, each group of students play their customized mission designed for that group without necessity to connect other group or playing with them at the same time. The idea of login page is only to use it for giving access of each group to their assigned mission. Again many thanks for your response. At the moement I am trying to apply and fit your piece of code in my T3D.
#11
01/09/2014 (4:35 pm)
@ DreamPharoah,

Thank you. Nice idea.
#12
01/09/2014 (5:07 pm)
Thank you Robert for your well explained answer. As Richard mentioned, at the moment the security issues is not my concern as this is pilot project for a few people to use it. So, due to my time limit and limited programming background I intend to first work with simple solutions unless there is no other way of using complicated codes. I will defiantly use your nice idea later. Again, thank you.