playMaker

Author Topic: storing level information for scenes  (Read 1518 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
storing level information for scenes
« on: February 21, 2016, 06:31:04 PM »
Hi

I have built a demo game and now I have a few levels and at the moment im storing level data in each scene which is used for level configuration e.g. time allowed and numbet of items to pickup

I was wondering what is the best method other than storing this in each scene for the level. Could I possibly create a table which populates the level settings? So its easier to manage when my game has loads of levels.

or is there another way others tend to approach this?

Nick

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: storing level information for scenes
« Reply #1 on: February 21, 2016, 07:08:36 PM »
I imagine there's a number of ways to do this.

Personally, I have an object which stores all the information i want to carry over between scenes (Player Health, Items, etc.) and use the action "Don't Destroy On Load". Then I can grab that information in the new scene and distribute it where it's needed.

In terms of level configuration, it really depends what your doing in your level... If a level is only ever going to be configured in one way, then it makes sense to store that information in the scene itself... If you wanted the scene to change based on variables from a previous scene, you would store that information, bring it over to the new scene, and have checks in place on your level configuration object as to what configuration to do.

For example:

Player selects a difficulty, Easy (1) Normal (2)  Hard (3).   the selection is stored as an integer value on an object, which isn't destroyed when a new scene loads.
Your Level configuration grabs that variable, and runs an "Int Compare".
If Int = 1, set timer to 2mins
If Int = 2, set timer to 1min
If Int = 3, set timer to 30sec

This way you can setup multiple difficulties controlled by a single prefab rather than having duplicate scenes with different level configurations
« Last Edit: February 21, 2016, 07:24:14 PM by Chizzler »

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: storing level information for scenes
« Reply #2 on: February 22, 2016, 01:19:34 PM »
Thanks for that. That makes total sense to use the global prefab to control my game as I do have difficulty variations to set. Thanks for the advise