Login through a website

Soon I will be hosting a website where players will be able to create an account with an email, password and beta key. I need to know a way that the program/game will be able to access the site to confirm information that is entered into the game text box and then allow entrance, any leads?

Why exactly do users need an account to play your game?
Most of the members will recommend not making people login, because many simply wont bother then.

But to answer your question, you could setup a php form where the program submits the login data to.
This form could simply return true or false on a successful submit. However this is very easy to tinker with, if you could give an example, its much easyer to suggest something.

Well I added a login system so that I could get the users name for when they join multiplayer and I also have a login system to prevent pirating of my game

Well with login forms, or any php forms, you have to be veeeeery careful. There are many things people can do to your site if you aren’t.

RobinB is right, most people are simply to lazy to register for a game and just stop playing…

Honestly, you should probably read up on PHP and get a page working that you can view on your browser and submit data to though $_GET’s. Then you can take it a step further and create a small, test Java program to send data to it through post requests. Finally, implement it in your game.

However: Don’t release that version of it yet, read up on how people can exploit these kinds of php forms. If you want I can help you in that area and make a few suggestions as to where you can make your php code a bit more secure.

As for actually storing the data, I think it’s pretty common to just use MySQL. If you are feeling adventurous I suppose you could check out PostgreSQL, as well as a few others. But MySQL is generally the most common one in my opinion.
There are other ways of storing login data, and it depends on what and how you want to do stuff.

Have fun, experiment!

I use Servlets and GoogleAppEngine on my website. It’s free and a lot less hassle than setting up a LAMP server.

Where’s the fun in that? Or the learning?
This is a perfect opportunity to learn some server side languages such as Ruby, Python, Perl, Django, etc.
Take it!

Thanks man! You seem to have a lot of knowledge in this area of programming, if I get stuck I’ll message you

I’m okay. There are tons of people out there that are so much better than I am, but I know enough to be able to help you here :slight_smile:
Looking forward to helping you out on this one, I love this stuff!

I didn’t know it was a learning exercise. Anyway, Java is the uber server-side language. Also, I have no idea where you get the idea that building a Java-based website would not be fun, or that using the Google infrastructure would not involve learning relevant and with-it technologies like nosql.

Point taken, using the Google thing would let you learn some stuff. However, in my opinion he should learn the basics of php and other languages like it as well as some SQL stuff. As you said, your method would let him learn a bit of SQL as well but I still stand by what I said.
This is just my opinion though, and everyone has a different one. Maybe he can try both :slight_smile:

He states he would make people login for an drm like tech (always on).
This will not stop pirating as it is bypassed with ease (they can simply override your website with their own, always returning successful).
Also with multiplayer this is abused easily, because it requires some more checks to make it safe.
Read up into RSA and AES to make the connection at least secure, also find out what processes need to run serverside to multiplayer your game.
An webform might not be enough.

Thanks for the help everyone I also have some other questions:

  1. What would be the best way to prevent pirasy of my game?
  2. How could I make a in-game multi-client chat for the multiplayer portion of my game?

I wouldn’t worry about it unless your game becomes popular enough to pirate. When you start earning a living from your game, piracy might become a concern.

Perhaps you could send some form of message protocol through TCP sockets? A quick google of “java chat” should reveal all you need to know. Honestly, if you know enough to implement a website and login system, then chat should be a breeze to implement.

Same as nerb, you cant. You can only add annoyances, but with every pirate you scare away, potential players go with him.

You cant with an website, i think you want an response time within seconds from the chat, when you have lets say 10 players, your webpage will be bombed with 10 requests a second. People who visit your site might not even be able to load your page then.
You would need an server application on an server keeping sockets open and sending events when needed.
There might be some simpler solutions like adding some kind of irc api to your program and fetching its contents once a while.

Given the minuscule amount of data involved with text based message, I’m fairly sure even the least optimized web server out there can handle well over 10 requests per second without breaking a sweat, much less grinding to a halt.

Or you could have a lower priority thread that runs on the client and polls the server via a GET request for new chat messages at a set interval. Web based Ajax chat widgets have been doing this for quite a while and implementing the same in Java is fairly trivial if you already have enough knowledge to develop the client server protocol for your game. In the case of chat, you get a bit of cushion room in the timing department since a small delay in sending or receiving doesn’t have a real impact on the game itself.

I meant a chat program within my game btw :smiley:
-I’m asking a lot here but does anyone have a multi-client chat program along with eclipse source code?
-I also have another question…how do i allow the user to start typing data in a program thats already running, I dont want the text boxes there the whole time and they should only be able to type data in a certain part of the menu within the game, any ideas how this could be done?

Did you try that? I did :slight_smile:
Its not about the data, its about the requests + associated header data, lets do some math.
10 request an second = 36.000 requests an hour = 864.000 requests a day for only 10 users!
Thats not all, because if the header data is 250 bytes (mostly around this), your using an bandwidth of 216 MB a day.

I know this is exaggerated, because you probably don’t have 10 users online all day and you might get away with only fetching new messages every 5 / 10 seconds.
If you can live with this, go with it :slight_smile:

  1. Probably not, try it yourself first.
  2. Show and focus textboxes on an keypress (like return).

could you show me some source on how i could do that?

or you could just use an open IRC server, the protocol is really really easy and you wouldn’t have to host anything.

Indeed I have.:slight_smile:

That was my point; due to the human interaction that happens in a chat scenario, you can get away with significantly longer delays than you can when dealing with input to the rest of the game engine. When I issue a command to a game, I expect immediate feedback, when I send a message to John or Jane Doe somewhere else in the world, I have an expectation of receiving feedback somewhere between when they get around to it to potentially never. Consider also that most home connections in technological countries can move gigabytes in a matter of a few minutes. Assuming your central server is hosted by a regular provider with a bigger pipe, 216mb a day isn’t a significant amount of traffic by any means.

Have you mentioned what framework you’re developing your game under? Vanilla Java, LWJGL, other? Depending on what you’re using, there may already be “drop in” solutions you can use.