Loader

Description

Will send XML data to the managers that need it by using a reference to the Window class. Level sections, player data, camera stopping points, and boss data will get sent to the LevelManager. All assets, including textures and audio will get sent to the content manager to get loaded. The audio names will get sent to the AudioManager so it can get the songs/effects from the GameContentManager. The cinematic slides will be sent to the CinematicManager. Each of those managers will have methods that will take in that data.

Relationships

  • Window : has a reference to Window so it can send data to managers that need it

Members

  • Reader reader - Reads in the data
  • Writer writer - Writes in the save files

Methods

  • LoadXML
    • Loads the XML data. This is done in a while loop, using a case statement which checks which tag is being read in.
    • returns all data to Window class which then give the data to the classes that need it, including the GameManager which needs enemies, checkpoints, obstacles, objects, tile images, color map, player data, camera stopping points, and boss info. Textures get sent to the content manager to get loaded in, audio gets sent to the audio manager, and cinematic slides get sent to the cinematic manager.
  • Savegame
    • An integer will be stored that will represent the current level the player is saved to. It will save the integer to a text file.

Other Notes

XML Format

  • level sections
    • bounding box representing position of section in the level
    • enemies
      • type
      • position
    • checkpoints
      • position
    • obstacles
      • image name
      • position
      • bounding box
    • objects(non-collidable)
      • image name
      • position
    • tile images + color map( name + placement(not textures))
      • background tiles
        • name
        • position
      • foreground tiles
        • name
        • position
      • play area tiles
        • name
        • position
      • color map tiles
        • name
        • position
    • camera stopping points
      • position
      • enemies(that appear when you reach the stopping point)
        • type
        • position
    • level dialogue
      • name
        • to determine which dialogue it is since more than one dialogue can occur during a level
      • dialog
  • player data
    • starting position
  • boss info
    • name
    • position
  • textures used(all)
    • path
    • name
  • audio (music + effects)
    • song
      • path
      • name
    • sound effect
      • path
      • name
  • cinematic slides(before the level)
    • slides
      • name

Loading Process

Loading will start when the game state in the Window class gets changed to Loading. When this happens Window will call the LoadXML method passing in the path to the level xml file that should be loaded in. LoadXML will load in the XML document and then based on that make all the data. At this point the Loader will, using the reference to the Window class, pass that data to the Managers which need it. Each Manager will have a method that is used to pass in the data. Level sections, player data, boss data and dialogue will get sent to the GameManager, then the GameManager will further send level sections and boss data to the LevelManager, player data to Player and dialogue to LevelDialogue. All assets, including textures and audio will get sent to the content manager to get loaded. The audio names will get sent to the AudioManager so it can get the songs/effects from the GameContentManager. The cinematic slides will be sent to the CinematicManager. After all Managers have the data and have reset and initialized everything the Loader will switch the game state to Cinematic through the ChangeState method in Window.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License