Hello, my name is Jamal and I've been interested in programming video games for a long time. I've attempted to make games in the past however, they never really got far or at least close enough to them being released. This is mainly because I was biting off more than I could chew. I know that before I ask this question, many people are going to discourage me from making an MMO. Please save those comments because I know exactly how hard it is to make an MMO. Which is why I am starting off small and then working towards making my game greater.
Anyhow, I plan on releasing a 2D Java game that is going to be hosted on my websites server. I wanted to make the game multiplayer(obviously) but I also wanted to make a system in which the player would log-in and then be able to access their characters in their account and play the story. I'm recently learning about sockets however, I was wondering if anyone had a method or even the slightest idea of how to save a player's information so that it could be loaded back into the game?
I already have an idea where whenever the player logs in, you create a new initiate of a Player Object and then pass certain variables through. For example, the player logs in from one GameState and then goes into another GameState in which the Player() is called. When the Player() is called, it passes these values and these values tell the game where the player needs to be, etc.
public class Player
{
String name;
String race;
int attack;
int defense;
public Player(String name, String race, int attack, int defense)
{
this.name = name;
this.race = race;
this.attack = attack;
this.defense = defense;
//etc
}
}
I could always store these values into a SQL database so that way whenever the player logs in, I can just pull these values from there however, I was wondering if there was a better method for saving the player's data. Any thoughts?