interconnection of unity game engine and newgrounds

71
Masaryk University Faculty of Informatics Interconnection of Unity Game Engine and Newgrounds Online Service Master’s Thesis Tomáš Ježek Brno, Fall 2021

Upload: khangminh22

Post on 22-Apr-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Masaryk UniversityFaculty of Informatics

Interconnection of Unity GameEngine and Newgrounds

Online Service

Master’s Thesis

Tomáš Ježek

Brno, Fall 2021

Masaryk UniversityFaculty of Informatics

Interconnection of Unity GameEngine and Newgrounds

Online Service

Master’s Thesis

Tomáš Ježek

Brno, Fall 2021

MUNIFI

MASARYKOVA UNIVERZITAFaculty of Informatics

Botanická 68a, 602 00 BrnoIČ: 00216224

DIČ: CZ00216224

Master'sthesis description

Student: Bc. Tomáš Ježek

Programme: Visual informatics

Specialization: Digital Game Development

Field guarantor:

Thesis supervisor: Mgr. Jiří Chmelík, Ph.D.

Department: Department of Visual Computing

Title of the thesis/dissertation: Interconnection of Unity Game Engine and Newgrounds Online Service

Title of the thesis in English: Interconnection of Unity Game Engine and Newgrounds Online Service

Description: Prostudujte a popište současné možnost publikování digitálních her. Soustřeďtese na volně dostupné platformy určené především začínajícím vývojářům.Navrhněte a implementujte rozšíření editoru herního engine Unity, které umožnípropojení online služby Newgrounds a prostředí Unity. Rozšíření bude využívatexistující API služby Newgrounds a umožní snazší integraci služby Newgroundsdo nově vznikajících her. Rozšíření umožní především:

• zajištění síťové komunikace, včetně autentizace uživatele,• zpřístupnění dat uživatele služby Newgrounds v prostředí Unity,• vytváření herních trofejí v prostředí Unity,• aktualizace údajů na službě Newgrounds (skóre, trofeje).

The description was approved through IS MU.

Declaration

Hereby I declare that this paper is my original authorial work, whichI have worked out on my own. All sources, references, and literatureused or excerpted during elaboration of this work are properly citedand listed in complete reference to the due source.

Tomáš Ježek

Advisor:Mgr. Jiří Chmelík Ph.D.

iii

Acknowledgement

I would like to thank my advisor Mgr. Jiří Chmelík, Ph.D. for hissupport and valuable advice during the making of this thesis. Mythanks go to Josh Tuttle, the developer of the original library; and Iam also grateful to the early adopters and testers of my work for theirpatience and priceless constructive feedback.

v

Abstract

With each passing year, game development is becoming easier andmore accessible to all groups of people, both experience and age-wise.It is no longer a requirement to have an extensive computer sciencebackground and now in two weeks time, even a determined childcan learn to bring a simplistic game to life. And as the amount ofcontent grows, so does the desire to share it, yet not every small gameor experimental project warrants a proper commercial publication. Asa result, there is a demand for a simple and fast way to share one’screative endeavours with the world (as a part of the learning process,to build a loyal fanbase or simply interact with the community).

One option to do so is via the web portal Newgrounds.com, acommunity-driven website for user-created submissions with an in-teresting history as the pioneer and trendsetter of the Internet in thenew millennium.

This work takes a brief look at this website and its place on theInternet, with an emphasis on gamers and game developers. Thesecond half deals primarily with one of the most commonly usedgame engines (on Newgrounds and in general), the Unity engine,and both of these topics culminate in adapting Newgrounds.io, theNewgrounds’ own game API, for easier usage by Unity developersof all experience levels, heavily utilising the engine’s editor extensioncapabilities.

vi

Keywords

Unity, game development, editor, extension, web

vii

Contents

1 Introduction 1

2 Newgrounds 32.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Early Days . . . . . . . . . . . . . . . . . . . . . . 32.1.2 The Portal . . . . . . . . . . . . . . . . . . . . . . 32.1.3 End of an Era . . . . . . . . . . . . . . . . . . . . 4

2.2 Appeal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.3 Newgrounds.io Library . . . . . . . . . . . . . . . . . . . 6

3 Unity 93.1 On the Web . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1.1 In Comparison . . . . . . . . . . . . . . . . . . . 103.2 Editor Extensions . . . . . . . . . . . . . . . . . . . . . . 11

3.2.1 Summary . . . . . . . . . . . . . . . . . . . . . . 123.2.2 Editor GUI . . . . . . . . . . . . . . . . . . . . . . 123.2.3 Inspector . . . . . . . . . . . . . . . . . . . . . . . 143.2.4 Windows . . . . . . . . . . . . . . . . . . . . . . . 203.2.5 Settings . . . . . . . . . . . . . . . . . . . . . . . 22

4 Newgrounds.io Extension 254.1 Understanding Issues . . . . . . . . . . . . . . . . . . . . 254.2 Historical Note . . . . . . . . . . . . . . . . . . . . . . . . 314.3 Discontinued Features . . . . . . . . . . . . . . . . . . . 334.4 Documentation . . . . . . . . . . . . . . . . . . . . . . . 34

5 Future Development 37

6 Conclusion 39

ix

Index 51

A An appendix 53A.1 Project Folder . . . . . . . . . . . . . . . . . . . . . . . . 53

A.1.1 Samples . . . . . . . . . . . . . . . . . . . . . . . 53A.1.2 Package . . . . . . . . . . . . . . . . . . . . . . . 53A.1.3 Documentation . . . . . . . . . . . . . . . . . . . 53

A.2 Git Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . 53

x

List of Figures

3.1 Custom CoreComponent Inspector 153.2 A custom setup wizard 203.3 Custom section in the Project Settings 244.1 Application credentials in the Project System on

Newgrounds 264.2 Medals in the Project System on Newgrounds 264.3 The core MonoBehaviour of the official library 274.4 Customizing the Add Component menu 284.5 A medal ScriptableObject data asset with a medal popup

preview. 294.6 Welcome window of the Newgrounds.io package 314.7 Unity Version of 50 Authors on Newgrounds (Q4

2021) 324.8 An example of a custom WebGL Template 334.9 DocFX documentation of the project 354.10 Package samples importable via the Package Manager 35

xi

List of Code Examples

1 An editor button defined with the GUI class. . . . . . . . 132 An editor button defined with the GUILayout class. . . . 133 Two horizontally aligned editor buttons. . . . . . . . . . 134 Two horizontally aligned editor buttons in a managed

scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Custom editor using the simple Editor.target approach 166 Custom editor using the robust SerializedProperty

approach . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Avoiding string references while following the encap-

sulation principle with SerializedProperty . . . . . . 188 Custom editor using the experimental UI Toolkit . . . . 199 A basic editor window with a button . . . . . . . . . . . 2110 Example of EditorPrefs usage . . . . . . . . . . . . . . 2211 Unlocking medals with the official library . . . . . . . . 28

xiii

1 Introduction

The end of the year 2020 was a notable milestone for the history ofthe Internet. After two decades of its overabundance across the Web,the era of Adobe Flash came to a close. This led its users to search forviable replacements in regards to interactive Web content, as well asensuring that all historic content is preserved.

Newgrounds [31] is one particular example of a website with adeeply vested interest in both of these goals. At the brink of the newcentury, it played a major role in popularising Flash games and anima-tion, as well as pioneering various Internet trends and user-submittedcontent in general [1, 2], which no doubt contributed to TIME listing itamong the fifty most influential websites in 2010 [3]. While the ongo-ing efforts to preserve twenty years of video-gaming history have metwith some degree of success, the website is simultaneously focusedon carving its path towards the future of interactive Web content withHTML5.

The later chapters will take a closer look at options viable for creat-ing interactive Web content, specifically the Unity game engine, whichseems to be the most popular choice for these kinds of projects, bothon Newgrounds and its contenders, like itch.io [32].

Most of all, this work revolves around Newgrounds.io, a platform-agnostic Newgrounds API [33]. At its core, the API allows developersto tap into Newgrounds features like medals1 and scoreboards, tosupport player’s engagement with the game and the community.

However, its use isn’t as intuitive or easy as one would hope for(especially as the majority of aspiring game developers on the sitedon’t have computer science background), and its Unity C# variantbarely uses any of the features Unity offers out of the box; most ofall editor scripting2. The practical output of this thesis is to analysewhich of those features might make the use of Newgrounds.io easieror more robust, incorporate them on top of the original library and

1. In-game achievements unlockable by playing the game and completing certainpre-defined goals.2. Features which do not affect the resulting product, but help extend and cus-tomise the editor to streamline development.

1

1. Introductiontest them in practice with Newgrounds-based Unity developers inhopes of making Newgrounds.io more widely used and accessiblethan the original version.

2

2 Newgrounds

2.1 History

2.1.1 Early Days

As a website, Newgrounds1 was founded in the year 1995 (and settledon the final domain name in 1998). Its creator, Tom Fulp, developedseveral simple games which brought fans to the site, and simultane-ously prompted media backlash for their depiction of comedic vio-lence [1].

The year 1998 saw the introduction of Pico’s School [34], a pointand click shooter Flash game which was revolutionary in its day dueto its complexity and level of polish during a time of Flash 3 whichdidn’t offer much in terms of programming support (the scriptinglanguage ActionScript didn’t exist at this point yet), so the game hadbeen created with various workarounds and an intricate web of movieclips to simulate variables. The game is considered pivotal in startingthe Flash game scene [35].

2.1.2 The Portal

A paramount milestone in internet history came in August 2000 withthe adoption of the Portal, the very first automated real-time contentsubmission system. The community could upload games and anima-tions they created, vote on them and review them, as well as take partin the advertisement monetization program [4]. Moreover, Flash waseasy to learn and fast to bring results, so anyone could join in andparticipate.

All of this contributed to the fact that Newgrounds quickly accu-mulated one of the most active user communities on the internet [1].

The following years saw a steady rise, the introduction of Audioand later Art portals based on a scouting system rather than voting(see in 2.2) and assembling a video game company The Behemoth (withtheir popular debut game Alien Hominid [36]). In the year 2009, the

1. The name New Ground is a play on words and alludes to Neo Geo, the arcadevideo game system, as Newgrounds was initially conceived as its fan magazine. [1]

3

2. Newgroundsfirst game with medals (in-game achievements) was published on thesite.

“Back then, Flash was really cutting edge because the Internet wasvery much text and pictures without a lot of sound and interactiveelements. Flash really drove the web forward.” [5]

2.1.3 End of an Era

As it became increasingly more apparent that Flash isn’t the path tothe future [2, 6], the site began adding new features to avoid beingentirely dependent on the technology (such as a custom video playerand support for HTML5 games in 2012, then Swivel2 in 2013). Dueto the increased adoption of advertisement blockers by visitors andbeing blocked by Google AdSense due to controversial content [1],and the migration of popular animators to YouTube [7], Newgroundsalso saw a drop in revenue, and subsequently launched the supporterupgrade [38] which only became more prevalent going forward.

In the year 2016, the platform-agnostic library Newgrounds.io [33],whose extension is the focus of this thesis, was released and replacedthe Newgrounds Flash API.

Throughout 2018, Newgrounds experienced an influx of userscoming from Tumblr (due to the ban of adult content [8]) and somefromYouTube (due to the change ofmonetizationmodel based on timewatched rather than total views [4] which is unfriendly to animations,as they tend to be short).

With the final year of Flash coming to a close, to prevent the loss oftwenty years of video gaming history, Newgrounds Player for Windowsdesktop users and Ruffle, a secure Flash Player emulator [39] weredeveloped to preserve past content [5].

As of the time writing, Newgrounds still operates at an annualloss that is manageable, but the site needs more supporters to besustainable in the long run [1, 9, 10].

2. An open-source software for converting Adobe Flashmovies into high definitionvideos [37].

4

2. Newgrounds

2.2 Appeal

Ever since 2006,Newgrounds bears themotto "Everything, by Everyone"which can also be used to summarize its appeal.

The website always stood firmly on the side of artistic freedomand a close-knit community. Creators that help, support and inspireeach other, where anyone can join – as noted by the website ownerTom Fulp:

“The world is full of gatekeepers and the web was the first placewhere anyone could share anything with everyone.” [4]

This chapter aims to identify reasons why content creators (andspecifically game developers) of all skill levels might find it beneficialto upload their works to Newgrounds, and what sets the website apartfrom its competitors.

First, we may examine the website in terms of accessibility for newcreators.

All games and movies must initially pass the judgement process,i.e. get a high enough score after a certain number of votes by otherusers – otherwise, the submission is deleted [11]. Crucially, all works(both from the brand new, and the veteran creators) appear in thesame section of the website sorted by their timestamp, so each of themhas an equal chance of being seen by others. During this time, the scoreis hidden, as well as other reviews3 which ideally ought to encouragefair voting. Even if the creator’s work doesn’t pass the judgementphase, they still receive some potentially valuable feedback.

The Audio and Art portals operate on a different principle, andthe judgement phase here is replaced by the scouting system [12].The system simulates mentoring – unknown artists are by defaultless visible in the portal, but if their work is of sufficient quality, anapproved artist may vouch for them so they become approved as well(abusing the systemmeans the loss of their own privileges). The effectof scouting is creating a network of experienced artists who are alwayson the lookout for new promising artists they could invite.

This, during a time where discoverability for independent gamedevelopers is a serious issue [13, 14], ensures at least 50-90 people are

3. The text input area under submissions is deliberately called a review rather thana comment to encourage giving feedback to the author.

5

2. Newgroundsguaranteed to see and vote on the game before the judgement phase isallowed to end, even if it doesn’t end up being popular. The downsideis receiving no immediate monetary reward, due to the trouble withmonetization on the WebGL platform in general4, but the benefit isgathering feedback and potentially, also loyal audience.

The second factor is the focus on community. One example couldbe the built-in tool Collabinator which allows developers to searchfor collaborators for their projects, as well as offer their services forpayment to others. Newgrounds also frequently hosts game or ani-mation jams, occasional themed holidays [40] (for example Pixel Day,Robot Day, Clock Day5 and more); almost always with monetary prizes(which also applies to prizes to monthly best entries).

Growing one’s loyal audience shouldn’t be underestimated, asmany animators and game developers who had their start on New-grounds have since gone on and launched successful careers in thebusiness [4, 41] – a recent and notable example is a rhythmgame FridayNight Funkin’ whose creators went on and launched a crowd-fundingcampaign which raised over $2 million of $60,000 goal [17].

2.3 Newgrounds.io Library

Newgrounds.io library was published in the year 2016 as a platform-agnostic successor to the Newgrounds.io Flash API. Its main purposeis to provide a way for developers to add in-game achievements6and competitive scoreboards to their games [33], which is shownto prolong play time – meaning that certain players would continueplaying beyond the point when they would normally quit, merelyto unlock achievements [18] – or increase replayability due to thecompetitive value of scoreboards.

The library works by sending JSON-encoded objects with POSTrequests to theNewgrounds gateway7 [42]. The input object is expectedto consist of:

4. For example Unity Ads doesn’t offer support for the WebGL platform because ofthe small size of the market, and rather focuses on mobile [15].5. A day celebrating uniquely bad submissions and low-quality content [16].6. On Newgrounds, achievements are referred to as medals.7. Available at: https://www.newgrounds.io/gateway_v3.php/

6

2. Newgrounds• app_id: the application identifier found in the project’s dash-

board on Newgrounds

• call: the call object we’re sending (secure call requires the en-cryption key also found in the project’s dashboard)

– component: the component we intend to call– parameters: parameters to call the component with– echo: a value to return in the server response

• session_id: an identifier associated with the logged-in user

• debug: set to true to receive more data in responses

• echo: a value to return in the server response

Knowing how the library operates behind the scenes is useful fordebugging or when a particular game engine doesn’t have a dedi-cated library available, however, the site provides an official libraryfor JavaScript/HTML5 [43], and crucially, for Unity [44].

The status of the Unity library is the reason for the proposed ex-tension’s existence. While the library is functional, it provides littlemore than the core JavaScript library and experience shows setting thelibrary up and utilizing it properly is often too difficult or too mucheffort for Unity game creators who are often inexperienced (see in2.2).

Moreover, as the Unity library is not updated on a regular basis,it often fails to keep up with Unity Engine’s new releases and someof the functionality it uses may become obsolete8, or at least a betterapproach might become available (like custom git packages, see 4.2).

Therefore, the main goal of the thesis is to extend the official Unitylibrary by using the engine’s capabilities to make the process of usingthe Newgrounds.io API as simple and automated as possible. Thedesired result is enabling a broader group of game developers toinclude these functions in their projects.

8. Such was the case of Application.ExternalEval [52] that was replaced byjslib plugins [53].

7

3 Unity

3.1 On the Web

Unity [45] is one of the most widely-used game engines (with a re-ported 45%market share as of 2020 [19]), evenmore so in the indepen-dent game development community [32]. Unity development utilizesC# language which communicates with its C++ backend. Moreover, itis possible to include custom plugins, which is especially notable inthe case of jslib plugins used for web games [53]; one such exampleconstitutes the core of the library this thesis focuses on.

On the web, the gaming scene is not as conclusive as the previouslymentioned examples, and the many different engines and frameworkseach fulfil different needs.

It may be argued that Unity on the web owes its popularity toseveral factors – familiarity (experienced Unity users will find it fairlyeasy to create or adapt their games for the web), flexibility (almost allkinds of games may be created with Unity) and a vast, establishedcommunity that makes it easier to find solutions to common problems.Common criticism includes a steep learning curve (beginners mightquickly become overwhelmed), build size or a lack of reliable mobilesupport [54].

These criticisms may be partially alleviated in the future withthe addition of the Project Tiny package [55] to Unity’s roster. Thepackage aims to provide developers with a way to write lightweightand performant applications (such as small web or mobile games,or playable apps), utilising DOTS1 Runtime and consisting only ofnecessary core modules instead of usual Unity content while stillretaining Unity’s regular GameObject workflow.

Although even then the developers will likely run into limitationsof the Web itself which will restrict them from using certain advanced

1. Data-Oriented Technology Stack [56]: Unity’s high-performance multithreadedsolution.

9

3. Unity

Unity features (HDRP2, VFX Graph3 or Burst compilation) due to thelack of support for geometry or compute shaders and multi-threading.

Therefore, Unity is not a catch-all solution for web games (norwill web games made with Unity perfectly resemble games made fornative platforms), and there are other game engines available withtheir own benefits and flaws.

3.1.1 In Comparison

Here follows a brief list of some of the more well-known game engineswith dedicated web export.

Unreal EngineWhile UE4 is a strong contender of Unity in terms of desktop games,its HTML5 export build size is commonly approaching small hundredsof megabytes [20, Figure 6.5], which makes it unfeasible on the webwhere the attention span of players is shorter and long loading timesmore often than not result in them leaving.

Moreover, as of version 4.24, the official support for the plat-form has been discontinued and is further maintained by the commu-nity [57].

GodotGodot [46] can be considered slightly more intuitive than Unity and iscertainly leaner, although the two engines still share a lot of similaritiesin the UI and its general workflow. Supports both C# and its ownGDScript as the scripting language and between it and Unity, Godotmay be the more approachable option for simpler games.

Construct 3The main appeal of Contruct [47] is its ease-of-use visual scripting,allowing users to create and test a game fairly quickly without pro-

2. High-Definition Render Pipeline, a high-fidelity pipeline designed to bringadvanced, quality graphics to modern platforms.3. Visual Effect Graph, a node-based visual effects editor.

10

3. Unity

gramming knowledge (although experienced users might supplementthe nodes with their own JavaScript extensions).

The drawback is mainly the transition to a paid subscription-basedmodel from the pay-once model of the engine’s previous iteration.

ScratchScratch [48] is mainly an educational tool, aimed primarily at children,teaching them programming concepts through visual scripting. It canlead to very fast results, although generally can be fairly limiting interms of features supported out of the box.

Other engines commonly used on Newgrounds include Haxe-Flixel4, GDevelop5, Wick Editor6, RPGMaker7 and several others [49].

3.2 Editor Extensions

Editor extensions present a way for developers to expand or customisecapabilities of their chosen game engine in order to improve andstreamline their workflow. Typically, extensions aim to either make theeditor more user-friendly, automate repetitive tasks, unify processesacross an entire team, minimise possible mistakes and so on.

They can be broadly divided into the following unofficial categories– a visual representation of data (i.e. custom windows and inspectorsdisplaying variables and tools to the users of the engine), custom tools(encompassing custom transform gizmos, new Scene or Project win-dow interactions) or automation (playmode8 or build preprocessorsand postprocessors, custom texture or animation importers).

Each of these groups is represented by an implemented New-grounds.io for Unity feature in the following sections.

4. A 2D game engine which utilizes the cross-platform language Haxe.5. A simple, web-based visual scripting engine.6. A web tool that is heavily inspired by Adobe Flash but is entirely HTML5-based.7. An engine that specialises in creating Eastern-style role-playing games.8. The state during which the game is being played in the Editor.

11

3. Unity

3.2.1 Summary

Generally, scripts aiming to extend the editor are to be placed withinfolders called Editor [21, page 5] (which is a special, reserved foldername). This ensures said extension scripts are compiled only for theEditor platform in a separate assembly9 and do not become a part ofthe game build, where they would cause errors.

In the case of asmdef10 files being used, the role of the Editor specialfolder gets replaced by setting the file’s platform to Editor only.

Either approach causes all Editor-only scripts and assets to beexcluded from the build which cannot have any dependencies on theEditor-only namespace UnityEditor.

3.2.2 Editor GUI

Before focusing on the specific, it is important to introduce the ba-sics shared between all custom editor classes. The logic for customiz-ing their graphical user interfaces generally belongs inside the OnGUImethod (or OnInspectorGUI, OnPreviewGUI etc. in derived classes).

The available GUI methods are divided into several groups basedon how they operate [22].

The GUI class contains methods that may be used for creating asimplistic runtime user interface, whereas EditorGUI class is intendedonly for custom editor scripts. There is, however, some overlap, andsome GUI methods have no specific editor-only equivalent and areused in both (e.g. GUI.Button). Both of these groups require definingexact coordinates, widths and heights [59] and therefore require lotsof calculations and precise positioning.

GUILayout and EditorGUILayout calculate these values by them-selves, creating an automatic layout.

In order to support various common alignments inside the auto-matic layout (e.g. two buttons side-by-side), it’s possible to use helper

9. Editor scripts generally fall under the Assembly-CSharp-Editor assembly incontrast with Assembly-CSharp which is the standard assembly containing runtimescripts.10. Assembly Definition Files [58], intended to split one’s codebase into severalassemblies which are recompiled when needed (speeding up compilation timesand ideally enforcing a modular project structure).

12

3. Unity

public override void OnInspectorGUI(){

DrawDefaultInspector();if (GUI.Button(new Rect(15, 15, 50, 50), "Click"))

Debug.Log("You clicked the button.");}

Listing 1: An editor button defined with the GUI class.

public override void OnInspectorGUI(){

DrawDefaultInspector();if (GUILayout.Button("Click"))

Debug.Log("You clicked the button.");}

Listing 2: An editor button defined with the GUILayout class.

methods like GUILayout.FlexibleSpace() (which fills any leftoverspace between elements) or horizontal or vertical alignment methods.These methods usually come with a begin and end variant, or as adisposable [60] scope. To prevent mismatches and increase reliability,it is recommended to use scopes wherever possible.

void OnGUI(){

GUILayout.BeginHorizontal();

GUILayout.Button("Left");GUILayout.Button("Right");

GUILayout.EndHorizontal();}

Listing 3: Two horizontally aligned editor buttons.

13

3. Unity

void OnGUI(){

using (new GUILayout.HorizontalScope()){

GUILayout.Button("Left");GUILayout.Button("Right");

}}

Listing 4: Two horizontally aligned editor buttons in a managed scope.

3.2.3 Inspector

Inspector [61] inUnity is a type ofwindowwhich displays informationabout an asset or about a GameObject selected in a scene. Customizingthe inspector allows the developer to display the state of the objectand its components in a more concise or user-friendly way. This mayalso include expanding the context menu, adding validation checks,custom functionality triggered by buttons or a custom asset preview.

Property drawers [62] are specialized classes that define how asingle serializable11 class or a custom attribute12 is handled by theinspector and displayed onscreen. Writing custom property drawersis not mandatory; however, it can help in maintaining consistencybetween different inspectors.

Historically, there are three main approaches to program custominspectors [66], ranging from the original way, the current stable wayand the new, experimental way.

11. Serialized [63, 64] data is data transformed into such a format that can bestored and later reconstructed. This applies to most primitive data types, built-inUnity types, as well as custom classes consisting of those types marked with theSerializable attribute [65].12. Custom PropertyAttribute with an accompanying property drawer defineshow a serialized variable is displayed (e.g. [Range(from, to)] attribute used witha float or an int variable shows a slider).

14

3. Unity

Figure 3.1: Custom CoreComponent Inspector

Editor.target

This approach with casting the Editor’s target is the original wayof creating custom editors. Its main appeal is simplicity, however,the properties to edit in the inspector must have public visibility(or public getters and setters) since the editor and runtime scriptsneed to be placed in separate assemblies (see 3.2.1). Additionally, this

15

3. Unity

[CustomEditor(typeof(MyComponent))]public class MyComponentEditor : Editor{

MyComponent myComponent;

void OnEnable(){

myComponent = (MyComponent) target;}

public override void OnInspectorGUI(){

// Display an integer input fieldmyComponent.myInt = EditorGUILayout

.IntField("My Integer", myComponent.myInt, 0, 100);

// Mark as dirty if anything changedif(GUI.changed) EditorUtility.SetDirty(myComponent);

}}

Listing 5: Custom editor using the simple Editor.target approach

approach doesn’t support undoing changes, multi-editing13 or prefaboverrides14, so for all intents and purposes, this approach ought to beconsidered legacy.

SerializedPropertyUsing serialized properties is a more robust approach to creat-

ing classic custom editors, as it eliminates virtually all drawbacks ofthe Editor.target approach. Multi-editing and prefab overrides aresupported, and an undo step is created with each edit. The use of

13. Changing a property’s value in all selected objects of the same type at once.14. A variation of a prefab, sharing the same base structure but introducing specificmodifications on top.

16

3. Unity

[CustomEditor(typeof(MyComponent))]public class MyComponentEditor : Editor{

// All modifiable propertiesSerializedProperty myVar;

void OnEnable(){

// Find all propertiesmyVar = serializedObject

.FindProperty("myVar");}

public override void OnInspectorGUI(){

serializedObject.Update();DrawInspectorGUI();serializedObject.ApplyModifiedProperties();

}

// Display the Inspector's contentvoid DrawInspectorGUI(){

EditorGUILayout.PropertyField(myVar);}

}

Listing 6: Custom editor using the robust SerializedProperty ap-proach

the PropertyField function also allows for the utilisation of propertydrawers (see 3.2.3).

The main downside is having to conform to a fairly rigid codestructure as presented above. First, find all desired properties when-ever the custom editor is enabled, and in the inspector’s GUI update,refresh the serialized data, draw the custom editor and apply all changes.

17

3. Unity

Another drawback is the reliance on string references in theserializedObject.FindProperty("string") function. This could po-tentially lead to issues during refactoring if a serialized variable isrenamed15.

String references can be avoided altogether by utilizing the nameofoperator [68] which however requires the referenced variables tohave public visibility (since editor and runtime code is generally indifferent assemblies, as explained in 3.2.1).

To avoid breaching the encapsulation16 principle, a possible solu-tion is to expose merely the helper properties retrieving the names ofsaid variables.

public class MyComponent : MonoBehaviour{

[SerializeField, FormerlySerializedAs("oldVar")]int myVar;

public float MyVar => myVar;

#if UNITY_EDITORpublic static class FieldNames {

public static string MyVar => nameof(myVar);}#endif

}

Listing 7: Avoiding string references while following the encapsulationprinciple with SerializedProperty

15. Which generally causes data loss by itself unless the [FormerlySerializedAs]attribute [67] is used.16. A core principle in object-oriented programming that aims to restrict directaccess to data in order to prevent breaking the internal state of an object from outsideits class. Subsequently, the only exposed methods are those that are intended to beused from the outside and modify the internal state in a controlled manner.

18

3. Unity

UI ToolkitUI Tookit (formerly known as UI Elements) is Unity’s most recenttoolset for creating user interfaces, both editor and runtime. It is in-spired byweb technologies [69], allowing its users to separate the logic,layout and style – which roughly correlates with the use of markuplanguages (i.e. HTML, XML) to define the structure and cascading stylesheets (CSS) to modify appearance on the web. This allows for greaterflexibility and reusability [23].

[CustomEditor(typeof(MyComponent))]public class MyComponentEditor : Editor{

const string resourceFile = "custom-editor-uie";public override VisualElement CreateInspectorGUI(){

VisualElement customInspector = new VisualElement();

// Load the Editor layout from the “uxml” filevar visualTree = Resources.Load(resourceFile)

as VisualTreeAsset;visualTree.CloneTree(customInspector);

// Apply visual style from the “uss” style sheetcustomInspector.styleSheets.Add(

Resources.Load(resourceFile + "-style")as StyleSheet

);return customInspector;

}}

Listing 8: Custom editor using the experimental UI Toolkit

However, as of Unity 2021, the UI Toolkit package is still in previewand cannot yet fully replace the previous approaches, which is themain reason why it hasn’t been adopted for the development of thisthesis:

19

3. Unity

Although Unity recommends using UI Toolkit for somenew UI development projects, it’s still missing featuresfound in Unity UI (uGUI) and IMGUI. These older sys-tems are more appropriate for certain use cases and arerequired to support deprecated projects. [69]

3.2.4 Windows

Figure 3.2: A custom setup wizard

Unity’s custom windows are more generally applicable than cus-tom inspectors. Where an inspector is used to display informationabout a certain type of object, custom windows may be used to con-tain virtually anything needed. A common use case is to provide agraphical interface to other custom scripted functionality using inputfields and interactive buttons.

The example window code also shows the usage of the MenuItemattribute [70], which allows a static function to be triggered viaUnity’s main menu. The creation of custom top-level menu entries isgenerally discouraged (it tends to clutter the options bar, especially ifmultiple assets in the project define their own option). The unwritten

20

3. Unity

public class MyWindow : EditorWindow{

[MenuItem("Window/My Project/My Window", false, 100)]static void Open(){

// Get an existing instance or open a new one:var window = (MyWindow)

EditorWindow.GetWindow(typeof(MyWindow));// Use a custom label and an iconwindow.titleContent = new GUIContent(

" My Window", iconTexture);window.Show();

}

void OnGUI(){

GUILayout.Label("Press the button to log a message.");EditorGUILayout.Space();

if (GUILayout.Button("Press me!")){

Debug.Log("You pressed the button.");}

}}

Listing 9: A basic editor window with a button

rule followed by many popular assets on the Asset Store [50] is togroup menu entries under theWindow option.

Apart from the standard EditorWindow, the UnityEditor names-pace also contains several specializedwindow types, such as ScriptableWizard17

or PopupWindow18.

17. A wizard with many helper methods intended to take user-inputted parametersand run a function when confirmed (by default Create).18. A borderless window which closes when it loses focus.

21

3. Unity

3.2.5 Settings

Most ample-sized editor extensions will sooner or later require savingdata or keeping track of shared or commonly-used preferences. Forexample, a grid-snapping tool [71] would save the snap value, gridunits or allow the user to customize the colours of axes. Or a renderpipeline package [72] would define all graphics, quality and post-processing settings.

This also shows different purposes the settings might have. Whilethe former example could broadly fall under per-editor user prefer-ences that aren’t expected to change between projects, the latter is veryproject-depended and may even require support for multiple sets ofsettings that are interchangeable and can be easily swapped as needed(e.g. render pipeline settings for different quality levels).

By far the simplest way of implementing custom settings is viaEditorPrefs [73]. They work similarly to PlayerPrefs, i.e. allow sav-ing and loading custom bool, float, int and string data (any morecomplex type has to be reconstructed from these supported ones).They can be used right away without additional setup.

const string ShowWindowOnStartKey = "Show-Welcome";static bool ShowAtStart{

get { return EditorPrefs.GetBool(ShowOnStartKey, true); }set { EditorPrefs.SetBool(ShowOnStartKey, value); }

}

Listing 10: Example of EditorPrefs usage

This simplicity comes with numerous drawbacks. EditorPrefsare saved in the registry (or a property list file on macOS). There isno simple way to display all project-related editor preferences unlessall keys are known, it is too simple to lose them accidentally19 andtheir space is shared, so different tools or different projects might acci-

19. Calling EditorPrefs.DeleteAll() removes all editor preferences from the reg-istry.

22

3. Unity

dentally overwrite each other’s preferences if they’re named poorly20.Due to their nature, the preferences cannot be included in versioncontrol and thus easily shared with other project collaborators, andthe aforementioned scenario with several variants of the same settingswould be very complicated to set up.

Since its version 2018.3, Unity provides a built-in solution for bothproject settings and preferences, in the form of SettingsProvider [24]which allows developers to utilize a robust settings manager to storedata in a scriptable object asset21. The settings provider only allowsfor these settings to be stored within the Assets folder – which mightbe useful when users need to access and modify these settings directly(such as with the render pipeline asset [72]), or when the assets andall its files need to be as compact as possible (which is commonly thecase of Asset Store assets that can’t have external file references).

For other purposes, especially in custom packages22 which maydeclare package dependencies, it is possible to use the SettingsManagerpackage [76] that permits saving to a file in both ProjectSettings andUserSettings folders.

20. Therefore it’s advisable to always construct the key dynamically, e.g. as"{PlayerSettings.companyName}.{PlayerSettings.productName}.Key".21. ScriptableObject [74] is a general-purpose data container which is saved asan asset in the project. Utilizing scriptable objects properly prevents data duplication(instead of manually copying the values to multiple game objects, a scriptable objectreference is passed to them) and makes changing stored values much simpler.22. Unity allows users to create custom packages [75, 25], which are then keptseparate from the main project files and are managed (updated or removed) by thebuilt-in Package Manager.

23

3. Unity

Figure 3.3: Custom section in the Project Settings

24

4 Newgrounds.io Extension

The main goal of this thesis was to write an extension for the New-grounds.io library [44].

Most importantly, it should be easy to install, set up and use. IfUnity can simplify amanual process, it ought to be done so. Andwhennew functionality is added, it shouldn’t impair the user’s ability to usethe existing one.

Where possible, the extension takes inspiration from popular AssetStore assets [50] in order to follow conventional practices.

4.1 Understanding Issues

To identify the bottlenecks of the process, it is imperative to com-prehend how the official library is currently meant to be used. Thefollowing section will explain the perceived issues, and present theimplemented solution.

The step by step process for publishing a game with medals goesas follows1:

1. Creating the project The first step is creating the project on theNewgrounds website (which requires an account).

2. Enabling API The API is not enabled by default and has to beenabled on a per-project basis, under its API Tools settings.

3. Credentials This generates App ID and Encryption Key, which areboth required by the library.

1. The same process is also described in the Lightweight sample included with theextension – see 4.4 – and in the official library’s README file.

25

4. Newgrounds.io Extension

Figure 4.1: Application credentials in the Project System on New-grounds

4. Medals and scoreboards Still on Newgrounds, it is necessary toprepare any medals or scoreboards that are to be used in thegame.

Figure 4.2: Medals in the Project System on Newgrounds

So far, there is nothing that can be optimized, as there is currentlyno other way to approach these initial steps than directly on New-grounds. The remaining steps take place inside the Unity Editor.

5. Core Now in Unity, the first step is to add the io.newgrounds.corescript component.In playmode, the core initializes itself using supplied creden-tials, and then maintains the connection to Newgrounds andmakes calls to the gateway (see 2.3) using supplied components,

26

4. Newgrounds.io Extension

so its presence is required in every scene with the possibility ofupdating score or unlocking medals.

Figure 4.3: The core MonoBehaviour of the official library

Already we can see several possible improvements to the process.Most of all, the credentials are constants in relation to the project,

but as of now, need to be set up for every new core instance used.This can be solved by turning the core’s game object into a prefab2,or preferably move the credentials to the Project Settings (see 3.2.5).In order to ensure the credentials used are always those defined inthe settings, the values are applied from the settings before enteringplaymode3 and before creating a build4.

Secondly, in a game that consists of multiple scenes, the core gameobject will need to be added to each one of them and re-initialize itselfevery time. Since contacting the server is an asynchronous operation,this might be problematic if a developer wanted to unlock medalssoon after the scene loads. The solution is to add the core to the firstscene of the game and prevent it from being destroyed when the scenechanges [78].

2. Prefab in Unity is a term for a reusable template that copies its component andproperty values to every new instance based on it. Changing values in a prefab willchange values in all its instances as well [77].3. By subscribing to the EditorApplication.playModeStateChanged delegate,we can receive a notification when we are about to enter the playmode in the editor.4. By inheriting from IProcessSceneWithReport.OnProcessScene, we can createa build preprocessor and then make any necessary edits to all scenes as they arebeing processed for a build.

27

4. Newgrounds.io Extension

The final, minor change, would be grouping all Newgrounds com-ponents together in the Add Component menu5.

Figure 4.4: Customizing the Add Component menu

6. Making calls Now that the core is in the scene an initialized, callsmay be made as needed. For both medals and scoreboards, thismeans passing a component with references to their IDs [44].

void UnlockMedal(int medalId){

// Create the componentvar medalUnlock =

new io.newgrounds.components.Medal.unlock();// Set parametersmedalUnlock.id = medalId;// Call the component, with a callback when completedmedalUnlock.callWith(ngioCore, OnMedalUnlocked);

}

Listing 11: Unlocking medals with the official library

This solution – while requiring no extra scripts or assets – re-quires users to manage and keep track of medal IDs on their

5. This is achieved by using the [AddComponentMenu("Newgrounds/Core")] at-tribute.

28

4. Newgrounds.io Extension

own. The concept of making calls and passing callbacks mightalso be perceived by inexperienced developers as too complex(as it’s not a common concept in Unity). Another problem willlikely be with informing the player of having unlocked a medal,as the official library doesn’t provide a way to do so6.

A robust way to solve both issues is to utilize Unity’s built-in dataassets – scriptable objects (see 3.2.5). They could be used to keep trackof both the IDs and the information necessary to display a medalpopup. For convenience, the medal data asset also shows a previewof how the popup will eventually look like, and dragging the assetonto a game object in the hierarchy will automatically add a matchingcomponent script.

Figure 4.5: Amedal ScriptableObject data asset with a medal popuppreview.

And unlocking a single medal can be shortened to:gameObject.GetComponent<MedalComponent>().Unlock();

6. Unlocked medals are displayed below the game window on the site, but onlyafter reloading the page.

29

4. Newgrounds.io Extension

7. Publishing The final step is building the finished game for theWebGL platform, and publishing the compressed (zipped)project on Newgrounds.

Until Newgrounds adds support for automated project publishing,there isn’t much to be done – the finished build still needs to be man-ually uploaded to the Project System on the site. However, with theDotNetZip [51] library, the resulting game build can be automaticallyturned into a zip archive. The build postprocessor also checks thearchive and determines if it conforms to the Newgrounds maximalsize limit.

As a final touch, inspired by theDialogue System for Unity asset [79],a setup wizard was added to streamline the entire process, guidingusers through the initial steps of setting up the project (includinggenerating medal and scoreboard references), and a welcome windowto provide information and display important links.

30

4. Newgrounds.io Extension

Figure 4.6: Welcome window of the Newgrounds.io package

4.2 Historical Note

The very first iteration of this extension was developed in 2017 whencertain features didn’t exist in Unity yet. As such, a lot of the possibleapproaches described in the chapter about editor extensions (see 3.2)were originally part of the project.

Therefore, the project has since underwent a great deal of refac-toring and introducing new features; most notably the support forcustom packages [75] (available since 2018.3).

Custom packages greatly simplify the installation and updatingof external libraries, as well as keep the library apart from the main

31

4. Newgrounds.io Extension

project files. Due to their recommended layout7, they also enforcegood practices and project organisation (separate folders for runtimeand editor assemblies, as well as tests [26], documentation and thesupport for package samples).

The minimal Unity version required by the package was eventu-ally set to 2019.4 – which is the earliest LTS8 version which supportsboth package dependencies, Settings Manager [76] and Editor Corou-tines [80]. The decision was later confirmed after analyzing9 the Unityversions used by fifty different Newgrounds creators in late 2021.

2021.16

2020.3

19

2020.24

2020.1

4

2019.4

102019.3

2 2019.21 2018.43

5.61

Figure 4.7: Unity Version of 50 Authors on Newgrounds (Q4 2021)

7. An example of the official library reorganized into the package can be seenhere: https://bitbucket.org/Rallix/newgrounds.io-for-unity-c-package/src/master/8. Long Term Support, i.e. stable versions that will continue to be maintained andreceive updates for a long period of time.9. The Unity version used to create a game can be determined from logs, in thiscase browser console.

32

4. Newgrounds.io Extension

From the analysis, it seems that the package can be used by roughlyfour fifths of the currently-active users without requiring them toupdate to a newer version of Unity.

4.3 Discontinued Features

Certain features of the library were planned but eventually removedas their implementations were already independently provided byother members of the community. It is still worth mentioning them inthis section because they are examples of relevant topics that are notcovered in other chapters.

Newgrounds Preloader The vast majority of Unity games on New-grounds uses one of the two built-in WebGL Templates10, De-fault orMinimal. However, this isn’t mandatory, and developersmay define their own custom templates [27]. In this case theresult was the revival of the classic Newgrounds preloader11.

Figure 4.8: An example of a customWebGL Template

10. Templates which determine the structure of the HTML page with the gamewindow and the appearance and logic of the loading bar.11. Available from: https://github.com/Aprimez/NG_preloader/tree/master/WebGLTemplates

33

4. Newgrounds.io Extension

PlayerPrefs and updates Saving game state on the web can’t be doneas easily as on other platforms (i.e. to a file), and commonlyis instead done via PlayerPrefs which are then saved to thebrowser’s IndexedDB [81]. However, a significant problem oc-curs when a game is rebuilt and reuploaded for example as anupdate or bugfix – the save path in the IndexedDB has changed,and all players lose their saves (as the new game will load fromand save to a different location). This can be solved with aPlayerPrefs wrapper12 which sets the save location directly,so that it remains consistent.This can, and in fact, was taken further, to a meta-game collab-oration event [28] in which different games made even withdifferent game engines shared the same save data and playingone game in some way affected all the others.

4.4 Documentation

The documentation of this project consists of the quick start guide andthe scripting API. While the official Unity packages use the PackageManager DocTools package [82] to generate their documentation, thetool is considered internal and unsupported.

Therefore, as a replacement which also allows for further customi-sation, the current documentation is generated by DocFX automati-cally with every commit (see appendixes in section A.2).

12. Available from: https://3p0ch.newgrounds.com/news/post/1086279

34

4. Newgrounds.io Extension

Figure 4.9: DocFX documentation of the project

Samples

To showcase the practical uses of implemented components, the pack-age is also accompanied by importable samples. The Lightweight sam-ple notable uses only the base library and no content from the exten-sion.

Figure 4.10: Package samples importable via the Package Manager

35

5 Future Development

The package contains all initially planned features, however, there isstill a lot of potential for more.

At the time of writing, Newgrounds is close to introducing cloudsave functionality [1], which will likely need an update of the officialUnity library, as well as the extension.

Eventually, all the editor extensions will need to be migrated tothe new UI Toolkit (see 3.2.3), which will involve a substantial dealof refactoring. To avoid introducing regression bugs, the universallyrecommendedway of approachingmass-scale refactoring is bywritingcomprehensive unit tests first [29, 30]. The complexity of doing soin Unity (testing asynchronous calls during playmode) is the mainreason why unit tests weren’t written for the project already, but it isdefinitely something to consider.

TestingwithNewgrounds creators has also shown that some favourvisual scripting (i.e. assets like Playmaker or Bolt), which is somethingI didn’t initially consider when developing the extension. Since Unityacquired Bolt and introduces it as a built-in editor package since ver-sion 2021.1, it is certainly something to consider supporting (as thenumber of users of the package can be expected to grow) by writingcustom visual scripting nodes for Newgrounds.io.

And of course, with the continuing Unity development, it will benecessary to be on the lookout for deprecation of old functionalityand newly available features.

37

6 Conclusion

The primary goal of this thesiswas to develop a user-friendly extensionof the official Newgrounds.io library that is more close-tied with Unityand makes better use of its available features.

The early chapters introduced Newgrounds as a website that pio-neered Flash content and set internet trends in the first decade of themillennium. The thesis discussed the role and benefits of web gamesfor the creators in the independent game development community,and compared various game engines that have their place on the web.

The final part of the thesis discussed various approaches to devel-oping extensions for the Unity Editor, and concluded with practicalexample of the extension to the Newgrounds.io library.

39

Bibliography

Main sources

1. FULP, Tom.Newgrounds Wiki: History [online]. Newgrounds, Inc.,2020 [visited on 2021-11-25]. Available from: https://www.newgrounds.com/wiki/about-newgrounds/history.

2. FIADOTAU, Mikhail. Growing old on Newgrounds: The hopesand quandaries of Flash game preservation. First Monday [on-line]. 2020, vol. 2020, no. 8 [visited on 2021-04-22]. issn 1396-0466.Available from doi: 10.5210/fm.v25i8.10306.

3. 50 Best Websites [online]. TIME USA, LLC, 2010-08-25 [visitedon 2021-04-22]. Available from: http://content.time.com/time/specials/packages/article/0,28804,2012721_2012922_2012919,00.html.

4. WILLIAMS, Kristian T.Newgrounds: The Foundation of the Future ofAnimation [online]. YouTube, 2017 [visited on 2021-12-03]. Avail-able from: https://youtu.be/q4COT_Rhdnk.

5. FULP, Tom. Newgrounds founder Tom Fulp on the death of Flash andpreserving two decades of site content [online]. TheWashington Post,2021 [visited on 2021-04-22]. Available from: https://wapo.st/3rYMxt9.

6. FAVIS, Elise; LIAO, Shannon. Flash is dead. These games from theearly 2000s hope to live on. [Online]. The Washington Post, 2021[visited on 2021-04-22]. Available from: https://www.washingtonpost.com/video-games/2021/04/08/flash-habbo-newgrounds-2020/.

7. FULP, Tom.NG Forum | NG News: YouTube and Animators [online].Newgrounds, Inc., 2014-08-03 [visited on 2021-04-22]. Availablefrom: https://www.newgrounds.com/bbs/topic/1372021#bbspost25179674_post_text. Online Forum Post.

8. SHARMA, Aparajita. Is Tumblr shutting down? No. But there’sexodus and Newgrounds is gaining from it [online]. PiunikaWeb,2018-11-18 [visited on 2021-04-22]. Available from: https://piunikaweb.com/2018/11/22/tumblr-shutting-down-no-but-theres-exodus-and-newgrounds-is-gaining-from-it/.

41

MAIN SOURCES9. FULP, Tom. NG Forum | General: Kongregate is shutting down [on-

line]. Newgrounds, Inc., 2020-06-02 [visited on 2021-04-22]. Avail-able from: https://www.newgrounds.com/bbs/topic/1453819/2#bbspost26522278_post_text. Online Forum Post.

10. FULP, Tom. NG Forum | Suporter Party: TomFulp AMA [online].Newgrounds, Inc., 2020-03-07 [visited on 2021-04-22]. Availablefrom: https://www.newgrounds.com/bbs/topic/1443822/2#bbspost26457256_post_text. Online Forum Post.

11. Newgrounds Wiki: Judgment Process for New Submissions [online].Newgrounds, Inc., 2021 [visited on 2021-11-25]. Available from:https://www.newgrounds.com/wiki/help-information/content-submission/games-and-movies#wiki_toc_3.

12. Newgrounds Wiki: Art [online]. Newgrounds, Inc., 2021 [visitedon 2021-11-25]. Available from: https://www.newgrounds.com/wiki/help-information/content-submission/art.

13. NORDHAGEN, Johnnemann. Steam and Discoverability [online].Medium, 2021-07-02 [visited on 2021-11-25]. Available from: https://johnnemann.medium.com/steam-and-discoverability-9ad8ed10883.

14. KARNES, Kevin. Indie Game Marketing: A 2021 Approach [online].CleverTap, 2021-05-25 [visited on 2021-11-25]. Available from:https://clevertap.com/blog/indie-game-marketing/.

15. HUIE, Fritz. Unity Forums: Ads for WebGL [online]. Unity Tech-nologies, 2016-05-31 [visited on 2021-11-25]. Available from: https://forum.unity.com/threads/ads-for-webgl.311126/#post-2658052. Online Forum Post.

16. NOODLE, Graeme. Happy 20th Clock Day!!: The Newgrounds his-tory of B, Clock Crew, & StrawberryClock (w/ interview) [online].YouTube, 2021 [visited on 2021-12-03]. Available from: https://youtu.be/q4COT_Rhdnk.

17. WATTS, Rachel. Friday Night Funkin’ is the DDR beatboxing gamedriving players back to Newgrounds [online]. PC Gamer, 2021-07-15[visited on 2021-11-25]. Available from: https://www.pcgamer.com/friday- night- funkin- is- the- ddr- beatboxing- game-driving-players-back-to-newgrounds/.

18. CRUZ, Carlos; HANUS, Michael D.; FOX, Jesse. The need toachieve: Players’ perceptions and uses of extrinsic meta-gamereward systems for video game consoles. Computers in Human

42

MAIN SOURCESBehavior. 2017, vol. 71, pp. 516–524. issn 0747-5632. Available fromdoi: https://doi.org/10.1016/j.chb.2015.08.017.

19. UNITY: Forerunner in global game development software [online].iGlobe Partners, 2020-03-17 [visited on 2021-10-29]. Availablefrom: https://www.iglobepartners.com/portfolio- unity.html.

20. ŠMÍD, Antonín. Comparison of Unity and Unreal Engine [online].2017 [visited on 2021-11-06]. Available from: http://hdl.handle.net/10467/68529. Bachelor’s thesis. Czech Technical Universityin Prague.

21. TADRES, Angelo. Extending Unity with Editor Scripting. 1st ed.Packt Publishing, 2015. isbn 978-1785285660.

22. HANSHAW, Jacob.GUI vsGUILayout vs EditorGUI vs EditorGUILay-out and When to Use Them [online]. Tangled Reality Studios LLC,2018-11-01 [visited on 2021-12-02]. Available from: https://www.tangledrealitystudios.com/development-tips/gui-vs-guilayout-vs-editorgui-vs-editorguilayout-and-when-to-use-them/.

23. VENKAT, Ajay. UIElements Tutorial for Unity: Getting Started [on-line]. Razeware LLC, 2020-03-04 [visited on 2021-12-02]. Avail-able from: https://www.raywenderlich.com/6452218-uielements-tutorial-for-unity-getting-started.

24. Custom Runtime and Editor Settings in Unity [online]. HextantStudios, 2021-02-27 [visited on 2021-12-02]. Available from: https://hextantstudios.com/unity-custom-settings/.

25. HARTWOOD, Paul. Simple Guide to Unity Package Management[online]. Medium, 2020-12-24 [visited on 2021-12-05]. Availablefrom: https : / / medium . com / runic - software / simple - guide-to-unity-package-management-4aea43d1baf7. Unity UserManual.

26. UCCELLO, Anthony. Introduction To Unity Unit Testing: GettingStarted [online]. Razeware LLC, 2019-05-22 [visited on 2021-12-02]. Available from: https://www.raywenderlich.com/9454-introduction-to-unity-unit-testing.

27. GALACH, Patryk. Creating Custom WebGL Template for Unity [on-line]. 2020-04-20 [visited on 2021-12-02]. Available from: https://www.patrykgalach.com/2020/04/20/unity-webgl-template/.

43

WEBSITES28. NG Forum | Collaboration: Collab of multiple interacting games [on-

line]. Newgrounds, Inc., 2020-05-29 [visited on 2021-12-10]. Avail-able from: https://www.newgrounds.com/bbs/topic/1452560#bbspost26500851_post_text. Online Forum Post.

29. FOWLER, Martin. Refactoring: Improving the Design of ExistingCode. Addison-Wesley Professional, 2019. isbn 978-0134757599.

30. FEATHERS, Michael C. Working Effectively with Legacy Code. Pear-son Education Inc., 2004. isbn 0-13-117705-2.

Websites

31. Newgrounds: Everything, By Everyone [online]. Newgrounds, Inc.,1995–2021 [visited on 2021-04-22]. Available from: https://www.newgrounds.com/.

32. Itch.io: Most used Engines [online]. Itch.io, 2021 [visited on 2021-04-22]. Available from: https://itch.io/game-development/engines/most-projects.

33. TUTTLE, Josh. Newgrounds.io: A platform agnostic Newgrounds API[online]. Newgrounds, Inc., 2016–2021 [visited on 2021-04-22].Available from: https://www.newgrounds.io/.

34. FULP, Tom.Pico’s School [online]. Newgrounds, Inc., 1998 [visitedon 2021-11-26]. Available from: https://www.newgrounds.com/portal/view/310349. Flash Game.

35. SALTER, Anastasia; MURRAY, John. Flash: Building the InteractiveWeb (Platform Studies). The MIT Press, 2014. isbn 978-0262028028.

36. FULP, Tom; PALADIN, Dan, et al. Alien Hominid [online]. TheBehemoth, 2004 [visited on 2021-11-26]. Available from: https://www.alienhominid.com/game/. Video Game.

37. WELSH, Mike. Swivel: Flash to Video [online]. Newgrounds, Inc.,2013 [visited on 2021-04-22]. Available from: https://www.newgrounds.com/wiki/creator-resources/animation-resources/swivel-flash-to-video.

38. Newgrounds: Supporter Upgrade [online]. Newgrounds, Inc., 1995/2021 [visited on 2021-07-26]. Available from: https://www.newgrounds.com/supporter.

44

WEBSITES39. WELSH, Mike et al. Ruffle: Flash Player emulator [online]. 2019

[visited on 2021-11-27]. Available from: https://www.newgrounds.com/wiki/creator- resources/animation- resources/swivel-flash-to-video.

40. Newgrounds: Community Events [online]. Newgrounds, Inc., 2021[visited on 2021-11-25]. Available from: https://www.newgrounds.com/calendar/.

41. NORDHAGEN, Johnnemann. Steam Curator: Newgrounds Games[online]. Medium, 2014-09-23 [visited on 2021-11-25]. Availablefrom: https://store.steampowered.com/curator/6856292-Newgrounds-Games/about/.

42. TUTTLE, Josh. Newgrounds.io Help: Communicating with the Server[online]. Newgrounds, Inc., 2016–2021 [visited on 2021-04-22].Available from: http://www.newgrounds.io/help/communicating-with-the-server/.

43. TUTTLE, Josh. Newgrounds.io for JavaScript/HTML5 [online]. Bit-bucket, 2016–2021 [visited on 2021-04-22]. Available from: https://bitbucket.org/newgrounds/newgrounds.io-for-javascript-html5/src/master/. Bitbucket Repository.

44. TUTTLE, Josh. Newgrounds.io for Unity (C#) [online]. Bitbucket,2016–2021 [visited on 2021-04-22]. Available from: https : / /bitbucket.org/newgrounds/newgrounds.io- for- unity- c/.Bitbucket Repository.

45. Unity: A cross-platform game engine. [Online]. Unity Technologies,1995–2021 [visited on 2021-04-22]. Available from: https : / /unity.com/.

46. Godot Engine: Free and open source 2D and 3D game engine. [Online].2014–2021 [visited on 2021-04-22]. Available from: https : / /godotengine.org/.

47. Construct 3: GameMaking Software. [Online]. 2007–2021 [visited on2021-04-22]. Available from: https://www.construct.net/en.

48. Construct 3: Imagine, Program, Share. [Online]. 2007–2021 [visitedon 2021-11-22]. Available from: https://scratch.mit.edu/.

49. HTML5 Game Engines [online] [visited on 2021-11-16]. Availablefrom: https://html5gameengine.com/.

50. Unity: Asset Store [online]. Unity Technologies, 2021-11-26 [visitedon 2021-12-02]. Available from: https://assetstore.unity.com/.

45

DOCUMENTATION51. CHIESA, Dino. DotNetZip: Zip file manipulation in .NET languages

[online]. 2011–2021 [visited on 2021-12-22]. Available from: https://documentation.help/DotNetZip/About.htm.

Documentation

52. Application.ExternalEval: Scripting API [online]. Unity Technolo-gies, 2021-12-03 [visited on 2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/Application.ExternalEval.html. Unity User Manual.

53. WebGL: Interacting with browser scripting [online]. Unity Tech-nologies, 2021 [visited on 2021-12-03]. Available from: https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html. Unity User Manual.

54. WebGL: Browser Compatibility [online]. Unity Technologies, 2021[visited on 2021-12-03]. Available from: https://docs.unity3d.com/Manual/webgl- browsercompatibility.html. Unity UserManual.

55. DOTS Runtime & Project Tiny: Getting Started [online]. Unity Tech-nologies, 2021 [visited on 2021-09-03]. Available from: https://docs.google.com/document/d/1A8hen2hLFY5FLkC5gd3JP2Z-IpHfnAX-CpYLK3aOdwA.

56. DOTS Packages [online]. Unity Technologies [visited on 2021-11-29]. Available from: https://unity.com/dots/packages.

57. UE4 HTML5 Platform Extension [online]. GitHub, Inc. [visited on2021-11-06]. Available from: https://github.com/UnrealEngineHTML5/Documentation/blob/master/Platforms/HTML5/HTML5.md.

58. Assembly definitions [online]. Unity Technologies, 2021-11-26 [vis-ited on 2021-11-19]. Available from: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html.Unity User Manual.

59. Rect: Scripting API [online]. Unity Technologies, 2021-11-26 [vis-ited on 2021-12-02]. Available from: https://docs.unity3d.com/ScriptReference/Rect.html. Unity User Manual.

46

DOCUMENTATION60. IDisposable Interface: Reference [online]. Microsoft Corporation,

2021-11-04 [visited on 2021-12-05]. Available from: https://docs.microsoft . com / en - us / dotnet / api / system . idisposable ?view=net-6.0#remarks. Microsoft Docs.

61. The Inspector window [online]. Unity Technologies, 2021-11-26[visited on 2021-12-05]. Available from: https://docs.unity3d.com/Manual/UsingTheInspector.html. Unity User Manual.

62. PropertyDrawer: Scripting API [online]. Unity Technologies, 2021-11-26 [visited on 2021-12-02]. Available from: https://docs.unity3d.com/ScriptReference/PropertyDrawer.html. UnityUser Manual.

63. Script Serialization [online]. Unity Technologies, 2021-11-26 [vis-ited on 2021-12-05]. Available from: https://docs.unity3d.com/Manual/script-Serialization.html. Unity User Manual.

64. SerializeField: Scripting API [online]. Unity Technologies, 2021-11-26 [visited on 2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/SerializeField.html. UnityUser Manual.

65. SerializableAttribute Class: Reference [online]. Microsoft Corpora-tion, 2021-11-26 [visited on 2021-12-05]. Available from: https://docs.microsoft.com/en-us/dotnet/api/system.serializableattribute?view=net-6.0. Microsoft Docs.

66. Editor: Scripting API [online]. Unity Technologies, 2021-11-26[visited on 2021-12-02]. Available from: https://docs.unity3d.com/ScriptReference/Editor.html. Unity User Manual.

67. FormerlySerializedAsAttribute: Scripting API [online]. Unity Tech-nologies, 2021-11-26 [visited on 2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/Serialization.FormerlySerializedAsAttribute.html. Unity User Manual.

68. Nameof expression: (C# reference) [online]. Microsoft Corporation,2021-11-04 [visited on 2021-12-05]. Available from: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof. Microsoft Docs.

69. UI Toolkit: Manual [online]. Unity Technologies, 2021-11-26 [vis-ited on 2021-12-02]. Available from: https://on.unity.com/3kR2LC6. Unity User Manual.

47

DOCUMENTATION70. Editor: Scripting API [online]. Unity Technologies, 2021-11-26

[visited on 2021-12-02]. Available from: https://docs.unity3d.com/ScriptReference/MenuItem.html. Unity User Manual.

71. ProGrids: Customizing ProGrids [online]. Unity Technologies, 2020-02-05. Version 3.0.3-preview.6 [visited on 2021-12-02]. Availablefrom: https://docs.unity3d.com/Packages/[email protected]/manual/preferences.html. Package Documentation.

72. Universal Render Pipeline: Universal Render Pipeline Asset [online].Unity Technologies, 2021-12-04. Version 13.1.4 [visited on 2021-12-05]. Available from: https://docs.unity3d.com/Packages/[email protected]/manual/universalrp-asset.html. Package Documentation.

73. EditorPrefs: Scripting API [online]. Unity Technologies, 2021-12-03[visited on 2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/EditorPrefs.html. Unity User Manual.

74. ScriptableObject [online]. Unity Technologies, 2021-11-26 [visitedon 2021-12-05]. Available from: https://docs.unity3d.com/Manual/class-ScriptableObject.html. Unity User Manual.

75. Creating custom packages [online]. Unity Technologies, 2021-11-26[visited on 2021-12-05]. Available from: https://docs.unity3d.com/Manual/CustomPackages.html. Unity User Manual.

76. Settings Manager [online]. Unity Technologies, 2021-11-02. Ver-sion 2.0.1 [visited on 2021-12-02]. Available from: https://docs.unity3d.com/Packages/[email protected]/manual/index.html. Package Documentation.

77. Prefabs [online]. Unity Technologies, 2021 [visited on 2021-12-03].Available from: https://docs.unity3d.com/Manual/Prefabs.html. Unity User Manual.

78. Object.DontDestroyOnLoad: ScriptingAPI [online]. Unity Technolo-gies, 2021-11-26 [visited on 2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html. Unity User Manual.

79. Dialogue System for Unity: Dialogue Manager Setup Wizard [online].Pixel Crushers, 2021-12-04. Version 2.2.22 [visited on 2021-12-05].Available from: https://www.pixelcrushers.com/dialogue_system/manual2x/html/dialogue_manager.html#dialogueManagerWizard. Asset Documentation.

48

DOCUMENTATION80. Editor Coroutines [online]. Unity Technologies, 2020-04-01. Ver-

sion 1.0.0 [visited on 2021-12-02]. Available from: https://docs.unity3d.com/Packages/[email protected]/manual/index.html. Package Documentation.

81. PlayerPrefs [online]. Unity Technologies, 2021-12-03 [visited on2021-12-05]. Available from: https://docs.unity3d.com/ScriptReference/PlayerPrefs.html. Unity User Manual.

82. PackageManager Documentation Tools [online]. Unity Technologies,2021-08-26. Version 1.9.0 [visited on 2021-12-02]. Available from:https://docs.unity3d.com/Packages/com.unity.package-manager- [email protected]/manual/index.html. Package Docu-mentation.

49

Index

editor extensions, 11custom windows, 20Editor folder, 12Inspector window, 14MenuItem, 20popup window, 21property drawer, 14scriptable wizard, 21SerializedProperty, 16settings, 22

game engineConstruct 3, 10GDevelop, 11Godot, 10HaxeFlixel, 11RPG Maker, 11Scratch, 11Unity, 9Unreal Engine, 10Wick Editor, 11

Newgroundsjudgement process, 5Portal, 3

packageDOTS, 9Project Tiny, 9Settings Manager, 23

Unityassembly definitions, 12data serialization, 14editor preferences, 22playmode, 11settings provider, 23

51

A An appendix

A.1 Project Folder

In addition to the several snippets showcased in the thesis, the projectfolder of the extension is included.

A.1.1 Samples

The package samples1 (which are automatically copied to the packagewith every commit) can be found in the Assets folder.

A.1.2 Package

The main part of the extension, the io.newgrounds.unity packagecan be found in the Packages folder.

For convenience, the up-to-date source code of the extension canalso be found in the public GitLab repository2.

To make use of most of the features of the library (medals, score-boards), a Newgrounds [31] account is required, as well as a UnityWebGL game project to add them to.

A.1.3 Documentation

A part of the attached materials is the documentation3, which consistsof the written user manual and the script reference auto-generated byDocFX.

A.2 Git Hooks

These are the git hooks used to auto-generate and publish the DocFXdocumentation, as well as the package’s samples.

1. A playable WebGL build containing the important sample scenes is availablefrom: https://www.newgrounds.com/projects/games/1116659/preview2. Available from: https://gitlab.com/Rallix/io.newgrounds.unity3. Available from: https://rallix.gitlab.io/io.newgrounds.unity/manual/index.html

53