JELLE VAN DOORNE - GAME & NARRATIVE DESIGN
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit

Save Me, Load Me, Delete Me

19/5/2018

0 Comments

 
This week was the week of menus, saving, pausing and loading. Not necessarily as exciting as the rest of the game, but a vital part. I had to learn about how to save the game by writing and reading data files, keeping 'singletons' throughout different scenes, as well as how menus work with different control setups.

Bugged Out

Pausing the game was the easiest part. Press the "Menu" button (which listens to both Escape on your keyboard, as well as the Start button on whatever gamepad the player plugged in), and run different methods based on whether or not the pause menu is currently displaying.

I ran into a 'bug' regarding timescale. Loading a new level didn't reset the timescale, so pausing the game, going to the menu and then reloading the same level made the game appear to be frozen. Woops!
Picture
Picture
Menu navigation is practically automatic thanks to Unity's new UI system. Buttons simply look at whatever script and method you tell them to, so no separate scripts for each button anymore, unlike previous Unity iterations.
Picture
The main menu works much the same as the pause menu.
Saving and loading the game turned out to be the bigger challenge. First, I learned about what's known as "singletons": objects that persist from one scene to the other, and destroy other objects that are the same as it. This is useful to keep data persistent between different scenes.

I've actually used singletons before years ago without knowing it, except the way I picked it up now is much smoother.
Picture
Saving data to a file turned out to be a lot more complex than I thought, and a lot more manual work. Creating a file is not too difficult, but making sure everything you need is "Serializable", as well as manually writing every piece of data to that file? A little more time-consuming than I thought. Right now the only thing written is the party members the player recruited, but that list will need to grow out a lot as more gets added to the game... Such as every stat for every NPC you recruit. That's gonna be... a lot.

Loading data is pretty much the same, except the other way around. Open an available file, take out the data from the classes found inside and put that data back into different objects.
Picture
Summary: Create a file, write away data from other objects, write it in the file, close the file.
Picture
The main menu adds different characters based on which characters were recruited by the player!
Since I'm already working on different scenes, I'm going to spend next week working on the overworld, as a way for the player to access levels. It's a pretty common design for both platformers and RPG's, and it should be a decent break after the headaches I've had this week.
0 Comments



Leave a Reply.

    Tweets by GameViola

    About

    This is a development blog for my own game project, "Viola".

    Picture

    Archives

    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018

    Categories

    All
    Art
    Design
    Music
    Programming
    Story
    Viola

    View my profile on LinkedIn

    RSS Feed

Site

Portfolio
About
​Contact
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit