Devereaux Posted December 31, 2012 Share Posted December 31, 2012 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! Quote Link to comment Share on other sites More sharing options...
srachit Posted December 31, 2012 Share Posted December 31, 2012 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) Quote Link to comment Share on other sites More sharing options...
Someone Posted December 31, 2012 Share Posted December 31, 2012 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. Quote Link to comment Share on other sites More sharing options...
Devereaux Posted December 31, 2012 Author Share Posted December 31, 2012 1331, that's pretty much what I was looking for. So just during character creation write the id of logged in user to users.id in the character table? Quote Link to comment Share on other sites More sharing options...
Someone Posted December 31, 2012 Share Posted December 31, 2012 Exactly. You pretty much already knew what todo :) Quote Link to comment Share on other sites More sharing options...
Someone Posted December 31, 2012 Share Posted December 31, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.