Tuesday, March 26, 2013

Fast RPG Update 6

Saving & Loading!

Changelog:
23/03/13:
- Added mute button
- Improved contrast of UI


24/03/13:
- Added saving/loading game data (inventory, equipment, quests, stash, player stats)
- Start at level 1
- More appropriate equipment at the start
- Made all items & quests serializable for easy loading/saving
- Added save game button in town

- Changed player sprite (still WIP)

25/03/13:
- Removed pole in town
- Improved notification window
- Improved question window
- Added question when saving
- Added clear data button for wiping the saved game
- Changed equipped weapon position and scale
- Multiple items got from chests now don't spawn multiple notification windows, but one with all items listed
- Enemies drop clickable chests


26/03/13:
- Added pages and buttons to stash (150 items can be stored, split into 5 pages)
- Improved quest system
- Updated save/load code
- Fixed huge bug: accessing the player equipment created empty equipment in every empty slot instead of null, resulting in lots of glitches and bugs
- Updated stash position and look
- Adding generic button class for all buttons, with mouse over and press texture changes (5%)

Explanation:

I've left a bigger gap between this update and the previous one because there were some features and changes I really wanted to put in there that were suggested on Reddit by the user NobleKale, a very active user on r/gamedev. Here is my post on Feedback Friday.

His comment inspired me to make some changes, especially the GUI and a mute button.
So I've improved the borders on GUI elements and changed the colors:


And I've added a mute button as you can see under the inventory button:


Another thing I was thinking about ever since the beginning of this project was an effective and easy way to save and load progress. I had to save the preferences anyway so the game would remember if you disabled the sound.
I decided to make a save & load system that collects all the dynamic data and store it with PlayerPrefs  as strings.
This was a bad idea, especially for the inventory and all other item-based collections.  
Luckily I found a very handy script that handles serialization (saving) of custom classes very well and saves it to the playerprefs.
 
This meant I could easily save all items as blobs of data that could be loaded fast at startup.
Everything is saved now if you click the save game button:

Clearing the game data is also possible, although I'm going to move the button somewhere else, probably inside a settings screen. When you press the button you get this lovely warning:

As you may have noticed, notification windows and question windows have been improved, the icon has been placed on top and the information is below it.
Here are some examples:

Notifications can now display multiple icons for showing everything you got from a treasure chest in an instant.

Speaking of treasure chests, all chests are now clickable, even the ones dropped by enemies:
I've also added an animated arrow to make it clear you have to interact with it.
This change is the first towards putting more interactivity in the game besides drinking a potion or two to regain health.

The player sprite has also changed, to a more warrior-like appearance, but there's still a lot of work that needs to be done:
Another thing I've added is stash page browsing, the stash in code was way bigger than could fit on one screen, especially if the target is an Android phone, so I've added navigation to the stash window:


You can now use the full 150 item slots for organizing your stuff!

One last, but very important change I've started on is visual button feedback:
Note the Adventure button color, the cursor is on it
What I mean by this is that buttons light up when you move your mouse/finger over them and press them.

Phew, I hope this update wasn't too big.
Please leave a comment or tweet me if someone has a question/suggestion!
I'll post the save/load code if anyone is interested, it should work with any game.

Cheers!
BlackDragonBE

No comments:

Post a Comment