870 likes | 1.04k Views
Sega 500. Importing a Model, Giving shape to our Boomstick. Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles. To Date….
E N D
Sega 500 Importing a Model, Giving shape to our Boomstick Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles
To Date… • We’ve really focused on medaling with the functionality of UT, but not so much about getting in custom items to make our toys look different.
Today’s Goal • We’re going to fix that, we’re going to make some basic changes to one of the weapons and import a new mesh for it. • Thus giving the impression that we are not playing UT…hopefully.
Today’s Goal • I’ve managed to get my mitts on a a model of a .45 Thompson which we’ll import to use as the 1st person model. • We’re also going to whip up some basic functionality for it, like a 32 round magazine which, once spent… the firing pauses for a reload.
What today is • We’re going to look at the assets as we would expect to receive them and work with those. • Hence, we’ll look at the formats and assets as we would expect to get them and …
What today isn’t • Since this is not a modeling class, we’re not going to look at how to build stuff in max or maya… That’s why god created designers.
What’s needed • Well, obviously, we need a model to import. • This is what one of my friends created for this demo.
What’s needed • Once the model has been created in one of many modeling packages, it gets exported into a format that we can work with. • Which for UT2003 is a PSK and maybe a PSA file.
What’s needed • So then, what the heck are these then? • The PSK file • The mesh is exported to a psk file. This file defines the mesh geometry and skeleton. • When you export the model, ActorX generates a log file titled X_ModelInfo_(modelname).
What’s needed • The PSA file • This file stores the animation data. When you export the animation, ActorX generates a log file titled X_AnimInfo_(modelname). The log file lists all the sequences that will be imported into Unreal Warfare. • Note: if you let ActorX generate the unrealscript file and click the explicit sequence list checkbox, all the sequences will be listed
Importing the Model • Right, now that that’s out of the way, time to go about importing the model…and we have 2 choices on how to do it. • Via UTED or Script…We’ll look at both.
Importing the Model from UTEd • Starting with the editor… • Open up UTEd and spark up the animations browser.
Importing the Model from UTEd • Which should present you with this window: Properties Animations list View window Play / view controls
Importing the Model from UTEd • There’s quite a list of buttons across the top of the window too…but we’ll deal with them in a little bit. • For now select the file pull down in this window and select Mesh import.
Importing the Model from UTEd • Navigate to where you have you PSK file for your model. And select it.
Importing the Model from UTEd • Which presents us with the naming dialogue…just name your model appropriate • Of course being cautious of name collisions.
Importing the Model from UTEd • And poof it’s in! • Sort of...it’s got that butt-ugly-rotten-cottage-cheese texture again.
Importing the Model from UTEd • Don’t panic…This is not big deal if the designer modeled it properly. • It should have all it’s UV coord’s with it. We just need to set its texture which needs to be imported to a UTX separately.
Importing the Model from UTEd • Simply import these into the editor as usual. The weirdness happens when we set them to our model.
Importing the Model from UTEd • Under the mesh properties on the right hand side, we can set out material to our model. • In this case, the designer has provided 2 textures which is fine.
Importing the Model from UTEd • All we do is select one of the desired textures for our texture browser. • Then select one of the material indexes and hit use.
Importing the Model from UTEd • Et-Voila! One partially textured Tommy gun. • Simply repeat the process for the other texture to complete the job.
Importing the Model from UTEd • And once again, don’t forget to save your UKX package or you’ll have to repeat the process.
Making it Work • So now that the model is in, time to make it work. • So the plan is to start simple and build a simple 32 round magazine.
Making it Work • Most of this is really similar to the functionality we created for our own custom weapons and we use several of the same class derivations.
Making it Work • We need the following classes: • A weapon • Fire mode • And a pickup class • Just for the basics…Any additional functionality is up to you.
Making it Work • The weapon we derive most of the existing functionality from the assault rifle class… but there’s a few things we don’t want…like the grenade launcher. • So some of the functionality has to go away.
Making it Work • In short, these 3 functions need to be turned into stubs simulated function DetachFromPawn(Pawn P) simulated function DrawWeaponInfo(Canvas Canvas) simulated function float ChargeBar()
Making it Work • And at this point, we don’t have any animations to attach to the Tommy. So to be save and prevent some “accessed none’s” from IdleAnim=none//Idle RestAnim=none//Rest AimAnim=none//Aim RunAnim=none//Run SelectAnim=none//Select PutDownAnim=none//Down happening, we setour animations to none so nothing plays.
Making it Work • And lastly set up our pickup class and draw mesh. PickupClass=class'TommyGunPickup' Mesh=mesh'TGun.Tom'
Making it Work • Nothing fancy for the pickup mesh, just set up some defaults • We’ve now got he bare minimum to get the model into the game... InventoryType=class'Tommygun' PickupMessage="You got the 45 Thompson" PickupForce="TommygunPickup"
Making it Work • And if all has gone well and you’ve been cautious of name collisions, you should get:
Making it Work • Now, you can almost guarantee that you’ll have to spend some time tweeking the placement numbers to make sure it looks right.
Making it Work • The easiest way to line this up with your view port is to set the placement numbers in the editor, resave and give it another run. • …then repeat the process until you have it where you want it.
Making it Work • Now, I’m absolutely sure that there has to be a better way to line this up, but I have yet to find any substantial documentations on bringing in weapons models for UT2003.
Other Hints • Make sure it’s models at or near the origin ( 0, 0, 0) when you export from your modeling environment or you may have a hard time finding where it’s being rendered in game.
Other Hints • Orient it in the same direction as the other weapons in UT. ( I know this sounds like common sense, but it easy to forget.)
Other Hints • Ok, so we’re almost ready to change how it works…but first, better check that it some basic functionality…. • …yeah seems to shoot fine…
Other Hints • But if we turn and fire, we get this weirdness. • The muzzle flash is not aligned to the gun.
Other Hints • What’s happening is something that is really important to have done properly on the modeling side. • …and that’s to have your weapon properly “boned”.
Other Hints • So, in our case, the Tommy gun is trying to set it’s attachment to the “tip” bone…but not finding it. • This is another thing that really important to getting your weapon to work properly.
Other Hints • Open the animations browser in the editor and have a look at the assault rifle, then hit the “view bones” button.
Other Hints • What we get is a view of this pile of spaghetti… which is all the bones in the assault rifle. • Doesn’t really tell us much…
Other Hints • But if we hit the clear groups button, we get all the names of these bones. Hmmm…don’t see a bone named “tip”.
Other Hints • Well actually there is one there…well…sorta. • Bones can have aliases…in this case ours is tip and the actual name is Bone_Flash
Other Hints • In our case, I simply had the bone named tip in the 3DS max and appropriately placed at the end of the barrel. This worked fine. 3DS Max 5
Other Hints • However, this method didn’t allow us to view the sockets in UTEd, but it works.
Other Hints • Now if we open up with the Tommy gun now, the attachment should stay oriented away from us.
Other Hints • I spent a considerable amount of time on the net looking for information on how our weapon bone system should be set up and bound to the mesh, but found nothing. • Hence, this may not be the 100% correct way, but does the job.
Yet…There is hope. • Ok, as mentioned placing the gun via the editor is more than a bit of a pain… • Fortunately however, there is the online community…