Unveiling Code Clone Patterns in Open Source VR Software: An Empirical Study

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

TL;DR

This paper presents the first large-scale empirical study of code cloning in Virtual Reality (VR) software, analyzing 345 open-source projects. By combining traditional token-based detection for source code with a novel LLM-based approach for serialized asset files (like Unity prefabs and materials), the authors reveal that VR software exhibits unique cloning patterns—most notably, a lower rate of source code cloning compared to traditional software due to a heavy reliance on serialized assets.

What Problem Does This Paper Address?

Code cloning—the practice of duplicating code snippets—is a double-edged sword. While it can speed up development, it often leads to "technical debt," making software harder to maintain and more vulnerable to security flaws.

While cloning in traditional software is well-studied, VR software is a different beast. VR applications are not just collections of scripts; they are tightly integrated systems of source code and serialized asset files (e.g., .prefab, .mat, .unity). These files define the 3D hierarchy, materials, and scene configurations. Traditional clone detection tools are designed for programming languages and fail to capture the semantic similarities in these semi-structured, heterogeneous asset files. This paper fills that gap by investigating how cloning manifests across both code and assets in the VR ecosystem.

Methods

The researchers employed a dual-track methodology to capture the full picture of VR cloning:

  1. Source Code Detection: They used NiCad, a state-of-the-art token-based detector, to identify identical, lexical, and syntactic clones in languages like C# and C.
  2. Serialized File Detection: Recognizing that traditional tools struggle with asset files, the authors proposed using GPT-4o. They employed a two-step Chain-of-Thought (CoT) prompting technique. First, the LLM evaluates file pairs for similarity; second, it aggregates these findings to calculate project-wide metrics.
Fig. 1: Overview of Our Empirical Study.

To validate the LLM approach, they compared GPT-4o against Claude 3.5 and Gemini 1.5 Pro, finding that GPT-4o achieved the highest accuracy (98%) in identifying asset clones.

Datasets

The authors constructed the VR-345 dataset, which consists of 345 unique open-source VR projects harvested from GitHub.

  • Composition: 233 applications and 112 development tools.
  • Filtering: Projects were filtered by language (supporting NiCad) and manually inspected to ensure they were genuine VR applications.
  • Diversity: The dataset covers various domains, including gaming, education, healthcare, and simulators.

Key Insights and Ideas

  • The "Asset-Heavy" Effect: Unlike traditional software, most VR projects show significantly lower source code cloning (averaging ~5%). This is because much of the "logic" and "structure" is moved into serialized asset files.
  • Complexity vs. Cloning: Asset cloning behavior is inversely proportional to complexity. Simple assets like materials are cloned frequently for optimization, while complex scenes are rarely cloned because they contain unique, project-specific structures.
  • The Library Tax: Third-party libraries (like VRTK, SteamVR, and Oculus SDK) are major contributors to clones. In some projects, library-induced clones constitute the majority of the total cloning results.
  • Language Matters: While C# is the dominant language for VR (thanks to Unity), C-based projects actually exhibit a higher proportion of code cloning, likely because C lacks the high-level abstraction and reuse mechanisms found in object-oriented C#.
  • Version Evolution: Inter-version cloning (between different versions of the same project) is more common than intra-version cloning. This suggests a high risk of "vulnerability propagation," where a bug in one version is silently carried over into the next.

Key Results

  • LLM Superiority: GPT-4o proved highly effective for asset clone detection, reaching 98% precision and recall when using a similarity-based prompt.
  • Domain Impact: Gaming and education software are the most clone-prone domains. In the study, 12 out of 20 top clone-heavy applications were games.
  • Metric Correlation: The study found a near-linear relationship between the number of asset files and the number of file clones, suggesting that as VR projects scale, the management of asset redundancy becomes exponentially more difficult.

Limitations and Future Work

The authors acknowledge several constraints:

  • Unity Bias: The dataset is primarily C#-based, reflecting the dominance of Unity. Consequently, Unreal Engine projects (which use C++ and proprietary binary formats) were excluded.
  • Scalability: While LLMs are accurate, using them for massive, industrial-scale repositories may be cost-prohibitive or slow compared to traditional algorithms.
  • Metric Sophistication: The metrics used (NCF, NCA, etc.) are adapted from traditional software engineering. The authors call for the development of "VR-native" metrics that better account for the spatial and interactive nature of VR assets.

Future research directions include developing an integrated framework that analyzes code and assets simultaneously rather than in isolation, potentially using specialized LLM agents for cross-artifact pattern recognition.

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 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 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},
}

Loading related content...

Figure