Fangame How-to:SonicGDK/From installation to game deployment

From Sonic Retro

(Original guide by Xaklse)

A version of UDK must be downloaded and installed. Then, a SonicGDK script project needs to be downloaded and added to the engine. In order to develop and test your fangame, code must be compiled at least once. After development is finished, the final step is the creation of an installer file for distribution of your fangame.

Engine setup

Unreal Development Kit (UDK) is the free edition of Unreal Engine 3, a binary-only version used to create games on the PC. Acquiring UDK is simple; head over to the UDK download page and download the "February 2013 UDK Beta" release. Execute the downloaded .exe file and follow the instructions (choose UT3-derived game project). After the installation process, close the UDK Editor if it's opened.

In order to add Sonic gameplay elements and items to UDK, UnrealScripts defining these elements must be added. A new UnrealScript project must be created which consists of a separate package which contains the new scripts, making sure the engine knows to include those when compiling and using the editor.

SonicGDK consists of an UnrealScript project, a test map and a pack of custom visual assets.
Sonic Retro
Get it
, uncompress it and copy the SonicGDK's folders Development and UDKGame and the .bat file to the UDK directory. Run the Unreal Frontend tool application (found in the Binaries folder of your UDK directory), click on the "Script" button and choose the "Full recompile" option from the list. If errors appear, make sure the UDK Editor is closed and retry.

Close the Unreal Frontend tool; installation is complete. A note: the first time that you open the test map, it will compile all the material shaders and take a really long time.

Running a map

To play a level, just run the "Launch Game.bat" file that you copied to the UDK directory; the main menu will let you choose a level.

You can also run the game executable with a special option ("MapName?game=CodePackage.GameInfoClass") and load a level quickly; you usually do that with a shortcut. Examples:

 (UDK dir)\Binaries\Win32\UDK.exe SonicGDKTestMap?game=SonicGDK.SGDKGameInfo
 (UDK dir)\Binaries\Win32\UDK.exe DM-Deck?game=SonicGDK.SGDKGameInfo
 (UDK dir)\Binaries\Win32\UDK.exe VCTF-Necropolis?game=SonicGDK.SGDKGameInfo

You can also run a map if you open it with the editor, but you'll get worse performance.

Building a map

Follow this tutorial.

Code project setup

If you want to program a new code package (called "MyGame") to add new types of objects properly, follow these instructions:

  1. Close the editor if it's opened.
  2. Open the DefaultEngine.ini file of UDKdir\UDKGame\Config folder, add a new line "+EditPackages=MyGame" after "+EditPackages=SonicGDK".
  3. Create the UDKdir\Development\Src\MyGame\Classes folder and add files with code there.
  4. Compile; run the Unreal Frontend tool (UDKdir\Binaries\UnrealFrontend.exe), click on the "Script" button and choose the "Compile scripts" option from the list.

You can then run a map with your custom code and assets. Example with SonicGDK test map:

 (UDK dir)\Binaries\Win32\UDK.exe SonicGDKTestMap?game=MyGame.MyGameInfo

Game deployment

In case you want to distribute your fangame with a single installer file, follow these instructions:

  1. Open the DefaultEngine.ini file of UDKdir\UDKGame\Config folder and change the "Map" and "LocalMap" lines; you must put the name of the first map to load there.
  2. In case you're using custom code, open the DefaultGame.ini file of UDKdir\UDKGame\Config folder and change the "DefaultGame", "DefaultServerGame" and "PlayerControllerClassName" lines; you must put the name of the classes you're using.
  3. (Optional) Remove Default.m4v and Default.mp4 files from UDKdir\UDKGame\Movies; they aren't used and are included in the installer by default.
  4. Cook and pack the game; run the Unreal Frontend tool (UDKdir\Binaries\UnrealFrontend.exe), clone the DM-Deck profile, replace DM-Deck.udk with a list of your maps from the "Maps to cook" section, click on the "Start" button and later on the "Package Game" button.