Unveiling code clone patterns in open source VR software: an empirical study

Huashan Chen, Zisheng Huang, Yifan Xu, Wenjie Huang, Xuheng Wang, Jinfu Chen, Haotang Li, Kebin Peng, Feng Liu, Sen He

Abstract

Code cloning—the practice of duplicating logic—is a well-documented phenomenon in traditional software engineering that often leads to increased maintenance debt. However, Virtual Reality (VR) development introduces unique complexities through its heavy reliance on serialized asset files (e.g., Unity’s .prefab and .mat). This paper presents the first large-scale empirical study of code clones in VR software, analyzing 345 open-source projects. By employing a hybrid methodology that combines traditional detection tools with Large Language Models (LLMs), we reveal that VR developers frequently shift cloning behavior from source code to asset files, creating maintenance risks that traditional scanners fail to detect. Our findings highlight the efficacy of GPT-4o in identifying these asset clones with high accuracy.

Introduction

In software development, code cloning is a double-edged sword: while it accelerates initial prototyping, it creates a long-term burden where bugs must be fixed across multiple instances. In the context of VR, this problem is exacerbated. VR applications are not merely collections of code; they are integrated systems of logic and "serialized assets" that define 3D hierarchies, physics, and scene properties.

A critical gap exists in current research: traditional clone detection tools are optimized for programming languages like C# or C++, leaving the semi-structured data in VR asset files largely invisible. If a developer clones a complex VR "Prefab" instead of using a proper reference, they inherit technical debt that standard security and maintenance scanners cannot see.

Methodology

To address this gap, we constructed the VR-345 dataset, comprising 233 applications and 112 development tools curated from GitHub. The study utilized a multi-stage analysis pipeline to capture both functional and structural clones.

Overview of the research workflow, including dataset collection, metrics definition, and research question (RQ) analysis.

As illustrated in the workflow above, the methodology involved two distinct tracks:

  1. Source Code Analysis: We used NiCad, a traditional clone detector, to identify functional clones within C# and C++ source files.
  2. Serialized Asset Analysis: Because asset files lack standard programming syntax, we leveraged GPT-4o using a two-step Chain-of-Thought (CoT) prompting strategy. The LLM first evaluated file pairs for structural and functional similarity and then aggregated these results into project-wide "Clone Groups."

Key Insights and Results

The Asset-Code Trade-off

Our analysis revealed a surprising trend: VR projects exhibit lower levels of source code cloning compared to traditional software. However, this is not due to superior discipline; rather, developers are shifting their cloning behavior into the asset layer. Simpler files, such as "Materials," are cloned frequently for rapid optimization, while complex "Scenes" remain unique due to their inherent difficulty to replicate.

The Impact of Third-Party Libraries

A significant portion of redundancy in VR applications stems from third-party SDKs like SteamVR and VRTK. These libraries provide high-level abstractions that developers often copy and modify locally rather than extending through proper inheritance, leading to widespread "cloning debt."

LLM Performance in Clone Detection

A core contribution of this study is the validation of LLMs for non-traditional clone detection. We benchmarked several models to determine their ability to identify clones in semi-structured asset files.

Performance comparison of LLMs in identifying asset clones, showing GPT-4o's superior F1-score and accuracy.

As shown in the table, GPT-4o outperformed both Claude 3.5 and Gemini 1.5 Pro, achieving a 97.7% F1-score. This demonstrates that LLMs can effectively bridge the gap where traditional syntax-based tools fail.

Discussion and Future Work

While our study provides a holistic view of the VR cloning landscape, it is currently focused on the Unity engine and C# ecosystem. The exclusion of Unreal Engine (which uses binary assets) remains a limitation, as current LLM workflows and NiCad struggle with binary formats. Furthermore, while LLMs are highly accurate, their computational cost poses a challenge for scaling to massive commercial repositories.

Future research will focus on developing VR-specific metrics that account for the spatial and interactive nature of these environments, eventually building an integrated framework capable of simultaneous code and asset analysis.

Summary updated

Abstract

Code cloning is frequently observed in software development, often leading to a variety of maintenance and security issues. While substantial research has been conducted on code cloning in traditional software, to the best of my knowledge, there is a lack of studies on cloning in virtual reality (VR) software that consider its unique nature, particularly the presence of numerous serialized files in conjunction with the source code. In this paper, we conduct the first large-scale quantitative empirical analysis of software clones in 345 open-source VR projects, using the NiCad detector for source code clone detection and large language models (LLMs) for identifying serialized file clones. Our study leads to a number of insights into cloning phenomena in VR software, guided by seven carefully formulated research questions. These findings, along with their implications, are anticipated to provide useful guidance for both researchers and software developers within the VR field.
BibTeX
@article{chen2025unveiling,
  author = {Huashan Chen and Zisheng Huang and Yifan Xu and Wenjie Huang and Xuheng Wang and Jinfu Chen and Haotang Li and Kebin Peng and Feng Liu and Sen He},
  title = {{Unveiling code clone patterns in open source VR software: an empirical study}},
  journal = {Autom. Softw. Eng.},
  year = {2025},
  doi = {10.1007/s10515-025-00536-2},
}
Figure