Jump to content
MakeWebGames

User creates multiple characters


Devereaux
 Share

Recommended Posts

Hello, I'm not sure if this is in the right area but if it's not please feel free to move it.

I'm in the process of creating a game where a user from the users table will be allowed to create and select characters that are binded to that users profile. Allowing users to have up to two characters that can be selected to "Play As" after login in with the user account. My problem is since while I am not extremely new to php, this approach has me a bit stumped. How could I bind characters created by a userid to that character?

Is it something simple that I missed and just am over thinking? For example sake, we'll use 'users' table and 'characters' table. Any help or suggestions?

Much appreciated!

Link to comment
Share on other sites

Mhm maybe make a new coloumn called char 1 and char 2? And then duplicate the skills and money etc that you use.

So first let user input his username check it with the username and password in database and then give him choice betweem char 1 and char 2.

There might be a better way out there, but thats the first one I thought of, I might try coding one like that today(or atleast soon :P)

Link to comment
Share on other sites

How about one main account. That handles email,username,password that user login with. Then get to select character to play with.

users table

id username password email

characters table

id users.id character class level etc...

Once logged in

list characters

select * from characters where account.id = users.id

a href="index.php?character=character.id"> select character<*/a>

Character selected, lets play

$sql = select * from characters where account.id = $get.character LIMIT 1

If you are planning on using an existing game engine this can be done with kind of making extra login system. Outside of the current user manager, kind of like you would login twice.

Link to comment
Share on other sites

users table should perhaps have a column for active character as well. Especially if the character can, or the player is limited to a character for some period of time, say the character is in hospital, and you dont want the player to be able to logout and login and select another character.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...