Difference between revisions of "Unity Curation"

From Flashpoint Database
Jump to: navigation, search
m (Minor edit in first paragraph due to page formatting)
m (fixed wikilink)
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Unity web games are currently endangered, since the Unity Web Player was deprecated in 2016 and can no longer be used on modern browsers. In case you need to download the Web Player to search for Unity web game assets, however, an official link to download it exists:
+
Unity web games are currently endangered, since the Unity Web Player was deprecated in 2016 and can no longer be used on modern browsers. In case you need to download the Web Player to search for Unity web game assets, however, you can download the full installer from [https://cdn.discordapp.com/attachments/436484594485952542/638913316911054858/UnityWebPlayerFull.exe here].
http://webplayer.unity3d.com/download_webplayer-3.x/UnityWebPlayer.exe
 
  
 
The following page is a tutorial on how to curate Unity games to add to Flashpoint.
 
The following page is a tutorial on how to curate Unity games to add to Flashpoint.
Line 9: Line 8:
  
 
== Identifying and Grabbing Unity Games ==
 
== Identifying and Grabbing Unity Games ==
 +
[[File:Getunity.png|frame|Plug-in download button.]]
  
 
You will very rarely come across Unity games compared to Flash or HTML5 games; however, identifying them is easy, because they will ask to download the Unity Web Player on the likely chance you don't already have it installed.
 
You will very rarely come across Unity games compared to Flash or HTML5 games; however, identifying them is easy, because they will ask to download the Unity Web Player on the likely chance you don't already have it installed.
  
To confirm this, when on the page containing a game, press Ctrl+U to open its source HTML file and search for a .unity3D file link. If you find one, the game is on the Unity platform, and the .unity3D file will be the source of your game, so copy its link and download it.
+
To confirm this, when on the page containing a game, press Ctrl+U to open its source HTML file and search for a .unity3D file link. If you find one, the game is on the Unity platform, and the .unity3D file will be the main file of the game, so copy its link and download it.
  
 
== Creating the HTML Embed File ==
 
== Creating the HTML Embed File ==
  
 
Go back to the source page for your game and look at the text surrounding the .unity3D link. This is the embed for Unity games. For example, the source HTML for the game [https://www.gameitnow.eu/spelle/games/141437220815353.html Verkeerstalent] contains the following embed:
 
Go back to the source page for your game and look at the text surrounding the .unity3D link. This is the embed for Unity games. For example, the source HTML for the game [https://www.gameitnow.eu/spelle/games/141437220815353.html Verkeerstalent] contains the following embed:
<code>unityObject.embedUnity('unityPlayer', 'http://gameitnow.eu/spelle/games/141437220815352.unity3d', '940', '580');</code>
+
<code><nowiki>unityObject.embedUnity('unityPlayer', 'http://gameitnow.eu/spelle/games/141437220815352.unity3d', '940', '580');</nowiki></code>
  
 
Download [https://bluemaxima.org/flashpoint/downloads/ Flashpoint Core], then open the Utilities folder. Find the Unity HTML Generator and open <code>UnityHTMLGenerator.bat</code> .  
 
Download [https://bluemaxima.org/flashpoint/downloads/ Flashpoint Core], then open the Utilities folder. Find the Unity HTML Generator and open <code>UnityHTMLGenerator.bat</code> .  
  
In the Unity HTML Generator, type the name of the game and the name of the .unity3D file you downloaded including the file extension (example: <code>141437220815352.unity3d</code>) . The width and height to embed the game in are the first and second numbers in the embed respectively. Name the HTML file something relevant, such as the name of the game, preferably in lowercase and without spaces. For example, the HTML for Verkeerstalent is named verkeerstalent.html.
+
In the Unity HTML Generator, type the name of the game and the name of the .unity3D file you downloaded including the file extension (example: <code>141437220815352.unity3d</code>) . The width and height to embed the game in are the first and second numbers in the embed respectively. Name the HTML file something relevant, such as the name of the game, preferably in lowercase and without spaces. For example, the HTML for Verkeerstalent is named verkeerstalent.html. If you prefer to have the game take up the full screen width and height (instead of being embedded at a fixed size), you can use this [https://cdn.discordapp.com/attachments/569426826691346444/872608707882655784/Template-100.txt modified Unity HTML Generator template]. Name it <code>Template.txt</code> and place it in Unity HTML Generator's folder.
  
Follow the [https://bluemaxima.org/flashpoint/datahub/Curation_Format Curation Format] to add metadata for your game and create its correct content folder. The Platform should be <code>Unity</code> and the Application Path should be <code>FPSoftware\startUnity.bat</code>.  
+
Follow the [[Curation Format]] to add metadata for your game and create its correct content folder. The Platform should be <code>Unity</code> and the Application Path should be <code>FPSoftware\startUnity.bat</code>.  
  
Instead of using the URL for the .unity3d file as the Launch Command, however, use the HTML file you created, such as <code><nowiki>http://gameitnow.eu/spelle/games/verkeerstalent.html</nowiki></code>. Put the HTML embed file in the same place as the .unity3D file in your content folder.
+
Instead of using the URL for the .unity3d file as the Launch Command, however, use the HTML file you created, such as <code><nowiki>http://gameitnow.eu/spelle/games/verkeerstalent.html</nowiki></code>. Put the HTML embed file in the same place as the .unity3D file in your content folder. If the game loads to a black screen, or does not work as intended without any missing assets, you may need to change the version of Unity the game launches with. This is done by adding either "2.x" or "3.x" to the beginning of the Launch Command. For example, our new Launch Command would now be <code><nowiki>3.x http://gameitnow.eu/spelle/games/verkeerstalent.html</nowiki></code>. However, this is not needed for this specific game.
  
'''Make sure to always use http:// instead of https:// to make sure Flashpoint grabs files from the fake Internet instead of the real one!'''
+
Make sure to always use http:// instead of https:// to make sure Flashpoint grabs files from the fake Internet instead of the real one!
  
Import your curation as a Folder into Flashpoint Core using the Curate tab and test the game to see if it requires any additional files. If the Logs tab displays a line containing <code>404</code> followed by a content path, format that content path as a URL, download the necessary asset using cURLsDownloader, and put it in its appropriate place in the Content folder.
+
Import your curation as a Folder into Flashpoint Core using the Curate tab and test the game to see if it requires any additional files. If the Logs tab displays a line containing <code>404</code> followed by a content path, format that content path as a URL, download the necessary asset using cURLsDownloader, and put it in its appropriate place in the Content folder.
 +
 
 +
Note that you should ''never'' add ''any'' ZIP file from <code>webplayer.unity3d.com</code> to your content folder! If you see this type of request, it means that Unity Web Player is trying to update itself, either because you are using the wrong version or because Flashpoint is missing the version that the game needs. If changing the game's launch command to use a different Unity version does not resolve the problem, refer to the [[#Finding the Unity Version|Finding the Unity Version]] section for instructions on finding and adding the correct Unity version to Flashpoint.
 +
 
 +
=== Copying the Original Embed Code ===
 +
 
 +
Unity games sometimes require unusual embed codes, meaning that the Unity HTML Generator tool will not produce a suitable embed code. If you can't get a game working in Flashpoint using a generated embed code, try installing Unity Web Player onto your computer, then going to the original webpage using a browser compatible with Unity Web Player (such as Internet Explorer or [http://www.palemoon.org/ Pale Moon]). Once the game has loaded, right-click the page and click "Inspect Element," then search for <code>.unity3d</code> and copy the embed code. Paste this into a new HTML file using a text editor such as Notepad and save the file.
  
 
== Wrapping It Up ==
 
== Wrapping It Up ==
When you're finished testing, pack everything into a single .zip or .7z file and submit it to the #other-game-curations channel of the Flashpoint Discord. Use the :unity: emoji when submitting.
+
{{:Wrapping It Up}}
 +
== Finding the Unity Version ==
 +
 
 +
Sometimes a game not work immediately in any one of the three main Unity versions, or you might have doubts about which Unity version is the most correct for a game. To find the exact Unity version that a game was built with, just open the .unity3d file in a hex editor such as [https://mh-nexus.de/en/hxd/ HxD]. In the "Decoded text" column, you will see the text <code>UnityWeb</code>, followed by the major Unity version (such as 5.x.x), and finally followed by the exact Unity version number (such as <code>5.0.4f1</code>). You can use our [[Unity Web Player Versions]] table to match the Unity version number to one of Flashpoint's three Unity installation folders (2.x, 3.x, or 5.x). If you don't see the exact Unity version listed in the table, it is very likely that the game will work in 5.x. Double-check that your embed code is correct. If the game still isn't working, move on to the next section.
 +
 
 +
Note that most Unity games built with a 3.x version will work perfectly fine in Unity 5.x because of backwards compatibility. However, there are a few 3.x games that have major issues such as broken controls or extremely poor framerates in 5.x, thus requiring 3.x to function properly. An example of such a game is ''Alternator''.
 +
 
 +
Another way to find a suitable version for a Unity game is to launch the .unity3d file in Basilisk, hold down the Alt key, and right-click the game. Hover over the ''Release Channel'' menu and you should see the ranges of Unity versions that the game is compatible with, for example <code>Stable (4.3.5f1 - 4.6.6f2)</code>. You will see a checkmark next to the Unity version that the game is currently running in. This only gives a range of versions instead of an exact version, but it may still be helpful for debugging purposes.
 +
 
 +
=== Adding a New Unity Version ===
 +
 
 +
On rare occasions, a game may require a Unity Web Player version that we don't have yet. Follow these steps to add a new Unity Web Player version to Flashpoint:
 +
# Go to the [https://unity3d.com/get-unity/download/archive Unity download archive]. Click the tab (5.x, 4.x, or 3.x) corresponding to the Unity version you need.
 +
# Find the exact Unity version number and download its installer.
 +
# Open the installer with 7-Zip and find the Unity Web Player development installer inside it. Extract and run the Unity Web Player installer.
 +
# Go to your <code>%USERPROFILE%\AppData\LocalLow\Unity</code> folder and copy <code>player</code> and <code>mono</code> folders into the correct Unity Web Player folder in Flashpoint. Make sure that the folder structure matches up.
 +
# Try testing the game again.
 +
 
 +
You can also find archived Unity Web Player versions in [https://archive.org/details/unity-web-player-archive this Archive.org item].
 +
 
 +
== Downloading Unity Games from Kongregate ==
 +
 
 +
If your browser does not support Unity Web Player, Kongregate will load a message asking you to use a different browser in place of the Unity game. If you don't want to set up a browser with Unity Web Player enabled, you can follow these steps to find the .unity3d URL of the game:
 +
# Press Ctrl-U to view the source of the game's webpage.
 +
# Press Ctrl-F to search the source code. Search for <code>iframe_url</code> and copy the URL next to it.
 +
# Use a tool such as [[Curation_Tutorial#Generating_Content_Folders_with_cURLsDownloader|cURLsDownloader]] to download the URL you just copied. Opening the URL in your browser won't work!
 +
# An HTML file will download to your computer. Open the HTML file in a text editor such as Notepad.
 +
# In your text editor, search the HTML code for <code>.unity3d</code>. You will see a Unity embed; copy the .unity3d file URL and download it.
 +
# Follow the instructions in the [[#Creating the HTML Embed File|Creating the HTML Embed File]] section to complete the curation.
 +
 
 +
A future version of the [[Curation_Tutorial#Using_fpcurator|fpcurator]] tool should be able to download these games automatically.
 +
 
 +
== Downloading Unity Games from GameJolt ==
 +
 
 +
Unity Web Player games on GameJolt are not directly accessible anymore. The only feasible way to download them is to use eientei's GameJolt Downloader script. Here's how to use it:
 +
# Download [https://cdn.discordapp.com/attachments/436484594485952542/660257630052286476/gamejolt_download.py the script] and [https://eternallybored.org/misc/wget/ Wget]. Place them in the same folder.
 +
# Install [https://www.python.org/ Python] if you don't have it yet.
 +
# Open the Command Prompt and navigate to the folder where Wget and the script are located.
 +
# Install the <code>requests</code> Python module by running this command: <code>python -m pip install requests</code>
 +
# Use the script by running a command like this: <code><nowiki>python gamejolt_download.py https://gamejolt.com/games/foc-us/20156</nowiki></code>
 +
 
 +
== Hacking Unity Web Player Games ==
 +
 
 +
In very rare cases, you may need to hack a Unity Web Player game to get it working in Flashpoint, for example to change HTTPS asset requests to HTTP. To get started, you will need the following tools:
 +
* [https://github.com/DerPopo/UABE Unity Assets Bundle Extractor (UABE)]
 +
* [https://github.com/dnSpy/dnSpy dnSpy]
 +
* [https://github.com/ata4/disunity DisUnity]
 +
Follow these rough steps to modify a Unity game:
 +
# Open the .unity3d file in UABE
 +
# Answer "yes" when it asks you whether to decompress the file
 +
# Extract all of the libraries such as DLLs and resources into a folder
 +
# Open the the extracted <code>Assembly-CSharp.dll</code> file with dnSpy
 +
# You will find the game's code here. Edit it as appropriate and save the file, overwriting the original DLL file.
 +
# Use DisUnity's <code>bundle-inject</code> command-line option to inject the extracted files back into the unity3d file.
 +
 
 +
== Useful Search Terms ==
 +
 
 +
If you're looking for more Unity Web Player games to curate, these search terms might help:
 +
* {{Google|"Unity Web Player" "« created with Unity »"}}
 +
* {{Google|filetype:unity3d}}
 +
The latter link will also lead you to some spam, so beware.
 +
 
 +
<noinclude>
 +
[[Category:Curation Guides]]
 +
</noinclude>

Latest revision as of 09:59, 26 September 2021

Unity web games are currently endangered, since the Unity Web Player was deprecated in 2016 and can no longer be used on modern browsers. In case you need to download the Web Player to search for Unity web game assets, however, you can download the full installer from here.

The following page is a tutorial on how to curate Unity games to add to Flashpoint.

Before You Start

This tutorial will assume you've read the standard Curation Tutorial, which is highly recommended to go through. Try curating a Flash game before moving on to other platforms like Unity.

Identifying and Grabbing Unity Games

Plug-in download button.

You will very rarely come across Unity games compared to Flash or HTML5 games; however, identifying them is easy, because they will ask to download the Unity Web Player on the likely chance you don't already have it installed.

To confirm this, when on the page containing a game, press Ctrl+U to open its source HTML file and search for a .unity3D file link. If you find one, the game is on the Unity platform, and the .unity3D file will be the main file of the game, so copy its link and download it.

Creating the HTML Embed File

Go back to the source page for your game and look at the text surrounding the .unity3D link. This is the embed for Unity games. For example, the source HTML for the game Verkeerstalent contains the following embed: unityObject.embedUnity('unityPlayer', 'http://gameitnow.eu/spelle/games/141437220815352.unity3d', '940', '580');

Download Flashpoint Core, then open the Utilities folder. Find the Unity HTML Generator and open UnityHTMLGenerator.bat .

In the Unity HTML Generator, type the name of the game and the name of the .unity3D file you downloaded including the file extension (example: 141437220815352.unity3d) . The width and height to embed the game in are the first and second numbers in the embed respectively. Name the HTML file something relevant, such as the name of the game, preferably in lowercase and without spaces. For example, the HTML for Verkeerstalent is named verkeerstalent.html. If you prefer to have the game take up the full screen width and height (instead of being embedded at a fixed size), you can use this modified Unity HTML Generator template. Name it Template.txt and place it in Unity HTML Generator's folder.

Follow the Curation Format to add metadata for your game and create its correct content folder. The Platform should be Unity and the Application Path should be FPSoftware\startUnity.bat.

Instead of using the URL for the .unity3d file as the Launch Command, however, use the HTML file you created, such as http://gameitnow.eu/spelle/games/verkeerstalent.html. Put the HTML embed file in the same place as the .unity3D file in your content folder. If the game loads to a black screen, or does not work as intended without any missing assets, you may need to change the version of Unity the game launches with. This is done by adding either "2.x" or "3.x" to the beginning of the Launch Command. For example, our new Launch Command would now be 3.x http://gameitnow.eu/spelle/games/verkeerstalent.html. However, this is not needed for this specific game.

Make sure to always use http:// instead of https:// to make sure Flashpoint grabs files from the fake Internet instead of the real one!

Import your curation as a Folder into Flashpoint Core using the Curate tab and test the game to see if it requires any additional files. If the Logs tab displays a line containing 404 followed by a content path, format that content path as a URL, download the necessary asset using cURLsDownloader, and put it in its appropriate place in the Content folder.

Note that you should never add any ZIP file from webplayer.unity3d.com to your content folder! If you see this type of request, it means that Unity Web Player is trying to update itself, either because you are using the wrong version or because Flashpoint is missing the version that the game needs. If changing the game's launch command to use a different Unity version does not resolve the problem, refer to the Finding the Unity Version section for instructions on finding and adding the correct Unity version to Flashpoint.

Copying the Original Embed Code

Unity games sometimes require unusual embed codes, meaning that the Unity HTML Generator tool will not produce a suitable embed code. If you can't get a game working in Flashpoint using a generated embed code, try installing Unity Web Player onto your computer, then going to the original webpage using a browser compatible with Unity Web Player (such as Internet Explorer or Pale Moon). Once the game has loaded, right-click the page and click "Inspect Element," then search for .unity3d and copy the embed code. Paste this into a new HTML file using a text editor such as Notepad and save the file.

Wrapping It Up

First, make sure that you have thoroughly tested your curation and followed the Curation Format. Scroll down in the Curate tab and click the Export button at the bottom of your curation to save it as a .7z file. After you've exported the curation, you can find it by clicking the Exported Curations button on the Curate tab (as long as you didn't choose to save it somewhere else). Once you have the file, submit it to the Flashpoint Submission System. An explanation of how the site works is available here.

After you have uploaded your curation to the website, a Curator will check it. This can take some time, so please be patient. You will be pinged in the #fpfss-notifications channel about whether or not your submission was approved, and if any changes need to be made.

Congratulations! Your submitted game/animation will appear in the next version of Flashpoint.

Finding the Unity Version

Sometimes a game not work immediately in any one of the three main Unity versions, or you might have doubts about which Unity version is the most correct for a game. To find the exact Unity version that a game was built with, just open the .unity3d file in a hex editor such as HxD. In the "Decoded text" column, you will see the text UnityWeb, followed by the major Unity version (such as 5.x.x), and finally followed by the exact Unity version number (such as 5.0.4f1). You can use our Unity Web Player Versions table to match the Unity version number to one of Flashpoint's three Unity installation folders (2.x, 3.x, or 5.x). If you don't see the exact Unity version listed in the table, it is very likely that the game will work in 5.x. Double-check that your embed code is correct. If the game still isn't working, move on to the next section.

Note that most Unity games built with a 3.x version will work perfectly fine in Unity 5.x because of backwards compatibility. However, there are a few 3.x games that have major issues such as broken controls or extremely poor framerates in 5.x, thus requiring 3.x to function properly. An example of such a game is Alternator.

Another way to find a suitable version for a Unity game is to launch the .unity3d file in Basilisk, hold down the Alt key, and right-click the game. Hover over the Release Channel menu and you should see the ranges of Unity versions that the game is compatible with, for example Stable (4.3.5f1 - 4.6.6f2). You will see a checkmark next to the Unity version that the game is currently running in. This only gives a range of versions instead of an exact version, but it may still be helpful for debugging purposes.

Adding a New Unity Version

On rare occasions, a game may require a Unity Web Player version that we don't have yet. Follow these steps to add a new Unity Web Player version to Flashpoint:

  1. Go to the Unity download archive. Click the tab (5.x, 4.x, or 3.x) corresponding to the Unity version you need.
  2. Find the exact Unity version number and download its installer.
  3. Open the installer with 7-Zip and find the Unity Web Player development installer inside it. Extract and run the Unity Web Player installer.
  4. Go to your %USERPROFILE%\AppData\LocalLow\Unity folder and copy player and mono folders into the correct Unity Web Player folder in Flashpoint. Make sure that the folder structure matches up.
  5. Try testing the game again.

You can also find archived Unity Web Player versions in this Archive.org item.

Downloading Unity Games from Kongregate

If your browser does not support Unity Web Player, Kongregate will load a message asking you to use a different browser in place of the Unity game. If you don't want to set up a browser with Unity Web Player enabled, you can follow these steps to find the .unity3d URL of the game:

  1. Press Ctrl-U to view the source of the game's webpage.
  2. Press Ctrl-F to search the source code. Search for iframe_url and copy the URL next to it.
  3. Use a tool such as cURLsDownloader to download the URL you just copied. Opening the URL in your browser won't work!
  4. An HTML file will download to your computer. Open the HTML file in a text editor such as Notepad.
  5. In your text editor, search the HTML code for .unity3d. You will see a Unity embed; copy the .unity3d file URL and download it.
  6. Follow the instructions in the Creating the HTML Embed File section to complete the curation.

A future version of the fpcurator tool should be able to download these games automatically.

Downloading Unity Games from GameJolt

Unity Web Player games on GameJolt are not directly accessible anymore. The only feasible way to download them is to use eientei's GameJolt Downloader script. Here's how to use it:

  1. Download the script and Wget. Place them in the same folder.
  2. Install Python if you don't have it yet.
  3. Open the Command Prompt and navigate to the folder where Wget and the script are located.
  4. Install the requests Python module by running this command: python -m pip install requests
  5. Use the script by running a command like this: python gamejolt_download.py https://gamejolt.com/games/foc-us/20156

Hacking Unity Web Player Games

In very rare cases, you may need to hack a Unity Web Player game to get it working in Flashpoint, for example to change HTTPS asset requests to HTTP. To get started, you will need the following tools:

Follow these rough steps to modify a Unity game:

  1. Open the .unity3d file in UABE
  2. Answer "yes" when it asks you whether to decompress the file
  3. Extract all of the libraries such as DLLs and resources into a folder
  4. Open the the extracted Assembly-CSharp.dll file with dnSpy
  5. You will find the game's code here. Edit it as appropriate and save the file, overwriting the original DLL file.
  6. Use DisUnity's bundle-inject command-line option to inject the extracted files back into the unity3d file.

Useful Search Terms

If you're looking for more Unity Web Player games to curate, these search terms might help:

The latter link will also lead you to some spam, so beware.