Plug-In Design:How do I make a ship?

Ingredients:

- set of values and aspects (see EV Bible, shďp resource)
- ship name and text description; dësc, STR , and STR#
- sprite specs for spďn resource
- a set of images for the ship
- a 36 sprite frame grid and mask
- 45 degree view, 100 x 100 pixels
- the above scaled to 32 x 32 pixels
- a ship schematic, 128 x 64 pixels
- communication dialog image, 100 x 100

Uses:

This is the resource to create any kind of ship in the game. Ships are used in several other resources such as fleets, missions and planets. EV can handle up to 64 different types of ships. The construction of a ship is split into two parts: Ship Aspects and Ship Graphics.

One thing that can be done is to create different ship aspects and use them with the same set fo ship graphics. All you need to do this is make spďn resources for your two ship types and make their PictID and MaskID fields identical. EV will see this and only load the graphics into memory once and use them for both ships. An example of this is in the stock EV Data file, in which there are two types of Kestrels: the normal one and the 'discount' version.

Construction:

Ship Aspects

You need to draw upon a number of other resources in order to create a ship. These resources include weapons, governments, dudes, fleets, and possibly missions. Otherwise, creating a ship is very straight forward.

The EV Bible describes all of the aspects of the shďp resource. It is best to familiarize yourself with the different aspects of the ship, and what the values will do to the ship. For example:

- Mass affects a ship's reaction to an impact from a weapon. A high-mass ship will not be moved very far whereas a low-mass ship could be displaced significantly by an explosion or blast from a weapon. Mass also affects the ships travel time during hyperspace jumps. This rule is described in the EV Bible.

- The more crew a ship has, the harder it is to capture (if the player is trying to capture it with a different ship). If it's the player's ship, more crew means it's easier to capture other ships.

The shďp resource also depends on or is needed for several other resources. Each one is described below.

- Descriptions (dësc): Write descriptions for your ships for the Shipyard dialog box. In ResEdit, ID 128 gets description (dësc) 2000; ID 135 gets dësc 2000 + (135 - 128) = 2007; and so on.

- Strings (STR or STR#): Fill in the appropriate strings for your ship. EV Bible explains how this is done in a plug-in with STRs. When replacing the STR# resource, the first ship (ID 128) goes in the first field; ID 129 goes in the second. To figure out where to put any shďp ID: (shďpID - 128) + 1 = number to use for that ship in the STR# resource.

- Dudes (düde) or Fleets (flët): To put ships in your plug-in (either in systems, missions, or otherwise), you generally need to make a düde resource for it. As explained in the EV Bible, the düde resource can contain up to 4 ship types that will all be of the same government. To access a ship for a mission, for example, you'd use its düde resource, not its shďp resource. You may have more than one shďp type in a düde to add some variation in your missions and systems, or you can make them for only one shďp type (by entering the same shďp ID into each field, and 25 percent for each).

- Government (gövt): A ship can have an inherent government, and will affect the was other ships react towards it. If you are flying a Confederate ship in Rebel space, you may have some trouble.

Ship Graphics

The spďn resource acts as an intermediary between ships and their sprites. To make a ship have a certain set of sprites, simply create a spďn resource with the SAME ID as the ship with which it is associated. Within the spďn resource, specify the appropriate info regarding the IDs of the sprites/masks in the EV Graphics file or in your plug-in, the x and y size of each individual sprite (should be a multiple of 8), and the size of the sprite array (should ALWAYS be 6x6 for ships). Take a look at how it works by opening the EV Graphics file with ResEdit, if you have it (but don't change anything!).

- If you're using existing graphics:

Method 1: Add a new spďn resource in your program with the ID of your ship. Within that spďn resource, define the appropriate info, most importantly the IDs of the sprites and masks you want for your ship (this can be found by opening the EV Graphics file with ResEdit).

Method 2: Open the EV Graphics file with ResEdit and open the spďn group. Find the ship you want yours to look like and copy and paste it into your plug-in. Then, simply change the ID number of the spďn you just added to your plug-in to match the ship you want it to go with.

- If you're making new graphics:

1. Create your ship in your 3-D program and create the sprites and masks. The details of this are too numerous to go into here. However, you will need 36 frames of your ship rotated in 10 degree increments. Some experimentation may be required. The frames of the ship and the mask will need to be pasted together in a 6x6 array. There are several utilities that may help you, including Pics2Sprites by Matt Burch.

2. In ResEdit, create a new PICT resource in your plug-in. Set its ID appropriately. This can be any number, actually, but the game uses IDs in the 1000 range. The important thing is that the ID is correct in the shďp's spďn resource (see step 6).

3. Paste your 6x6 array of sprites into this new PICT resource.

4. Create another new PICT resource, and set its ID to one greater than the sprites ID. This ID will also be listed in the spďn resource (see step 6).

5. Paste the 6x6 array of masks into this PICT resource.

6. Create a spďn resource in your plug-in. Make sure the proper PictID and MaskID are entered into the appropriate fields. You will also need to know the pixel dimensions of an individual frame of animation, and also the size of the array of frames. Ships should always be 6 x 6.

7. Once you have completed the animation stage, go back to your 3-D program and create a 100 X 100 pixel image of the ship at a 45 degree angle. This is for the shipyard, and is displayed on the right side of the shipyard dialog box when the ship is selected. It is placed in the PICT resource as ID 5000 + (shďpID - 128).

8. Shrink the image created in step 7 to 32 x 32 pixels. This image should be added to the PICT resource ID 5100. This is an 8 x 8 array of all of the ships in the game, and are in the same order as the shďp resource groups. If you want your ship available from the shipyard, make sure you place it properly in this PICT resource.

9. You will also need a 128 x 64 pixel schematic of the ship. This appears in the status area when the ship is targeted. It is placed in the PICT resource as ID 3000 + (shďpID - 128).

10. In the 3-D program, or any program for that matter, make a 100 x 100 pixel image for the communications box. In the base resources of the game, this image is a head-on view of the ship, but you can create an image of the pilot, or anything you desire. As a matter of fact, the images in step 7, 8, 9 and 10 can be changed to whatever you desire, but adhering to a particular standard will make things easier for the player. It is placed in the PICT resource as ID 5300 + (shďpID - 128).

- Make sure you have appropriately set all the IDs and copied then correctly into the spďn resource. If not, EV will probably crash while loading.