When a ship wreck is created it has a random rotation which rarely matches that of the ship just destroyed. This is not very noticeable in combat as the player is (usually!) focused on flying / aiming and the transition is obscured by the explosion. However, it can still appear odd if a ship is destroyed on screen and suddenly rotates by 90 or 180 degrees.
However, if a ship is destroyed from script (e.g. using runningOutOfFuel effect) the result looks especially bad.
An alternative idea would be to have ships maintain their angular momentum when they are destroyed and for them to not stop spinning unless another ship docks with them to loot them.
Apparently the game generates three random wreck images when it starts (instead of generating the proper image when the wreck is created) to save memory.
void CShipClass::CreateWreckImage (void)
// CreateWreckImage
//
// Creates a wreck image randomly
{
DEBUG_TRY
int i;
if (!GetImage().IsLoaded())
return;
int cxWidth = RectWidth(GetImage().GetImageRect());
int cyHeight = RectHeight(GetImage().GetImageRect());
// Get the image for damage
if (g_pDamageBitmap == NULL)
{
CObjectImage *pDamageImage = g_pUniverse->FindLibraryImage(g_DamageImageUNID);
if (pDamageImage == NULL)
return;
// Lock the image because we keep it around in a global
SDesignLoadCtx Ctx;
if (pDamageImage->Lock(Ctx) != NOERROR)
return;
// Get the image
g_pDamageBitmap = pDamageImage->GetRawImage(strFromInt(GetUNID()));
if (g_pDamageBitmap == NULL)
return;
}
// Create the bitmap
CG32bitImage &SourceImage = GetImage().GetImage(NULL_STR);
m_WreckBitmap.Create(cxWidth, cyHeight * WRECK_IMAGE_VARIANTS, SourceImage.GetAlphaType());
// Blt the images
TArray<int> Rotations;
Rotations.InsertEmpty(WRECK_IMAGE_VARIANTS);
for (i = 0; i < WRECK_IMAGE_VARIANTS; i++)
{
// Pick a random rotation
Rotations[i] = mathRandom(0, GetRotationDesc().GetFrameCount() - 1);
// Copy the frame
GetImage().CopyImage(m_WreckBitmap,
0,
i * cyHeight,
0,
Rotations[i]);
// Add some destruction
int iCount = cxWidth * 2;
for (int j = 0; j < iCount; j++)
{
m_WreckBitmap.Blt(DAMAGE_IMAGE_WIDTH * mathRandom(0, DAMAGE_IMAGE_COUNT-1),
0,
DAMAGE_IMAGE_WIDTH,
DAMAGE_IMAGE_COUNT,
255,
*g_pDamageBitmap,
mathRandom(0, cxWidth-1) - (DAMAGE_IMAGE_WIDTH / 2),
(i * cyHeight) + mathRandom(0, cyHeight-1) - (DAMAGE_IMAGE_HEIGHT / 2));
}
}
// Copy the mask back to the image because we blew it away painting
// the damage.
for (i = 0; i < WRECK_IMAGE_VARIANTS; i++)
{
RECT rcSrc = GetImage().GetImageRect(0, Rotations[i]);
m_WreckBitmap.CopyChannel(channelAlpha, rcSrc.left, rcSrc.top, cxWidth, cyHeight, SourceImage, 0, i * cyHeight);
}
// Initialize an image
RECT rcRect;
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = cxWidth;
rcRect.bottom = cyHeight;
m_WreckImage.Init(&m_WreckBitmap, rcRect, 0, 0, false);
DEBUG_CATCH
}
I noticed this recently and realized that it actually helps to determine the ship has been killed. This can be useful in a busy screen where lots of effects are flying around.
Suggest that some visual difference could be useful in helping to determine if a ship has been destroyed. Maybe rapid spinning/venting/drifting for a certain distance. Flames billowing out? Or the wreck jerking away at right angles for a short distance.
I'd suggest having a large, partly transparent damage image (or maybe a few different ones depending on the size of the ship or what weapon was used to kill it), then for each wreck pick a random section of it and overlay it on the facing the ship had when it died, using the ship's mask.
In 1.8 Beta 3 we honor the rotation of the ship when it was killed.