User-Defined Objects (UDOs)

UDOs are new in Solar Vengeance 5.1.  They represent objects that you can create, manipulate, and interact with in a Scenario.  You can even assign your own static or animated image to display the UDO on the game map.  UDOs can optionally be configured so that they are picked up when a StarShip moves over them.

UDO Properties

UDOs are accessible from the Game property of the Scenario, which exposes an SVGame object instance.  SVGame contains the UDOs property, which is a List<UDO> that contains all of the UDOs defined in the game.  The UDO class itself contains the following properties.  These properties can be examined in VictoryReached and ProcessImpulse, but you should not change the properties directly from these method.  You CAN set the properties of a UDO in the BuildScenario method, after the UDO is created by calling CreateUDO.

public Point Location
public int Y
public int Y
These properties return the position of the UDO on the map.  Do not modify these values directly, as the changes you make will not be reflected to other players in a MultiPlayer game.  To move a UDO during a game, you can use the DynamicEvents.MoveUDO method.  See the Dynamic Scenarios topic for more details.

public string Name
The "Name" of the UDO.  This is displayed when the player clicks a UDO on the map.

public string Description
A description of the UDO.  This is displayed when a player clicks a UDO on the map.

public string ImageFileName
The name of an image file that contains the source image of the UDO.  The image file should reside in the Scenarios folder with the Scenario source code files.  The image can contain multiple frames for animation purposes.

public int FrameCount
The number of frames contained in the UDO's image file.

public int FrameDelay
The number of animation cycles that will elapse before an animated UDO changes to a new frame of animation.

public bool RandomizeFrames
If set to return true, an animated UDO will pick a random frame when it is time for it to switch to the next frame in its animation cycle.

public bool RandomizeInterval
If set to true, an animated UDO will randomize the delay in its animation cycle.  Each frame will be assigned a random number of animation cycles between 1 and FrameDelay.

public bool AutoPickUp
If set to true, this UDO will automatically be "picked up" by any StarShip that moves over it.  UDOs that are carried by StarShips move with the carrying StarShip until the StarShip unloads them using the Eject command.

public bool IgnoreBlackHoles
This property determined whether or not the UDO is pulled in by BlackHoles.  The default value is false, indicating that the UDO is subject to BlackHoles' gravitational pull, and the consequences of being pulled in.

public bool IsTaggable
Set this value to true to indicate that the UDO is able to be tagged by InkSpots.

public StarShip Carrier
Returns the StarShip that is carrying the UDO, or null of it is not being carried.

Creating UDOs

You can create UDOs in one of two ways.  First, by calling the CreateUDO method in the BuildScenario method.  This allows you to pre-populate the Scenario with one or more UDOs from the beginning.  In the CreateUDO method, you specify some of the UDO's properties in the method call.  The method itself returns a UDO object, and you can set further properties of the UDO as needed using this object instance.

The second way of creating UDOs is by calling the CreateUDO method of the DynamicEvents property, from within the ProcessImpulse method.  This allows you to dynamically create new UDOs after a game begins.  See the Dynamic Scenarios topic for more information.

Picking up and Ejecting UDOs

If the UDOs in your Scenario are configured for AutoPickup, they will be "picked up" by any StarShip that moves on top of them.  UDOs that are being carried in this way move with the StarShip, until the player releases them using the Eject Object(s) command during play.  A StarShip can carry any number of UDOs.  You can use UDOs as part of a Scenario's Victory Conditions by overriding the Scenario class' VictoryReached method and exmining the location of the UDOs in the game.  See the CollectTheScientists.cs Scenario file for an example that uses UDOs as the Victory Condition.

If you set your UDOs' AutoPickup property to false, then they will not be picked up automatically.  You can use the DynamicEvents UDO methods to explicitly pick up and eject UDOs in your Scenario's ProcessImpulse method.  See the Dynamic Scenarios topic for more information.