I'm a doctor, not a mechanic

User:00zX/Setting Up Your UScript Environment

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Step by step process of installing, setting up jEdit for use with Uscript. From start to finish, using/committing to repository's and building using Apache Ant. A major portion of this tutorial is dedicated to giving you the knowledge to editing/customizing your programming environment to your liking (I do feel this can help to improve workflow).

Tools suggested for this tutorial:

  • jEdit - Programmers text editor jEdit
  • GIT - Source/Build Repository
  • UnCodeX - UScript Class Browser
  • NSIS - Installer/Packaging

Introduction to jEdit

jEdit is a powerful, cross platform, java based programmers text editor.

Edit Modes

jEdit uses what is called edit modes, these specify:
  • Syntax highlighting rules
  • Auto indent behavior
  • Various other customizations for editing a certain filetype
These edit modes are easily installed an updated, they use the XML language and jEdits own document type definition for modes (xmode.dtd). More information on edit modes can be found within jEdits Help section along with a section on writing edit modes so you can customize jEdits UScript mode to your liking.

Setting jEdits Mode

By default jEdit comes with a UScript mode which can be located in the {jEdit Home Directory}\Modes this edit mode is very light weight and doesnt cover all engine versions.
Im going to recommend not using this directory if you plan to modify your edit mode or use one of the custom ones provided below, the reason for this is simpler backups when using the document directory.
On jEdits main toolbar you will find the utilities button, under that is the global options which contains the options for all edit modes. Syntax highlighting colours can be found in here also.
Wormbo's UScript jEdit Mode
My modified UScript jEdit Mode

Recommended Plugins

  • Project Viewer: Usability.
  • Buffer Tabs: Usability.
  • Dirty Gutter: Diff.
  • TaskList: TODO, NOTE, FIXME's
  • Text Autocomplete: Usability - Code Completion.
  • WhiteSpace: Usability/Readability.

Plugin Installation and Settings

jEdits Plugin Manager and Settings can be accessed through the Plugins button on the main toolbar (show picture).
To install new plugins, click on the plugin manager and you will notice a tab up the top of the new window which says install (show picture).

Navigate to this and select the check-boxes for all plugins you wish to install then hit install in the lower left of the panel.

The plugin settings can be found under the Plugins/Plugin Option button on jEdits main toolbar at the top.


Creating your first Project

In this part of the tutorial we will be creating a project using jEdit and Project Viewer.
First off I prefer to have the project viewer docked on the left hand side of jEdit, you can however put it anywhere you wish to place it.

Right click on All Projects which you should see in your project viewer, add a new group (this is a recommendation), this will help to keep all your UScript UT3/UDK etc separate from any other projects you may wish to create. I have a group named UE3 for example, then under that group I have UT3 and UDK to house each of the projects I have for each.

Once you have your groups setup to your liking you are ready to create a project, this will require that you have a directory to scan for source files within.


Directory Structure and creating Package Folders

Firstly you will need to have an understanding of Unreal Engine's directory structure, from there you will be able to create the required directory for a package so you can compile the *.UC files into a script package file(*.U). For Unreal Script Classes (*.UC files) you will need to first make the package directory and then the Classes directory.

Right click on the group you wish to create the project within, click Add Project. This will display the create project dialogs (show Picture) Select a name and the root directory for you project, for now select {Your Package} directory. Or alternatively if you wish to use multiple package's for your project you may add the {base source directory}, you will however need to filter the imported folders so that only the ones you require for your project are displayed.

Project Viewer would now have selected the project for you, you can navigate back to all projects using the drop down box at the top of Project Viewer.

Creating your first Class

Go to file in jEdits main toolbar, select new and follow this basic procedure Create a class.

You'll notice that Project Viewer doesnt automatically scan for new classes unless it has been selected to do so. Right click on your project in the Project Viewer panel and select 'Re-import files'. Make sure the Project and Classes directories are expanded and you should now see {Your Class} in there.

More on jEdit Modes

Creating a customized template an macro for creating a new class based on this template.

Customizing Project Viewer

Specialized section on setting up Project Viewer's context (Right Click) menu to contain a create class button which will create a class based on a UScript template.

You may skip to Compiling at this point, though I highly recommend you come back and follow up on UnCodex.

Introduction to UnCodex

This is basically a must have application for anyone doing UScript unless ofcoarse you opt to use other IDE's which contain their own class browsers. UnCodeX is still the best out there, it's quick with minimal overhead and is not merely a class browser, it allows you to hyperlink through class names giving you the ability to surf code flow with ease.

There are two versions of UnCodeX that I use, I prefer using the older 227 for anything pre-UE3 or TribesV for those I use the newer 237-beta version.

Setting Up UnCodex

Working with multiple copies of unreal engine source (for example, numerous UDK copies) can be tedious to continuously analyze all the time in UnCodex so I'll guide you through setting it up so you can have numerous shortcuts all which cache different versions of Unreal Engine. You have to be careful however, this can get confusing as to which copy is in which UnCodeX window but you can double check the title bar, which I highly recommend you do. I have been caught out a few times with this myself between UT3 and UDK sources.

As a general rule of thumb I just use the naming convention:
"Drive:\{UnCodeX}\UnCodeX.exe" -config UnCodeX-{GameName/Version}.ini

UT2004 - "Drive:\{UnCodeX227}\UnCodeX.exe" -config UnCodeX-UT2004.ini
DeusEx - "Drive:\{UnCodeX227}\UnCodeX.exe" -config UnCodeX-DeusEx.ini
UT3 - "Drive:\{UnCodeX237-beta}\UnCodeX.exe" -config UnCodeX-UT3.ini
UDK - "Drive:\{UnCodeX237-beta}\UnCodeX.exe" -config UnCodeX-UDK-2009-11-2.ini
UDK - "Drive:\{UnCodeX237-beta}\UnCodeX.exe" -config UnCodeX-UDK-2010-03.ini

Now these INI's will have to exist for this to work, so copy the default UnCodeX.ini and rename it to UnCodeX-{GameName/Version}.ini. Open this file in jEdit or notepad for editing,

[Sources]
''Add your source directories here''
UT2004 - {Base Directory}\System\
UT3 - {User Documents Directory}\My Games\Unreal Tournament 3\UTGame\Src\



[GUI.General]
StateFile=UnCodeX-{GameName-Version}.ucx
UT2004 - StateFile=UnCodeX-UT2004.ucx
DeusEx - StateFile=UnCodeX-DeusEx.ucx
UT3 - StateFile=UnCodeX-UT3.ucx
UDK - StateFile=UnCodeX-UDK-2009-11-2.ucx
UDK - StateFile=UnCodeX-UDK-2010-03.ucx

Once you have done that for your required modes you can boot the shortcut and analyze the source, now every time you boot you would be using the cache for that ini/source.

Introduction to Git

Git is a free & open source, distributed version control system. GIT
msysgit - windows

GIT command prompt

Creating a repository

# cd hello
# ls
# git init
# git add .

Pushing a repository to GitHub Create a repository on GitHub then...

# cd hello
# git remote add origin git@github.com:tabrez/hello.git
# git push origin master


GIT GUI

Compiling

Using Batch (Windows)

UDK Make_64Full

cd..
cd binaries\win64
udk.com make -full -intermediate
pause

Make_64Part

@echo off
cd..
cd binaries\win64
@echo on
udk.com make -intermediate
@echo off
pause


UT3 - Multi-Package Compile batch

@echo Off
prompt $g
rem BASE DIRECTORIES
set UTDIR="D:\Midway\Unreal Tournament 3"
set UTCOM=%UTDIR%\Binaries\UT3.COM

rem PROJECT DETAILS
set UP1=UT_
set UP2=UT_GDP_
set K1=MDB
set K2=GameDex
set K3=Newtators
set K4=Mutatoes

rem script
set UTCONFIG=..\Config
set UTCOMSRC=..\Unpublished\CookedPC\Script
set MYCOMSRC=..\Unpublished\CookedPC\GameDex
 
@echo On
del %MYCOMSRC%\%UP1%%K1%.u
del %MYCOMSRC%\%UP1%%K2%.u
del %MYCOMSRC%\%K3%\%UP2%%K3%.u
rem del %MYCOMSRC%\%K4%\%UP2%%K4%.u
 
%UTCOM% make -debug -useunpublished -log=CompileLog.log -full
copy %UTCOMSRC%\%UP1%%K1%.u %MYCOMSRC%\%UP1%%K1%.u
copy %UTCOMSRC%\%UP1%%K2%.u %MYCOMSRC%\%UP1%%K2%.u
copy %UTCOMSRC%\%UP2%%K3%.u %MYCOMSRC%\%K3%\%UP2%%K3%.u
copy %UTCOMSRC%\%UP2%%K4%.u %MYCOMSRC%\%K4%\%UP2%%K4%.u
del %UTCOMSRC%\%UP1%%K1%.u
del %UTCOMSRC%\%UP1%%K2%.u
del %UTCOMSRC%\%UP2%%K3%.u
del %UTCOMSRC%\%UP2%%K4%.u
 
del %UTCONFIG%\%UP1%%K2%.ini
del %UTCONFIG%\%UP2%%K3%.ini
rem del %UTCONFIG%\%UP2%%K4%.ini
 
pause
prompt $p$g

Running Unreal Engine with your package

archetypes

ini's setup

Main Menu

localization

Introduction to NSIS

NSIS

RevengeTempt.png

;
; GameDex.nsh
; Creation Date: 19/04/2010 10:33
; Last Updated: 04/03/2012 22:33
; Contributors: 00zX
; Attribution-Noncommercial-Share Alike 3.0 Unported
; http://creativecommons.org/licenses/by-nc-sa/3.0/
;
 
XPStyle on
;SetCompressorDictSize dict_size_mb
SetDatablockOptimize on
SetCompressor /SOLID lzma
 
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Gamed"
!define PRODUCT_VERSION "v3.16"
!define PRODUCT_PUBLISHER "00zX"
;!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
;!define PRODUCT_UNINST_ROOT_KEY "HKLM"
 
;--------------------------------
;Include (Custom) Modern UI v2
!include "NSIS\Contrib\Gamed\MUI2_Unreal.nsh"
;!include "${NSISDIR}\include\MultiUser.nsh"
 
;!define MULTIUSER_MUI
 
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "NSIS\Contrib\Gamed\Graphics\Icons\SweetRevengeTemptIcon5s.ico"
!define MUI_UNICON "NSIS\Contrib\Gamed\Graphics\Icons\SweetRevengeTemptIcon5s.ico"
 
; UT3 Uninstall Registry Location
;!define REG_UT "Software\Microsoft\Windows\CurrentVersion\Uninstall\{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
 
;Interface Configuration
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "NSIS\Contrib\Gamed\Graphics\Header\TemptHeader.bmp"
 
;--------------------------------
;Standard Pages
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_LICENSE "NSIS\Contrib\Gamed\Docs\License.txt"
;!insertmacro MULTIUSER_PAGE_INSTALLMODE
 
!ifdef PRODUCT_MODE_STANDARD
	!define PRODUCT_MODE "Std"
	!insertmacro MUI_PAGE_DIRECTORY
	!insertmacro MUI_PAGE_INSTFILES
	!insertmacro MUI_PAGE_FINISH
!endif
!ifdef PRODUCT_MODE_DEVELOPMENT
	!define PRODUCT_MODE "DevEd"
		!define MUI_COMPONENTSPAGE_SMALLDESC ;No value
	!insertmacro MUI_PAGE_COMPONENTS
	!insertmacro MUI_PAGE_DIRECTORY
	!insertmacro MUI_PAGE_INSTFILES
;		!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\UTGame\Published\CookedPC\Script\README_Newtators.txt"
	!insertmacro MUI_PAGE_FINISH
	!insertmacro MUI_UNPAGE_INSTFILES
!endif
 
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
 
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}-${PRODUCT_MODE}.exe"
ShowInstDetails hide
 
;!macro MULTIUSER_INIT_TEXTS
;!macroend
 
;!ifdef PRODUCT_MODE
;!endif
 
;--------------------------------
;Util
!macro redef olddef newdef
	!ifdef ${olddef}
		!undef ${olddef}
	!endif
	!define ${olddef} "${newdef}"
!macroend
 
;--------------------------------
!define UDK "UDKGame"
!define UDK_SRC "Development\Src"
!define UDK_CONT "UDKGame\Content"
;!define UDK_PAK_PATH "$INSTDIR\${UDK_CONT}"
;!define UDK_UNPAK_PATH "$INSTDIR\UDKGame\Content\GamedEx"
 
!define GAMED "Gamed"
 
!macro GPAK_SECG GPAK_NAME _a _b
	!insertmacro redef GPAK_INST "$INSTDIR\${UDK_CONT}\${GPAK_NAME}"
	!insertmacro redef GPAK_TXT "${UDK_SRC}\${GPAK_NAME}"
	!insertmacro redef GPAK_UC "${UDK_SRC}\${GPAK_NAME}\Classes"
	!insertmacro redef GPAK_U "${UDK}\script"
	!insertmacro redef GPAK_CONT "${UDK_CONT}\${GPAK_NAME}"
	SectionGroup ${GPAK_NAME} SEC_${GPAK_NAME}
		SetOverwrite ifnewer
		Section ${_a} ${GPAK_NAME}01
			SetOutPath "$GPAK_INST"
			File "${GPAK_TXT}\${GPAK_NAME}_README.txt"
			File "${GPAK_TXT}\${GPAK_NAME}_ChangeLog.txt"
			File "${GPAK_U}\${GPAK_NAME}.u"
		SectionEnd
 
		!ifdef ${_b}
		Section ${_b} ${GPAK_NAME}02
			SetOutPath "${GPAK_INST}${GPAK_CONT}"
			File "${GPAK_CONT}\${GPAK_NAME}\*.udk"
			File "${GPAK_CONT}\${GPAK_NAME}\*.upk"
		SectionEnd
		!endif
 
		!ifdef ${_c}
		Section ${_c} ${GPAK_NAME}03
			SetOutPath "$GPAK_INST$GPAK_CONT"
			;File "${GAMED_PAK}\config\${GPAK_NAME}.ini"
			;File "${GAMED_PAK}\${GPAK_NAME}.int"
		SectionEnd
		!endif
 
		!ifdef ${_d}
		Section ${_d} ${GPAK_NAME}04
			;SetOutPath "$GPAK_INST$GPAK_CONT"
			;File "${GPAK_CONT}\${GPAK_NAME}\*.uc"
			;File "${GPAK_CONT}\${GPAK_NAME}\*.uci"
		SectionEnd
		!endif
 
		!ifdef ${_c}
		Section ${_c} ${GPAK_NAME}05
			;SetOutPath "$GPAK_INST$GPAK_CONT"
			;File "${GPAK_CONT}\${GPAK_NAME}\*.pdf"
			;File "${GPAK_CONT}\${GPAK_NAME}\*.upk"
		SectionEnd
		!endif
	SectionGroupEnd
!macroend
 
!macro UN_GPAK_SECG GPAK_NAME _a _b
 
!macroend

TemptHeader.png

;
; GameDex-DevEd.nsi
; Creation Date:
; Last Updated: 19/04/2010 10:21
; Contributors: 00zX
; Attribution-Noncommercial-Share Alike 3.0 Unported
; http://creativecommons.org/licenses/by-nc-sa/3.0/
;
;--------------------------------
!define PRODUCT_MODE_DEVELOPMENT
 
!include "Gamed.nsh"
 
ShowUnInstDetails show
;--------------------------------
;Package SubTypes
!define SCR Script
!define CONT Content
!define CFG Config
!define SRC Source
!define Mod ModDesign
 
;Packages
!define GPAKA_DESC "Core Plugin"
!define GPAKB_DESC "Gamed"
!define GPAKC_DESC "Scaleform Interface"
!define GPAKD_DESC "Project: Caster"
 
!macro GPAK GPAK_NAME ;GPAK_DESC
	!ifdef GPAK_NAME
		!insertmacro redef GPAK_PATH "${GAMED_PAK}\${GPAK_NAME}"
		!insertmacro GPAK_SECG ${GPAK_NAME} ${SCR} ${CONT}
	!endif
!macroend
 
SectionGroup /e "!UDK Packages" SECG_UDK
	!insertmacro GPAK GamedPlug
	!insertmacro GPAK GamedEx
	!insertmacro GPAK GamedGFx
	!insertmacro GPAK GamedCaster
SectionGroupEnd
 
SectionGroup "ModTool" SECG_MOD
	Section /o "QuadMX" SEC07
	SectionEnd
	Section /o "jEdit Theme" SEC08
	SectionEnd
	Section /o "MonoDevelop Theme" SEC09
	SectionEnd
	Section /o "Wiki MonoBook (CodeNoir) Theme" SEC10
	SectionEnd
	Section /o "NSIS Theme" SEC11
		SetOverwrite ifnewer
		SetOutPath "$INSTDIR\NSIS\Contrib\Gamed"
		File "Gamed-DevEd.nsi"
		File "Gamed-Std.nsi"
		File "NSIS\Contrib\Gamed\Docs\License.txt"
		File "NSIS\Contrib\Gamed\Graphics\Header\TemptHeader.bmp"
		File "NSIS\Contrib\Gamed\Graphics\Icons\SweetRevengeTemptIcon5s.ico"
		File "NSIS\Contrib\Gamed\Graphics\Wizard\RevengeTempt.bmp"
	SectionEnd
SectionGroupEnd

Creating an NSIS package script

SweetRevengeTemptIcon6l.png