playMaker

Author Topic: GameManager & MetaData example?  (Read 1589 times)

rechronicle

  • Full Member
  • ***
  • Posts: 119
  • Mystvaldia
    • Indie RPG Creator
GameManager & MetaData example?
« on: May 22, 2019, 10:30:26 AM »
Hello,

I was trying to understand how these two works, but I can't really get it right into my head after reading from the forum. I guess I need an example in a real game.


- First things first, are they the same thing with a different name?
- In a simple 2D platformer game like mario, basically, how did they work in the game? What did they do exactly?


Hope anyone can help me with this.
Thank you!

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: GameManager & MetaData example?
« Reply #1 on: May 22, 2019, 01:58:26 PM »
Not sure what you mean by GameManager or MetaData, something like this?

Here's an example in a game by Unity:
https://learn.unity.com/tutorial/level-generation?projectId=5c514a00edbc2a0020694718#5c7f8528edbc2a002053b6f7

If you mean the singleton style discussed in the other thread: such objects can be useful for "high level" management, like keeping track of player, items, enemies and suchlike. For example, if you have thousands of Zombies and each needs to know where the player is, it might be better that such information is available and updated in one place, rather than that every zombie has to find the player by tag.

It can also manage game states, like when the control scheme changes, or in turn-based games (where something needs to keep track of whose turn it is and arrange matters accordingly, give and revoke controls and so on).

MetaData: not sure what you mean. Maybe you mean high-level data that needs to be managed somewhere central? The reason for having a game object for this (and a script) is usually to avoid Global Variables. Programmers have nightmares from exposed variables and prefer them locked, private, and buried at the bottom of the ocean. Exposed variables have the habit that they are getting changed from random directions, especially when working in a team. Having everything global is very neat and convenient, which is why a team would naturally gravitate towards exposing everything and setting everything from everywhere, which is just asking for severe bugs that are hard to track down, leading to severe depression in programmers, heart failure and premature death.

Why everyone is anxious about global variables in Playmaker, I don't know. Probably for similar reasons. You should be able to do everything without them, and when you rely on Global Variables, it's perhaps a sign that your project is messy and chaotic.

So, a MetaData holder can store settings, player prefs, high score, lives left, difficulty settings, and suchlike. In a prototype, you might want all the important knobs in one place, to adjust them quickly etc.

rechronicle

  • Full Member
  • ***
  • Posts: 119
  • Mystvaldia
    • Indie RPG Creator
Re: GameManager & MetaData example?
« Reply #2 on: May 22, 2019, 10:14:20 PM »
1. Yeah, something like in the 2D Roguelike example. The game object named 'GameManager', 'UIManager' or 'LifeManager', etc.
And the 'Metadata' mentioned in PM Best Practice page.

2. So they're both used ONLY to contains data, no data calculation whatsoever, but GameManager is updated in real-time or frequent it seems?

3. If you want to make 2D platformer like mario, what would you put in GameManager & Metadata?  I don't know, but I think an example from a platformer genre is straightforward and easier to adapt/evolve into another genre.

I assume the GameManager will have: currentHealth, levelTimeLimit, jumpStrength, currentScore, isGrounded?. (something that changes in real time.)

And the Metadata: playerName, previousLevelScore. (something that maintained over scenes.)