Andheri Simulator Code Review

Jul 22, 2024

Andheri Simulator Code Review Summary

Introduction

  • Objective: Code review of Yandere Simulator.
  • Concerns: Previously misunderstood points about no bullying.
  • Background: Took 2 months, starting from May 15th build with subsequent builds on Jun 1, 15, and Jul 2.
  • Method: Correspondence with Yandere Dev for fixes.

Key Issues Identified in Yandere Simulator

Performance and Optimization

  • Initial Benchmarks: Used Wine via Lutra installer with missing text issues. Game didn’t hit 60fps despite high PC specs.
  • Heavy Scene Load: Initial load into school scene is heavy, neither CPU nor GPU maxed out.
  • Comparative Analysis: Ran Doom 2016 and Hitman 2 for comparison.
  • Need for Profiling: Used Unity’s profiler, difficulties in getting source code from Yandere Dev.

Source Code Analysis

  • Rendering Issues: Time spent rendering opaque geometry. High geometry on student models causing performance issue.
  • Mesh Optimization: Need for better optimization, unnecessary vertices in models, use of combined meshes.
  • LOD (Level of Detail): Partially implemented; a need for full implementation for performance improvements.
  • Occlusion Culling: Proper occlusion culling implemented using Unity’s built-in feature.

Specific System Issues

  • Heart Rate Monitor: Inefficient separate camera usage for heart rate line rendering.
  • Physics: Many colliders and triggers without apparent use; improper assignment on layers.
  • Animation: Time spent on animation calculations, “Stop Animation” script disables distant animations, but some remain active.
  • Script Efficiency: Most time spent on rendering than script execution.

Script and UI Issues

  • Common Theories Debunked: Else-if chains vs switch case show negligible performance impact. Same applies to vector3 distance myths.
  • Prompt Scripts: Numerous UI prompt instantiations for each interactable causing inefficiency.

Game Object and Component Counts

  • Counts: 49,300 game objects and 53,015 components in one scene; about 200 scripts run every frame leading to microsecond accumulation.
  • Script Execution Time: Focus on disabling unnecessary scripts.
  • Late Update: Dynamic bone updates and UI panel issues identified.

Suggested Architectural Improvements

  • Current Structure: Key game components, such as YandereScript, StudentScript, and StudentManagerScript, discussed.
  • Separation of Logic: Proposed separating generic and student-specific behaviors.
  • New Architecture: Separate routine definitions, state storage, and simplified state updates.
  • Optimization Recommendations: Focus on Unity job system, proper occlusion culling, efficient use of LOD, and caching methods.

Other Implementation Details

  • Save System Critique: JSON format bloated, recommends a custom byte format. Player prefs misuse for save data.
  • Interaction Prompts: Redesign suggested for interactable handling, including distance checks and dynamic prompts.
  • School Map: Current camera setup identified as inefficient, suggests using a static image.
  • Miscellaneous: Empty classes workaround, use of 2020 Unity version for serialization issues.

Cosmetic and Style Issues

  • Code Style: String interpolation vs concatenation, elimination of redundant instance variables, better use of arrays and fields.
  • Public Booleans: Too many, recommendation to use enums and bitwise operations for state representation.
  • Animation System: Suggests using event triggers in animation clips.
  • Extreme Technical Debt: Yandere Simulator’s technical debt has severely impacted development.

Conclusions

  • Performance Tips: Focus on disabling unnecessary scripts, efficient use of Unity features, thorough profiling, and code organization.
  • Architectural Overhaul: Game needs a significant refactor not done since 2016.
  • Future Work: Good luck to Yandere Dev, need for managed technical debt, improvements in code maintenance and readability.

Additional Insights

  • Unit Testing: Rare in game development but beneficial for catching bugs early.
  • Frame Rate Calculation: Existing method inaccurate, suggests using current, average, min, and max frame rates display.