An Exploratory Study of Code Smells in Web Games

An Exploratory Study of Code Smells in Web Games
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

With the continuous growth of the internet market, games are becoming more and more popular worldwide. However, increased market competition for game demands developers to write more efficient games in terms of performance, security, and maintenance. The continuous evolution of software systems and its increasing complexity may result in bad design decisions. Researchers analyzed the cognitive, behavioral and social effects of games. Also, gameplay and game mechanics have been a research area to enhance game playing, but to the extent of our knowledge, there hardly exists any research work that studies the bad coding practices in game development. Hence, through our study, we try to analyze and identify the presence of bad coding practices called code smells that may cause quality issues in games. To accomplish this, we created a dataset of 361 web games written in JavaScript. On this dataset, we run a JavaScript code smell detection tool JSNose to find the occurrence and distribution of code smell in web games. Further, we did a manual study on 9 web games to find violation of existing game programming patterns. Our results show that existing tools are mostly language-specific and are not enough in the context of games as they were not able to detect the anti-patterns or bad coding practices that are game-specific, motivating the need of game-specific code smell detection tools.


💡 Research Summary

**
The paper presents an exploratory investigation into the presence and relevance of code smells in web‑based games written in JavaScript. Recognizing that the gaming industry is rapidly expanding and that games exhibit unique characteristics—real‑time constraints, intensive rendering, AI, and physics components—the authors argue that traditional, language‑specific code‑smell detection tools may not capture quality issues specific to games.

To address this gap, the authors formulate two research questions: (RQ1) What is the distribution of existing code smells in the context of games? (RQ2) If game‑specific code smells exist, how are they different from the existing ones? They construct a dataset of 361 open‑source web games mined from GitHub. The collection process involved searching for “web games” with the language filter set to JavaScript, then manually filtering out repositories that were actually game engines, IDEs, or non‑English readmes, ensuring a clean set of genuine games. Each game contains on average 5–7 JavaScript files and roughly 1,000–2,000 lines of code.

For automated detection, the authors employ JSNose, a well‑known JavaScript smell detector that identifies 13 smell types: Closure (s1), Coupling JS/HTML/CSS (s2), Empty catch (s3), Excessive global variables (s4), Large object (s5), Lazy object (s6), Long message chain (s7), Long method (s8), Long parameter list (s9), Nested callback (s10), Refused bequest (s11), Switch statement (s12), and Unused/dead code (s13). The tool’s output (Table II) shows a total of 256,687 smell instances across the dataset. The most prevalent smells are Closure (19.8 % of all smells) and Large object (36.3 %). On average, a single game contains about 711 smell instances, yet 34.97 % of games have no detected smells at all. Some smells such as Empty catch and Switch statement are virtually absent, indicating that these patterns are rarely written in the sampled games.

To complement the automated analysis, the authors conduct a manual inspection of nine representative games (Table III). They focus on two families of game‑programming patterns: Decoupling (Component Decoupling P1 and Event‑Queue Decoupling P2) and Optimization (Data Locality P3 and Object Pool P4). Decoupling aims to keep modules independent so that changes in one do not force changes in another; violations can cause data loss, maintainability problems, and poor user experience. Optimization patterns target cache efficiency and memory fragmentation, which are critical for frame‑rate stability. The manual study reveals that most games violate Data Locality (P3) and Component Decoupling (P1); several also breach Object Pool (P4). Notably, many of these violations are not captured by the 13 smells detected by JSNose, demonstrating a mismatch between traditional smell definitions and the quality concerns of games.

The findings answer the research questions: (1) Existing JavaScript smells do appear in web games, but their distribution differs from generic software—Closure and Large object dominate, while some classic smells are rare. (2) Game‑specific smells exist and are characterized by excessive global state, deep nested callbacks, and event‑queue blocking, which are not part of JSNose’s taxonomy. Consequently, the authors argue for the development of game‑specific smell detection tools that can identify performance‑critical anti‑patterns not covered by generic detectors.

The paper acknowledges several limitations: (a) the dataset is limited to open‑source GitHub projects, excluding commercial or mobile games; (b) JSNose’s precision and recall are not independently validated within the study; (c) the manual analysis covers only nine games, limiting the generalizability of pattern‑violation findings. Future work is proposed in three directions: (i) formalizing a taxonomy of game‑specific smells, (ii) building machine‑learning‑based detectors that can operate across platforms such as HTML5, Unity WebGL, and (iii) conducting empirical performance experiments to quantify the impact of removing identified smells on frame rate, memory usage, and load times.

Overall, the study provides the first systematic snapshot of code‑smell prevalence in JavaScript web games and highlights the insufficiency of existing language‑centric tools for the gaming domain, thereby motivating a new line of research focused on game‑aware quality analysis.


Comments & Academic Discussion

Loading comments...

Leave a Comment