1 / 24

Software Performance on an X-Box Game

Software Performance on an X-Box Game. Brandon Yaussy. Outline. Introduction Development Tower Defense Tools and Techniques Problem Sets Other Performance. Introduction. My partner and I are working on an X-Box game C# XNA Development Kit Tower Defense

darius
Télécharger la présentation

Software Performance on an X-Box Game

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Software Performance on an X-Box Game Brandon Yaussy

  2. Outline • Introduction • Development • Tower Defense • Tools and Techniques • Problem Sets • Other Performance

  3. Introduction • My partner and I are working on an X-Box game • C# • XNA Development Kit • Tower Defense • Waves of enemies walk a preset path • You build towers to combat them • Towers automatically fire when in range • Many problems throughout game • Freeze-Ups • Frame Rate Drops

  4. Development • Planned ahead before coding • Structure • Classes • Inheritance • Used online samples to start • Game class • ScreenManager class • Wrote our own classes

  5. Behind the Scenes • Game Class • Runs everything – starts the game, initializes the classes and objects for play • ScreenManager Class • Preps the different screens for display • MainMenuScreen, PauseScreen, GameplayScreen… • Sprite Class • Initialize() • Update() • Draw()

  6. More Behind the Scenes • Towers • Enemies • Characters • Projectiles • Behaviours • XML files • Sprite Sheets

  7. Source Monitor • Freeware program designed to allow developers to see inside their source code • How much code, how much comments • Depth • Complexity • Includes Tables and Graphs • Kiviat Diagram

  8. Complexity Formula • M = E – N + 2P • M – Cyclic Complexity • E – # of Edges • N – # of Nodes • P – # ofConnected Components • Developed by Thomas McCabe • Believed the value should not exceed 10 • Most Software Engineers believe that should be 15

  9. Kiviat Diagram • 6 attributes that SourceMonitor believes are important for keeping up good performance.

  10. Code Visualizer • Visual analysis tool that complements SourceMonitor • Illustrates control flow • Charts and Diagrams • UML diagrams • Sequence Diagrams • Used to show class relations • Project Statistics • Coupling • Cohesion

  11. Code Visualizer Samples

  12. Reverse Engineering • Process of understanding the structure and operation of software in order to learn its functions • Basically used to determine design decisions from end products with no additional knowledge of the procedures involved at the beginning. • Why it’s useful to us. • Two people, sometimes working separately • Very busy schedules • Working on it for a year and a half

  13. Problem 1 • Problem: Frame rate would continuously drop once game had started. • Cause: draw() function in Gameplay Screen wasn’t clearing old iterations of objects. • Tool or Technique: Code Visualizer : Code Compare

  14. Explanation • The game displays objects and backgrounds in frames • They go so fast, it tricks the eye into believing it’s smooth movement • Ours got worse and worse • Every sprite has a draw function, that is called from the screen class’ draw function. • This is done multiple times per second to provide animation. • However, the objects being drawn weren’t being destroyed. • It eventually became too much.

  15. Problem 2 • Problem: Frame Rate would instantly shoot to 0 when a tower was placed in competitive mode. • Cause: Setup() in placeTower() was calling the wrong loeadTexture() function. • Tool or Technique:SourceMonitor

  16. Explanation • When a user places a tower, the code calls the placeTower() function which includes the following function calls in order of ascending intricacy • checkColor() • Setup() • Finalize() • addProjectile() • checkSpot() • Build() • Setup should have had a complexity of 2, but instead was marked at 144+. • Setup() was calling a loadTexture() function that causes every texture in the game to be loaded.

  17. Problem 3 • Problem: Game froze when trying to start game in cooperative mode. • Cause: I never had our playerList updated to include two players instead of one. • Tool or Technique: Debugger

  18. Explanation • Whenever a game is started, it needs to preload all of the textures and characters and place certain objects, such as players, into lists. • Our playerList wasn’t updating to a maxSize of 2. • Tried to play cooperative mode, but couldn’t because there was no second player.

  19. Problem 4 • Problem: Game would freeze anytime a cannon tower was built. • Cause: An infinite for-loop was created whenever the first cannon tower was added. • Tool or Technique: Debugging

  20. Explanation • Whenever sprites need to be drawn, they go into a list and then the draw function has a specific for-loop for that category. • In this case, the category is cannon tower. • The for-loop needs to know when to stop looping and since this changes, we use the list count as a stopper. • Since the list had at least one element, the for-loop was activated. • However, I never changed the stopper value from 0 to list count.

  21. HandleInput() • I decided to use my static analysis tool, SourceMonitor, for some other improvements. • Came across a very complex function, HandleInput() and wanted to make it less complex. • HandleInput(), like the name implies, takes button or key presses from the user and acts accordingly. • Separated into blocks of code • Ended up successfully lower… • Lines of code from roughly 750 to 665 • Number of method calls from 86-63

  22. Renew Documentation • My partner and I realized how much we had forgotten about the older, critical classes as the year went by. • We worked separately on some. • Some were borrowed templates. • Never needed changed. • Decided we needed to write documentation and figured we’d try some reverse engineering to write up block comments. • Worked on commenting the other’s functions. • Went backwards through the process in order to relearn it and correctly comment. • After all of our methods and classes were commented, we went from 12% comments to 25.2%.

More Related