Unreal Developer Network Technical
Welcome to the Unreal Developer Network The EngineThe Engine Unreal Powered Content Creation Technical Playstation2 Xbox Gamecube Licensee Log In

Technical

Technical home

Documents listed below, but not hyperlinked, are restricted to engine licensees only.

As certain texts become relevant, due to released games using that technology, new documents will be made available. Check back often!
 
Getting Started
   - WhatToReadFirst
   - WhoDoIAskAbout
   General Engine Support
   - UnProg (mailing list)
   - UnProgTraffic (summaries)
   - UnDevIRC (chat)
   - UnDevIRCTraffic (summaries)
   Codedrop-Specific Support
   - NextCodeDropStatus
   - CodeDrop2110
   - CodeDrop927
   - CodeDrop829
   - Patch777PS2
   - CodeDrop777
   - CodeDrop739
   - CodeDrop697
   HW/SW Support
   - RecommendedHardware
   - RecommendedSoftware
   - AthlonLockups
   - ImmersionForceFeedback
   - BelkinSpeedPad
   Toolchain Support
   - VTuneUsage
   - VisualSourceSafe
   - UnrealScriptHighlighting
   - VisualStudioAddIns
   - UnrealToolsAddin
   - UnrealToolsDotNet
   - UnrealDebugging
   - UnDox
   - AutoDiff
   - SearchUCinXP
   - EnhancedPkgCommandlet
   - UnrealScriptDebugger
   - BuildingUnrealOnLinux
   - NoStepInto

Unreal Specifics
   - NewProjectPreparation
   Basics
   - UnrealScriptReference
   - UnrealClasses
   - CollisionHash
   - UnrealStrings
   - MemAlloc
   - ConsoleCommandLineParameters
   - UccCommandlet
   - IniFilesTutorial
   - SaveConfiguration
   - GameRules
   - UmodInstaller
   Rendering Architecture
   - RenderingPipeline
   - CameraEffects
   - TypedTextCameraEffect
   Skeletal System
   - UWSkelAnim
   - UWSkelAnim2
   - ExtendingUWSkelAnim
   - SkeletalAttachments
   - SkeletalBlending
   - AdditionalSkelNatives
   - PhysicsBasedAnim
   - AnimNotifies
   - BinaryFormatSpecifications
   Physics
   - PhysicsOverview
   - RootMotionPhysics
   Particle System
   - ParticlesInfo
   - RibbonEmitter
   - ParticleExtensions
   New Particle Editor
   - ParticleSystemEditorCode
   User Interface
   - HeadsUpDisplayTutorial
   - InteractionBasics
   Materials
   - MaterialTricks
   Projected Textures
   - ProjectorTricks
   - RenderToTextureShadows
   - RenderToTextureShadows2
   UnrealScript
   - UnrealScriptDelegates
   - ScriptQuats
   - ConditionalCompilation
   - AsyncFilePackage
   UnrealEd
   - AnimatedTextureBrowser
   - ViewCorrected3DDrag
   Networking
   - NetworkingTome
   - PlayerReplicationHandout
   Terrain
   - TerrainChanges927
   Other Stuff
   - PathingImprovements
   - GameAndAIHandout
   - SubmitBugReport
   - GraphsAndMemory
   - BumpMapping
   - MakeYourOwnDemoMode
   - ExportGeometryIntoMAX
   - InGameMovies
   - CustomArchives
   - LicenseeCodePool
   - LicenseeFileExtensions

Misc
   - CodeDropSong
   - UptBenchmarks

mathengine.gif
Karma Physics
   - KarmaReference
   - VehiclesInUT2003

Contribute!
You can create a new page, and then you can edit this list to add it to the categories, as well as edit the Technical homepage to tell everyone about it!

Make Requests!
You can also stop by the UdnStaff page to see what we're working on, and edit it to add your own document requests.


Please take note! For mod developers working with Unreal Tournament 2003, this documentation is meant to be a starting point for your own explorations into UT2003, not a definitive guide. There will be differences between the documentation here and the product in your hands, and you may have to figure out quite a bit for yourself. Check out the Unreal Tournament 2003 page in the Unreal Powered area for links to community sites if you're having problems. UDN is a licensee support site, and cannot provide technical support or game-specific assistance to end users.

VehiclesInUT2003

Licensees can log in.

Interested in the Unreal engine? Check out the licensing page.

Questions about UDN itself? Contact the UDN Staff.

Vehicles In UT2003

Last updated by James 'BigSquid' Golding, 8th November 2002 .

  • Vehicles In UT2003
    • Classes
      • KVehicle
      • KVehicleFactory
      • KCar
      • KTire
      • Bulldog
    • Tuning KCar's
      • Tire Model
      • Tuning Hints
    • FAQ
      • How would I go about making a hovering or flying vehicle?
      • How do I add 4 wheel drive or 4 wheel steering?
      • How do I stop my car rolling when turning corners?
      • Why does the Bulldog feel slow or floaty?

This page is less of a tutorial and more of a collection of information that might be helpful if you are working with the karma vehicle code in UT2003.

Classes

A quick outline of the function of major classes involved in the vehicle code:

KVehicle

Native class. This is the base class for all Karma-based vehicles, and derives from Pawn. It provides the low level code for getting in and out of the vehicle, as well as the generic control input via Steering and Throttle. Also provides basic camera functionality.

KVehicleFactory

The cleanest way to add vehicles to a map is to use a 'Vehicle Factory' subclass. When triggered, it spawns a new vehicle at the factories location and orientation. You can spawn particles effects etc to make it look nicer.

KCar

Base class for 4-wheeled vehicles. PostNetBeginPlay function spawns all the wheels and joints etc. at the correct places and connects everything together. ProcessCarInput takes the generic KVehicle Steering and Throttle input and turns that into gear (forward or reverse), brakes etc. Tick function passes that information down to the tires and motors.

Also contains code to pack the state of the vehicle into a struct which is sent over the network, and code to unpack it and update the physics when received.

Note that KCar assumes a vehicle pointing along -X, and with +Z being up.

KTire

Native class. Base class of tires for KCar's. Using this class indicates to the engine to do 'tire model' calculations for contacts between this actor and the ground.

Bulldog

Example vehicle. Just does things specific to this particular vehicle, eg. specific wheel position, chassis mass, triggers for getting in, weapons etc. Also spawns effects such as headlight coronas, wheel dust and headlight projectors.

Tuning KCar's

Here is an overview of the various parameters in KCar. In many cases these will be passed on to the tires or they car wheel joints where they are actually used.

WheelFrontAlong Distance forwards of the chassis origin front wheels will be attached.
WheelFrontAcross Dsitance to the side (+\-) of the chassis origin front wheels will be attached.
WheelRearAlong Distance back of the chassis origin rear wheels will be attached.
WheelRearAcross Distance to the side (+\-) of the chassis origin rear wheel will be attached.
WheelVert Vertical distance wheel will be attached. This represents the 'zero' point for the suspension.
MaxSteerAngle Maximum (+/-) angle wheels will go to when steering.
MaxBrakeTorque Maximum torque brakes can apply (each wheel)
TorqueSplit How engine torque is split between front and rear wheels.
SteerPropGap Steering works in the same way as a 'controlled' KHinge. See KarmaReference.
SteerTorque See above.
SteerSpeed See above.
SuspStiffness Stiffness of suspension springs
SuspDamping Damping of suspension
SuspHighLimit Top stop of suspension, relative to suspension center. Note - this is in Karma scale, which is 1/50th of Unreal scale.
SuspLowLimit Bottom stop of suspension, relative to suspension center. Also in Karma scale.
SuspRef Offset of spring center from suspension center. Karma scale.
  See below for explanation of tire parameters.
TireMass Physics mass of the tires.
HandbrakeThresh Speed above which 'handbrake' comes on when turning. Basically this decreases rear wheel grip when braking and turning at speed.
TireHandbrakeSlip Amount to subtract from rear lateral slip when handbrake is engaged.
TireHandbrakeFriction Amount to subtract from rear lateral friction when handbrake is engaged.
ChassisMass Physics mass that will be set for the chassis.
StopThreshold Threshold velocity under which car is considered 'not moving'
TorqueCurve Relationship between engine RPM, and output torque.

Tire Model

The tire model splits forces into two direction. The 'Roll' direction is in the direction of roll of the tire, ie. at right angles to the wheel axle. The 'Lateral' direction is at right angles to that, pointing out the side of the tire.

TireRollFriction and TireLateralFriction control the amount of friction the tire provides. Tire slip in each direction is calculated as follows:

Slip = MIN(RollSlip, MinSlip + (SpinSpeed * SlipRate));

Where SpinSpeed is the rotation of wheel about drive axis in radians per sec. So LateralSlip is the maximum slip, and MinSlip and SlipRate affect how fast you ge there.

Its useful to know the difference between slip and friction. Friction is the ratio between normal force at the tyre-ground contact, and grip it can provide. Its a distinct boundary - the car will grip up to a point and then will start to slide. Slip is the relationship between force and velocity at the tyre - kind of a viscous force. Increasing slip makes the wheels feel generally more slidy.

TireAdhesion makes the tires actually 'sticky', which can be useful. TireRestitution is how bouncy the tires are. TireSoftness allows the tire some springy penetration with ground.

Tuning Hints

If you run the game in a window, then type at the console 'editactor class=bulldog', it should pop up a big properties dialog like in the editor that will let you tweak most parameters while driving around. You can't change some things like centre-of-mass offset though.Try typing 'graph show' at the console with a vehicle in the level, and you should see a scrolling line-graph pop up. The data on the graph is from the GraphData function - see line 681 of KCar.uc.

statgraph.jpg

There also some console commands that enable debug drawing that may be useful:

Oh - do you know about the 'kdraw' console commands?

kdraw collision Show collision used by karma (spheres for wheels, sphyls making up ragdolls etc).
kdraw com Show centre of mass as purple star.
kdraw triangles Show triangles (with normals) currently considered by karma collision.
kdraw joints Show joints with limits.
kdraw contacts Show karma contact position and penetration. Also shows roll and lateral directions.

FAQ

Here are a few answers that have been given on forums or through mail, that may be useful to others.

How would I go about making a hovering or flying vehicle?

A hover vehicle should be easier in a way than wheeled vehicles. You would probably do it by applying forces to the vehicle each frame (inside the KApplyForce event), based on line checks with the ground to give you height etc. For an aircraft, those forces would be based on some aerodynamic model.

How do I add 4 wheel drive or 4 wheel steering?

4 wheel drive should be easy. Thats the TorqueSplit property of KCar - you can see where its used around line 821. Also 4 wheel steering should be possible - all the car wheel joints are the same class, but you can see the rear ones are 'locked' in KCar.uc around line 546. You would have to change the network code a bit as well, it saves some bandwith by assuming they dont steer at the moment.

How do I stop my car rolling when turning corners?

There are several things you can do. Making your turning circle larger is one approach, but probably not what you want to do. You could make the max steer angle a function of speed, so you can't turn so sharply at high speeds. In real life you don't usually slam onto full lock at full speed! You could also spread the wheels further apart, or a useful approach is to increase the amount wheels slide sideways so the car will tend to spin out rather than roll over.

Another way to reduce this is to move the center of mass down a bit by adjusting the KCOMOffset field of the KarmaParams. Typing 'kdraw com' at the console in the game should draw the center of mass as a purple star.

Why does the Bulldog feel slow or floaty?

One reason is that the Bulldog is really big :) It outruns rockets at the moment, but would feel much faster if it was smaller. Also, if vehicles move too fast, it is hard to balance them with players on foot, and may lead to more collision problems.


VehiclesInUT2003 - r1.3 - 06 Mar 2003 - 16:18 GMT - Copyright © 2001-2003 Epic Games
Unreal Developer Network Content by those crazy Perilith guysSite design and art by 2 design