Username/Password

Blitz3D Forums/Blitz3D Programming/Username/Password

RRK1020(Posted 2005) [#1]
I am trying to make a net game.


RRK1020(Posted 2005) [#2]
w/ usernames & passwords. I need to make it so people cant have the same name as someone else using the game. how would I do this?


octothorpe(Posted 2005) [#3]
You'll need to keep a table of user accounts available on the (authentication) server, keeping the username field unique. A table is a persistant collection of objects, meaning you'll need to store them on disk.

Your client will need to be able to send requests to register new accounts as well as login. You could conceivably combine these operations in the interest of simplicity.

You'll also need to keep track of whether anyone's currently logged into an account to prevent two clients from logging in with the same username and password.


Banshee(Posted 2005) [#4]
If the username points to the account ID then anyone choosing the same username will not login to a new account - but one that already exists. The password then confirms the authenticity of the new user.

My own network games determine whether to create a new user account based upon whether the username typed in already exists. I have no New User button...


KuRiX(Posted 2005) [#5]
The best solution so far is using some database engine like mysql. Then you can access mysql using php like in the GNET samples...


Banshee(Posted 2005) [#6]
Personally I preffer to keep it simple so I just have a file made from within Blitz storing user data.

Readline() and Writeline() are very easy to use and it is a lot faster to do than a database lookup (which performs the same task but only after going through a database communication layer aswell). It helps to keep server CPU load lower if you handle your data internally rather than "sub-contracting" another application.


octothorpe(Posted 2005) [#7]
It helps to keep server CPU load lower if you handle your data internally rather than "sub-contracting" another application.


Running the database on a separate machine keeps your game server CPU use even lower. ;)

An external database (whether it's running on the same machine or not) costs you a certain amount of overhead every query, but will outperform amateur code when actually working with your data. Modern database systems have been written and improved over many years by teams of hardcore programmers. They've used tricks to speed up queries that many of us would never dream of.

If your tables are fairly small and your queries are fairly simple, you're probably better off with a homebrew system using File IO.


Banshee(Posted 2005) [#8]
In my experience database programmers are usually the board swappers of the software world. I wouldn't put too much faith in the efficiency of their software, especially those which go through multiple application layers such as Acess or acessing mysql via php from a Blitz app as suggested earlier

In my opinion off the shelf database systems are great for point and click users who don't code but they just cannot rival something dedicated for the purpose and if your going to code a multiplayer application (which this thread was originally about lol) - which is basically a huge database - then you're much better off coding it in the same language the client software is in and using a common data structure (in this case Blitz3D) than you are farming some tasks out to multiple software platforms which vary between client/host.

No amount of "fancy tricks" used by white collar entry level programmers of an obese utility application can compete with internally handling large amounts of data in an indie game, databases tend to use generic lookups that are not optimised for your particular data content for a start, whereas as programmers we can use a method designed specifically for the most likely data content and our index order.

Thus endeth my late night 'need a smoke but i've given up' rant for tonight... ;)