Gwynhala’s Rune Model Import Tutorial, 2/13/2001

 In this tutorial we'll take a 3D model of a brain, and turn it into a tasty food item for Ragnar.

You'll need:

Getting Started

Unzip the tutorial archive to your Rune folder. This will create the following folders and files:

Rune
- Test
- - modelimporttutorial.html
- - Classes
- - - Brain.uc
- TestMeshes
- - Brain.3ds
- - LITEPINK.BMP
- - VIOLET.BMP
- - WHTMATTE.BMP
- - Classes
- - - BrainImports.uc

If you haven't already installed Pygmalion and the Rune Version 1.01 patch, do so!

Also, if you haven’t already exported all of the Rune classes so you can create mods, do so: run RuneEd, and select Classes in the box at the upper right. Then click on Export All at the lower right, and wait for the export to complete; then exit RuneEd.

 

Converting Brain.3ds to Brain.SCM

Rune uses a proprietary model format called "Super Cool Model". Models in this format have the .SCM suffix. You can use Pygmalion to import a model in some more familiar format, like .OBJ or .3DS or .MD2, and export it in .SCM format.

Note: At this time, only a baseframe can be exported; future versions of Pygmalion will allow you to export animations as well. No Level Of Detail (LOD) information is generated at this time, so keep your polygon counts low!

The tutorial includes a model of a brain that you can import and convert using Pygmalion. Here’s how to do it.

  1. Run Pygmalion
  2. Select File : Open Body Parts, navigate to Rune\TestMeshes, select Files Of Type : 3D Studio Files (*.3ds), click on BRAIN.3DS, and click Open, then Load All
  3. Enter the name "brain" for the mesh, and click OK. The Brain mesh should appear, all white and turned sideways at the right of the screen.
  4. Select Model : Solid and Model : Textured (make sure there's a check next to each of them)
  5. Select Model : View Materials and note the names of the materials (textures) used by the brain model. They are: VP LITE PINK, VP VIOLET, and VP WHITE MATTE. Click OK to dismiss the dialog box.
  6. Select Model : Rename Material. Highlight VP LITE PINK, and click OK. Enter the new name BrainLITEPINK, and click OK.
  7. Select Model : Rename Material. Highlight VP VIOLET, and click OK. Enter the new name BrainVIOLET, and click OK.
  8. Select Model : Rename Material. Highlight VP WHITE MATTE, and click OK. Enter the new name BrainWHTMATTE, and click OK.
  9. Select Texture : Load, select Files of Type : Windows Bitmaps (*.bmp), click on LITEPINK.BMP, and click Open
  10. Select Texture : Load, select Files of Type : Windows Bitmaps (*.bmp), click on VIOLET.BMP, and click Open
  11. Select Texture : Load, select Files of Type : Windows Bitmaps (*.bmp), click on WHTMATTE.BMP, and click Open
  12. Select Texture : Rename, select LITEPINK.BMP, click OK, enter the new name BrainLITEPINK, and click OK to dismiss the dialog box. You should see most of the brain turn pink.
  13. Select Texture : Rename, select VIOLET.BMP, click OK, enter the new name BrainVIOLET, and click OK to dismiss the dialog box. You should see another part of the brain turn purple.
  14. Select Texture : Rename, select WHTMATTE.BMP, click OK, enter the new name BrainWHTMATTE, and click OK to dismiss the dialog box. You should see the stem of the brain turn whitish gray (you might not see any difference, since the stem was already white).
  15. Select File : Export : Trivial Mesh, select Save as Type : Rune Models (*.scm), enter the name "Brain.scm", and click Save

That's it! The brain model and all of its materials are now saved in Super Cool Model format, in the file Brain.scm. You can quit Pygmalion now.

Converting Brain.SCM to BrainMesh.UMS and BrainMesh.U

Super Cool Model format is just a temporary format for models. The Rune game engine can't directly handle models in .SCM format, it needs to convert them to another format called .UMS. The tool that performs this conversion is the Rune version of UCC.EXE, the UnrealScript compiler. You'll find UCC.EXE in your Rune\System folder.

The version of UCC.EXE that ships with Rune has been modified to include a .SCM import command. The command is called SKELETAL. Although most of UCC.EXE works under any version of Microsoft Windows, the current implementation of the SKELETAL command works only on Windows NT-based operating systems (Windows NT, Windows 2000). So, if you don't run NT, you're stuck for now (sorry - I've heard this will be fixed in a future release of Rune).

SKELETAL isn't really documented anywhere but you can learn everything you need to know about it by checking out Rune\Imports\CreatureImports.uc for lots of examples. We're going to use the following code, found in Rune\TestMeshes\Classes\BrainImports.uc, to tell UCC.EXE to convert our model:

//=============================================================================

// BrainImports.

//=============================================================================

class BrainImports extends imports

abstract;

 

// Brain

#exec SKELETAL IMPORT NAME=Brain FILE=..\TestMeshes\brain.scm PACKAGE=brainmesh

#exec SKELETAL ORIGIN NAME=Brain X=0 Y=0 Z=-18 PITCH=0 YAW=-64 ROLL=-64

 

#exec SKELETAL SAVEPACKAGE PACKAGE=brainmesh FILE=..\TestMeshes\brainmesh.ums

 

defaultproperties

{

}

This code defines a new class, BrainImports, that does nothing except generate a new "package" called brainmesh.ums for Rune. The brainmesh.ums package contains only one thing: our brain model and textures from Brain.scm. There are three commands in the code: SKELETAL IMPORT, SKELETAL ORIGIN, and SKELETAL SAVEPACKAGE. The first of these, SKELETAL IMPORT, tells UCC.EXE what to import. The second, SKELETAL ORIGIN, allows us to shift and rotate the model during the import process (remember, the brain was on its side, so we need to rotate it; it turns out the brain was also off the ground a bit, so we need to shift it downward). The third command, SKELETAL SAVEPACKAGE, tells UCC.EXE how to save the output.

Modifying Rune.ini

To get UCC.EXE to compile Rune\TestMeshes\Classes\BrainImports.uc, we need to modify the file Rune\System\Rune.ini to tell Rune about the new package we're creating. The tutorial archive includes a file called Rune\System\ChangesTo_Rune.ini, which contains additional lines we need to add to Rune.ini in the correct places. It looks like this:

[Core.System]

Paths=..\TestMeshes\*.ums

 

[Engine.GameEngine]

ServerPackages=Test

ServerPackages=TestMeshes

 

[Editor.EditorEngine]

EditPackages=Test

EditPackages=TestMeshes

PrecachePackages=..\TestMeshes\BrainMesh.ums

To use this file, you need to open your Rune\System\Rune.ini file with a text editor, and look for lines matching the ones in brackets (for example, [Core.System]). Then, add the corresponding new lines below the bracketed line (for example, add the single line, Paths=..\Testmeshes\*.ums). Repeat this for each bracketed section that matches.

Note that we're really telling Rune about two new packages. The first, called Test (or Test.u), will be used to test out our new model once it's converted. The second, called TestMeshes (or TestMeshes.u), is used to convert the model. Don't worry about this yet, I'll explain more about it later. For now, just add all the lines from ChangesTo_Rune.ini at the corresponding spots in Rune.ini.

How To Test A Brain

Now let's look at the test code for the brain model. It's in Rune\Test\Classes\Brain.uc, and it looks like this:

//=============================================================================

// Brain.

//=============================================================================

class Brain extends Food;

 

defaultproperties

{

Nutrition=50

JunkActor=Class'RuneI.BloodSpray'

UseSound=Sound'WeaponsSnd.Arm.armflesh01'

PickupMessage="You ate a goblin brain!"

DrawScale=1.50000

CollisionRadius=8.000000

CollisionHeight=8.000000

bCollideWorld=True

Skeletal=SkelModel'brainmesh.Brain'

}

This code tells Rune that we're creating a food item called Brain (because Brain extends Food). It also indicates how much health Ragnar gets from eating a brain, what sound effects to use, what message to display, and what model to use for the brain (we chose SkelModel'brainmesh.Brain', the new brain model we're importing, for obvious reasons). The brain will make a nice squishy sound and spray some blood when Ragnar eats it, just for fun.

We haven't actually converted the brain model from .SCM format to .UMS format yet, but everything is ready. Now it's time to run UCC.EXE to compile our code and convert the model.

Compiling Brain.uc and BrainImports.uc

Now it's time to compile. In case you run this tutorial more than once, we're going to make sure that any old versions of the output files have been deleted before compiling.

Check your system for any of these files, and delete them before compiling:

Now, open up a DOS (Command) window, and navigate to the Rune\System folder. Type "ucc make" to compile your files. REMEMBER, THIS PART WILL NOT WORK UNLESS YOU ARE RUNNING WINDOWS NT!

If all goes well, UCC.EXE will create the following files:

The BrainMesh.ums file should be about 58Kbytes; the other two files will be tiny. Congratulations! You've just added a Goblin Brain food item to Rune!

 

Mmmmmmm….Brains!

Alrightythen. Let's eat some brains to make sure all of this worked.

One way to test the brains would be to add some to your maps, using them in addition to meat, mead, fruit, or lizards. If you do this, remember that the brains can only be seen and eaten by other players who have the new files created in our compile - and TEST.U is a lousy name for a file that you want lots of people to use. At a minimum, you should edit the Test.uc and TestMeshes.uc files to use different path names, and give the files some other name, before redistributing them. This, I leave as an exercise to those who'd like to do it.

Another thing to keep in mind is that the brain model used in this tutorial was never intended for use in a production game environment - it has over 1000 polygons! That's a lot of work for the Rune engine, and will make your maps lag badly, especially if you go nuts and put brains all over the place.

Meanwhile, we can do a quick-and-dirty brain test by using cheat codes. Here's how:

  1. Run Rune
  2. Bring up the console and type: open dm-lavapit to bring up a nice little deatmatch map. Close the console and jump down into the arena area.
  3. Enter these console commands:
    cheatplease
    summon test.brain
    set playerpawn health 1
    cheatplease
  4. Ragnar's health should drop to nearly nothing, and you should see a nice juicy brain floating in front of him.
  5. Now, put away the console, and approach the brain. Press your USE key. Ragnar should eat the brain, some blood should squirt, and he should get about half of his health back.
  6. The brain will respawn after a few seconds in case Ragnar's still hungry.

Closing Notes

Thanks for reading along with this tutorial - I hope it helps you to import other player models into Rune.

If you're using Version Alpha 0.2 of Pygmalion, you should be aware that there's no Level of Detail (LOD) data in the .SCM files it outputs. This means that any high-poly models you create will work the engine extra-hard, potentially causing lag. Future versions of Pygmalion will include LOD support - you should be prepared to re-release your models at that time.

Regards, Gwynhala (gwynhala@runenews.com)