Friday, June 29, 2007

UTBETA

Building the Iphone Ver. 1.0A.
===============================================

The first step in building our Iphone is to obtain reference materials and edit our images so that the 3D model creation software, in this case "Auto Desk 3Ds Max" can create a texture map.
http://nct.digitalriver.com/fulfill/0049.050/download/2007-e7ac219caa969bbd0686a48e713bf443-3 -URL link to download a 30 day free trial.



Now that we have our textures saved as TGA files we can create our polygon mesh and add the texture to it. This is done in 3Ds max by using the cube primitive and correcting its dimensions. Please note that Unreal will only accept textures at certain dimensions, I used 256X512.


With our model created we now need to export it into a file format Unreal will understand. This is accomplished by using the Actor X plug-in found at this site http://udn.epicgames.com/Two/ActorX.html. They're a few settings that must be modified before we can correctly export our model.
1) An output folder must be selected.
2) The app will look for skin geometry. Deselect this option and instead select "all textured". Now hit Save Mesh.
3) Now we must create a script template. The class will be "Iphone" and the base will be "Actor", now deselect assume pcx textures and head up to the animation section.
4) Even though our object isn�t going to be animated we are still required to enter animation variables before we can save our script. For the Animations Sequences Name we can enter "Temp" and for the range enter 0-10. Now select digest animation, once this is done select the Animation Manager and move temp over to the Output Package.
5) Now create your script by scrolling down.
6) Check your output folder. It should contain Iphone.PSK, Iphone.TGA and Iphone.uc. Create three new subfolders inside your Output folder labeled classes, textures and models. The .TGA goes into textures, the .PSK goes into models and the .uc goes into classes.

Our model is now fully exported and ready to be coded for use in UT.
===============================================
Editing UT script.
First download and install ConTEXT, this program is used to open .uc files and gives you the ability to read and edit them. Use it to open Iphone.uc and edit it using the example shown below.

//===============================================================================
// [Iphone]
//===============================================================================

class Iphone extends Actor;
#exec MESH MODELIMPORT MESH=IphoneMesh MODELFILE=models\Iphone.PSK LODSTYLE=10
#exec MESH ORIGIN MESH=IphoneMesh X=0 Y=0 Z=0 YAW=0 PITCH=0 ROLL=0
#exec ANIM IMPORT ANIM=IphoneAnims ANIMFILE=models\.PSA COMPRESS=1 MAXKEYS=999999 IMPORTSEQS=1
#exec MESHMAP SCALE MESHMAP=IphoneMesh X=1.0 Y=1.0 Z=1.0
#exec MESH DEFAULTANIM MESH=IphoneMesh ANIM=IphoneAnims

// Digest and compress the animation data. Must come after the sequence declarations.
// 'VERBOSE' gives more debugging info in UCC.log
#exec ANIM DIGEST ANIM=IphoneAnims USERAWINFO VERBOSE

#EXEC TEXTURE IMPORT NAME=IphoneTex0 FILE=TEXTURES\apple_iphone_1.tga GROUP=Skins

#EXEC MESHMAP SETTEXTURE MESHMAP=IphoneMesh NUM=0 TEXTURE=IphoneTex0

// Original material [0] is [02 - Default] SkinIndex: 0 Bitmap: apple_iphone_1.tga Path: C:\Documents and Settings\Kamal.O.Rowe\Desktop


defaultproperties
{
Mesh=IphoneMesh
DrawType=DT_Mesh
bStatic=False
}


Please not that included in my script is a line for sound, you can ignore this, unlike UT 2003; UT 2004 uses a custom sound format that doesn�t support .wav. Save your changes and copy your output folder into the UT 2004 root folder. E.G, C:\UT2004.
===============================================
Adding Iphone To UT.
Now that we have our model finished and scripted we have to add it into UT using UCC.exe and by adding a command line to UT2004.ini.


Once located open the .ini file with notepad. This will allow us to read and edit the file. Hold CTRL+F and in the search field type EDITP. Scroll to the very end of the EDIT PACKAGE list and add the following package.
Edit Packages=Iphone ~Always! Make a copy of your ini before editing~

Save and close the .ini. It's now time to make UT import our iPhone. To do this we have to run CMD as explained in the previous post. The command typed will be dependant on where you installed your copy of unreal but the format remains the same.
X:\UT2004\System\UCC.exe make, X= the drive letter, \UT2004| may be \Program Files\UT2004\. The rest of the command will remain the same.

UCC should now check all installed components and give zero errors. If an error occurs please check your folder locations and Iphone script.


If everything goes smoothly you should have a file named Iphone.U in the system folder.

===============================================
Using The Iphone.
This is the last step, and the easiest. Simply run UT2004 and start a death match. Remove bots if necessary and use the "~" key to drop down the console. In the console type "summon iphone.iphone" and your new iphone should spawn into the world giving you +10 health every time you bump into it. Please not that the iphone like all Items in the game isn�t solid and will allow you to pass right through it. It also isn�t coded to be picked up.

No comments: