Skip to main content
GameDev.net gamedev.net
🔒 Locked

Program a Login?

Started by Mattlab Aug 14, 2006 at 10:39 PM 4 replies 1.5k views
Original Post
Mattlab
Mattlab
How do I program a simple Login? I want it so that users have to be on a database that I set up in order to be able to play my game. So basically when you click the EXE I want a Logonscreen to pop up that asks for a username and password and then if the user is in the database (i put them in manually) the game starts if not then it says thats not correct and exits. Any ideas on how to do this? I need the full code and also ideas for the database. Thanks, Mattlab
Check out the game I am working on http://www.gamedev.net/community/forums/topic.asp?topic_id=342254
X5-Programmer
X5-Programmer
Well, you are not learning so mutch by copy and paste code, but I can tell you how it works.

1. Setup an GUI so you can enter the username and password.

2. Send the username and password strings to the server( encrypted ).

3. Server recives the username and password string and decrypt them. Then use some sort of database libary maybe MYSQL? to send a query to and check if the username exist and if the password for that user is correct. If the username doesn't exist or the password is wrong send back to client "Incorrect username or password" else the server sets some sort of flag = "logged in" and then send a packet to the client to enter the game.

this is a very easy way to do it, there exist alot more complex ways like sending tickets and stuffs.

well I hope you understand my crappy english.. cheers.
-[ thx ]-
Mattlab
Mattlab
I have no idea how to do this and would not even know where to start. I hope I can find a programmer that knows networking! I work on a community indie game that is programmed by volunteers so it will be hard.

But thank you for the advice!
Check out the game I am working on http://www.gamedev.net/community/forums/topic.asp?topic_id=342254
hplus0603
hplus0603
Do you know how to create a dialog where the user can enter a name and password?
If not, you need to learn that, or find someone who already does (see the Help Wanted forum).

Then, you need to learn how to send data to a server. The Forum FAQ has a number of helpful links and documents.

Then, you need to actually program the server. Again, the Forum FAQ has links, and also the "Resources" section.

Good luck!
enum Bool { True, False, FileNotFound };
Mattlab
Mattlab
Hmm interesting. Yes I will go and see if I can find people to help. Hopefully they will PM me.

I think this is a great way to protect your game because now istead of just needing a pass to unzip you can also set a pass to even play the game.
Check out the game I am working on http://www.gamedev.net/community/forums/topic.asp?topic_id=342254

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.