Unit LAB. VIRTUAL REALITY AND AUGMENTED REALITY II

Course
Programming and management of computer systems
Study-unit Code
A003667
Curriculum
In all curricula
Teacher
Gilberto Zinourov Roncalli Di Montorio
Teachers
  • Gilberto Zinourov Roncalli Di Montorio
Hours
  • 36 ore - Gilberto Zinourov Roncalli Di Montorio
CFU
3
Course Regulation
Coorte 2023
Offered
2024/25
Learning activities
Altro
Area
Tirocini formativi e di orientamento
Sector
NN
Type of study-unit
Obbligatorio (Required)
Type of learning activities
Attività formativa monodisciplinare
Language of instruction
Italian
Contents
Presentation of an introductory and practical course on the Unity engine, aimed not only at illustrating the core features of the platform but also at teaching a structured development methodology applicable in a professional context. Advanced programming concepts such as the Service Locator, Broadcaster Pattern, and the implementation of State Machines were covered, providing students with practical tools to manage communication and coordination between components within Unity scenes.
Reference texts
Pubblic Unity Documentation: https://docs.unity3d.com/6000.1/Documentation/Manual/UnityManual.html
Educational objectives
To provide students with a development methodology applicable in professional contexts, using Unity as the reference platform. The course placed particular focus on organizing work in parallel environments, typical of complex projects, addressing issues related to scalability and code maintainability.
Prerequisites
Basic knowledge of object-oriented programming (preferably in C#) and familiarity with fundamental software development concepts. Prior experience with Unity is not required but recommended for a better understanding of the advanced topics covered in the course.
Teaching methods
In-person lectures, including practical examples and live demonstrations within the Unity development environment.
Other information
The course had a strong practical focus, promoting learning through direct experience in Unity project development. Each session combined theoretical insights with live demonstrations and guided implementations, allowing students to immediately apply the concepts presented. Special attention was given to writing reusable, modular, and maintainable code, with the goal of providing a solid foundation for working on real-world projects, even in collaborative and professional environments.
Learning verification modality
Evaluation is based on the student’s presentation of a project developed using the architecture introduced during the course. The project must include at least a couple of medium-complexity features, implemented and fully functional within the Unity environment. Assessment criteria include correctness of implementation, code quality, and the ability to apply design patterns and work organization concepts covered in the lessons.
Extended program
Lesson 1: Introduction – Course structure and scripting basics • Objective: Familiarize students with the Unity developer workflow, starting from C# basics. Course introduction and final project • Linking the work to the course: the importance of developing scalable and modular systems. • Overview of topics covered: scripting, interactions, data management, optimization. • Presentation of the final project: a small game with robust programming systems. Review of C# basics • Program structure: classes, methods, properties. • Variables, data types, and scope. • Introduction to events and delegates. Unity scripting basics • Differences between Update, FixedUpdate, and LateUpdate. • Interaction between scripts and Unity components (GetComponent, AddComponent). • Practical exercise: Create a script to move an object using the keyboard. Lesson 2: Programming player control • Objective: Create a fully scripted player controller. Character movement • Script for 2D or 3D movement (depending on chosen project). • Using Rigidbody for physics-based movement. • Dynamic input: keyboard, mouse, and controller. Dynamic camera • Script to follow the player with the camera. • Managing smooth transitions between different views. Practical exercise • Create a complete controller with movement and camera. Lesson 3: Object interactions and event management • Objective: Create systems for object interaction through programmed events. Triggers and collisions • Handling OnTriggerEnter and OnCollisionEnter events. • Creating interactive objects: doors, moving platforms, collectible items. Introduction to custom events • Creating an event system: Publisher/Subscriber pattern. • Connecting multiple scripts through events for modularity. Practical exercise • Program a dynamic interaction system (e.g., collect items and trigger events). Lesson 4: Data management and game logic • Objective: Implement gameplay logic and data structures to manage the game. Scriptable Objects • Creating data objects for dynamic configuration of game elements. • Practical use to create enemies, items, or customizable levels. Runtime data management • Creating a singleton for global data (e.g., score, lives, inventory). • Serialization and saving/loading data. Practical exercise • Create a scoring system and save data to disk. Lesson 5: Programming artificial intelligence (AI) • Objective: Create a simple AI system for NPCs or enemies. Introduction to NavMesh and pathfinding • Generating a NavMesh and scripting NPC movement. • Basic behaviors: following the player, patrolling. States and behavior (FSM) • Implementing a Finite State Machine for enemies. • Changing behavior based on triggers or conditions. Practical exercise • Create an NPC that patrols and chases the player when within range. Lesson 6: Dynamic UI and interface management • Objective: Integrate UI with game logic and create responsive interfaces. UI programming • Managing Canvas, Text, and Sliders. • Dynamic updates of UI elements (e.g., health bar, timer). Menu systems and transitions • Creating a main menu. • Scene transitions and global data management. Practical exercise • Create an interface showing health, score, and notifications. Lesson 7: Project management and modularity • Objective: Organize a complex project in a scalable way. Dependency management • Introduction to modular programming principles. • Separating logic into dedicated scripts (Single Responsibility Principle). Events and advanced patterns • Observer pattern for notifications between scripts. • Dependency Injection to reduce tight coupling. Practical exercise • Reorganize project scripts for modularity and readability. Lesson 8: Optimization and debugging • Objective: Improve performance and resolve common bugs. Script optimization • Reducing CPU and GPU load: FixedUpdate vs Update. • Object pooling to manage dynamic instantiation. Debugging in Unity • Using the console and breakpoints. • Profiling to identify bottlenecks. Practical exercise • Optimize a complex scene and debug a script. Lesson 9: Final project and submissions • Objective: Refine the project and present the final work. Project finalization • Debugging and final polishing. • Creating a build executable. Presentation and feedback • Each student presents their project, explaining the code and implementation choices. Course conclusion • Final feedback and suggestions for continued development.
Obiettivi Agenda 2030 per lo sviluppo sostenibile