I'm writing a browser-based RPG in JavaScript, HTML5 with Canvas, EaselJS, etc... I'd like to develop the back end data saving/user profile aspect now.
This is a single player RPG where the player will interact with NPCs to solve quests. It is not online.
I've developed a website in PHP before where I saved my own data in a database, and loaded the images to the page via MySQL and PHP.
For a RPG, how would this process be? In my mind... I will try:
- At the RPG menu, have a user login screen. Handle this with a traditional PHP session.
- Once the user logs in, load their stats from the database.
What I'm confused about is:
Loading text data is okay I suppose... but how can I load objects that were on the screen in the correct locations at the time of the save? Can this be handled through the database?
I have generated the Players, Objects, and NPCs as Javascript objects using EaselJS. To save the state of these objects, do I have to load the character as a PHP object?
Kind of like:
/**
* Load a character and all related items and skills.
* Do this when the user logs in. You can save the data in a session or
* reload it every time the user makes a new request
*/
$Character = Character::model()->with('items, skills')->find(
'username:=username',
array('username' => 'demo')
);
Any tips for loading appropriate data per user profile?
Thanks!