Ship Class Creation
From HSpace
Contents |
Creating a Ship Class
Kyle Forbes / HSpace 4.x
What is a ship class?
A ship class could also be thought of as a template for ships you will build in the game. Let’s just quickly imagine that each time you want to build a ship, you have to specify all of the information for that ship. Not only do you have to build the rooms, install the consoles, and tell the ship what it’s name is, but you also have to tell it that it has engines, sensors, and other systems. You have to tell it that it has a hull of 500 points strength, two shields of 200 points each, and a cargo bay of 200 units. That’s not all you would have to tell the ship about. For each ship built, there is a lot of information that the ship needs to know in order to function properly. That’s where a ship class saves you a lot of time. You setup the ship class with the template information, and then you build ships of that class. Of course, you can build multiple ship classes. In fact, you can make hundreds of them.
Overriding Class Information
What’s nice about HSpace, though, is that even though your ship is of a certain class, you can still "override" that class information and set variables at the level of the individual ship. Let’s say, for example, that you have a ship that was built as an Avenger Class Destroyer. You want the owner of the ship to be able to install a more durable hull on this ship, but you want all of the other ship information to remain just as the Avenger Class specifies (shields, cargo size, etc). You can tell that individual ship that it has a hull value different from the ship class, and it will work! You’ll see examples of how to do that later…
The Making of a Class
In previous versions of HSpace, putting a new class into the system was a piece of cake (I prefer cheesecake). Unfortunately as HSpace became more flexible, we lost a bit of convenience in constructing classes. In fact, it’s probably the hardest thing to do in HSpace, which is why this guide is going to be your next best friend. Fortunately, you don’t have to build classes that often. Perhaps you install a new class in the game once a day, though you may initially install many classes in your game. It is nothing compared to the many ships you may create each day, which is much easier than creating a class. To construct a class, you’re going to use the following commands in HSpace:
Yes, there are six of them, and you’ll be using them like a professional. You’ll use these commands to:-
- create a new class (newclass),
- add engineering systems to the class (addsysclass),
- set general information on the class (setclass)
- set information for systems on that class (syssetclass)
The sysinfoclass and dumpclass do not set any information on the class. They simply allow you to retrieve current information about the class (dumpclass) and the systems attached to that class (sysinfoclass). You may abbreviate these commands so long as HSpace recognizes them as the unique commands that they be. For example, HSpace has an @space/set command to set information on HSpace objects. You can abbreviate @space/setclass as @space/setc, but you cannot abbreviate it as @space/set. HSpace will think you’re referring to the @space/set command instead of @space/setclass.
Constructing a new ship class involves two primary steps. You must first create the class and set the general information on it. Then, you must add engineering systems (whichever you choose) to the class and set their information. You must add engineering systems because different types of ships may have different types of systems located on them. Rather than HSpace making all ships have the same systems and then you telling HSpace which are present or not, the software allows you to specify only the systems you want to be located on ships of a certain class.
Creating a New Class
Creating a new class is simple. You simply use the @space/newclass command. Its syntax is as follows:
- @space/newclass <class name>
When you type this command, HSpace creates a new class with the next class ID available, starting with 0. If you have 10 classes, they will be 0 – 9, so the next will be 10. You can view your currently installed classes with the following command:
- @space/list classes
Type the following command to setup a new test class:
- @space/newclass Demo Class
Your new class should be created. To view your new class, type the following command.
- @space/dumpclass 0
In this command, though, I’m assuming your new class is ID 0. If it is not, substitute 0 with whatever ID your class is. At the very least, you should have a class 0 at all times in HSpace (unless you have no classes). What you should see is the following:
Ship Class: 0 Demo Class
------------------------------------------------------------
Ship Size : 0 Cargo Size: 0
Ship Crews: 0 Max Hull : 0
Can Drop : NO
Setting General Class Attributes
As you see in the example above, there isn’t much information that comes with a new class. The ship size is 0, which is non-existent to HSpace. At the very least you should have a ship size of 1 for the ship to even appear on sensors. The hull is empty, which makes the ship open to all sorts of nasty space diseases. You need to set this information on the ship, and that’s easy. Try the following commands, which assume your class ID is 0. Again, if it is not, use the class ID of your Demo Class. For the rest of this document, I’ll assume your class ID is 0 for this new class.
- @space/setclass 0/size=1
- @space/setclass 0/maxhull=100
- @space/setclass 0/can drop=1
- @space/setclass 0/cargo=10
In HSpace 4.0, the Ship Crews attribute is NOT used, so don’t worry about it. The above commands set all of the information you need at the general level. Note that the variable to set the hull points is maxhull and not "max hull." For variables on ships and classes (and anywhere in HSpace) that require a YES or NO, use 1 for YES and 0 for NO. Now, type @space/dumpclass 0 again to see that your class information has changed! Now it’s time to add systems …
Adding Systems to Classes
As mentioned previously, you need to add engineering systems to your classes so that new ships of your classes know what engineering systems they should have present during their operation. You can have any of the following engineering systems:
- Internal Computer Sensor Array
- Engines Life Support
- Maneuv. Thrusters Comm. Array
- Fore Shield Aft Shield
- Port Shield Starboard Shield
- Jump Drive Reactor
- Fuel System
Although ships may have any of these systems, that does not mean those systems will show up on the systems report of the engineering status on the ship. Some of these systems are marked as invisible so that players don’t directly interface with them. For example, you may want a player to transfer power to and from engines, but you don’t want a player directly interacting with the fuel system, which HSpace uses to allocate fuel to the reactor and engines.
To add an engineering system to the class, we’ll go through the following example. Although I could show you how to add each and every system to the class, that would be incredibly redundant, and you’ll probably pick this up really fast. We’re going to work with the reactor of the ship, since that’s one of the first things you’ll always add to a new class. First, let’s add the system to the class. Type the following command:
- @space/addsysclass 0=reactor
Your reactor should now be added to the class, so let’s see what sort of information it contains. Type the following:
- @space/sysinfoclass 0=reactor
What you should see is something like the following:
---------------------------------------- Name : Reactor Visible : NO Damage : 0 Tolerance: 0 Opt Power: 0 Cur Power: 0 Stress : 0.0 MAX OUTPUT: 0 DESIRED OUTPUT: 0 CURRENT OUTPUT: 0 ----------------------------------------
That’s a lot of information, but what does it all mean? Each engineering system contains a base set of information, common to all of the engineering system types. This information includes the system name, its visibility to players working with the systems, its current damage, stress tolerance, optimal power, current power, and stress level. Additionally, each type of system may provide more variables that can be queried and set for that particular system. In the case of the reactor we’re using, the MAX OUTPUT, DESIRED OUTPUT, and CURRENT OUTPUT are all specific to the reactor system.
You will not set all of these variables on the system for the class. For example, you’ll want to set the MAX OUTPUT of the reactor, but you don’t want to set the CURRENT OUTPUT. Why is it there? It is there because you are adding complete engineering systems to the class, but only as a template for ships that will have their own engineering systems. Wow, what does that mean in English? It means that you are just providing basic system information for the ships of that class. Those ships, then, will have reactors that have maximum outputs equal to the maximum output of the reactor of the ship class. Additionally, the desired output of the reactor will be set on the reactor for each individual ship. You don’t want to tell all ships of your class that the desired reactor output is something other than 0. That’s up the players to specify how much power they want their reactor to currently output. Thus, we’re only going to set the following variables:
- Tolerance - The stress tolerance of the system (1 .. n)
- Max Output - The maximum output of the reactor.
Here’s how it’s done, watch closely!
- . @space/syssetclass 0:reactor/tolerance=1
- . @space/syssetclass 0:reactor/max output=50
Why don’t we set the optimal power? That’s easy to answer. You will typically set the optimal power for other engineering systems. However, the reactor is a bit different. It does not consume power – it produces it! Thus, the max output is the variable that indicates how much power the reactor can produce (without being overloaded). Normally you would specify the optimal power for a system to indicate the maximum power it can be allocated without being overloaded.
Now, if you type @space/sysinfoc 0=reactor, you’ll see the following:
---------------------------------------- Name : Reactor Visible : NO Damage : 0 Tolerance: 1 Opt Power: 0 Cur Power: 0 Stress : 0.0 MAX OUTPUT: 50 DESIRED OUTPUT: 0 CURRENT OUTPUT: 0 ----------------------------------------
That’s all you need to do for the reactor! If you follow these same steps for the other systems you want to add, you’ll have a fully functioning ship in no time. All you need to do to create a ship of this class is to build your ship, create an object that represents your ship, and type the following command:
- @space/activate <object>=0
Again, I’m assuming 0 is your class ID.
There’s one more thing I want to show you before we finish this section of the discussion. Type the following command again:
- @space/dumpclass 0
Look how it’s changed! It shows there’s an engineering system now – the reactor. See if you can add the rest of the engineering systems and set their attributes. Try adding shields – they have lots of variables to be set. For a slightly expanded example of ship class creation, take a look at the following ship class template.
What the Variables Mean
Although each engineering system has its own set of variables that need to be set, each engineering system shares a base set of variables that you will need to set. This has already been mentioned, so let’s get on with what these variables are:
- Tolerance
The tolerance variable indicates how quickly the system stresses when overloaded. There is no set range for this variable, though it has to be a minimum of 1. If you set this variable to 0, then any overloading of the system creates instantaneous stress at the level of 100%. As the stress on a system increases from 0 to 100%, the chance that the system will incur damage increases. The higher you set the tolerance variable, the more resistant it is to stress.
- Damage
The damage variable does not need to be set on the systems at the class level, though it is important to know what it does at the ship level. Damage values can range from 0 to 4, indicating no, light, medium, heavy, and inoperable damage.
- Opt Power
To set this variable at the class level, you need to specify the "optimal power" setting, not the opt power variable (@space/syssetc 0:system/optimal power). The optimal power is the maximum power that can be allocated to the system without overloading and stressing it. Any power settings less than the optimal power are considered underloading the system, and any power settings over the optimal power are considered overloading. Overloading a system stresses the system, while underloading the system destresses it. It is important to note that stressing a system and then setting it to 100% power allocation only slowly destresses the system. The fastest way to reduce system stress is to shut the system down.
- Cur Power
Cur power, like opt power, actually stands for current power, which is the name that should be used when setting this variable. It does not need to be set at the class level, but it indicates at the ship level the amount of power currently allocated to the system.
- Stress
The stress variable does not need to be set at the class level. At the ship level it indicates how much stress the system has currently taken on a level from 0 – 100% stress. At 100% stress the system will likely be inoperably damaged in short time.
Miscellaneous Information
While I’ve covered the basics of ship class creation in this short guide, there are other things to consider. With each release of HSpace, more systems will probably be available, and each of those systems will serve some purpose on a ship. You may choose to add these systems to your classes or leave them out, but some are quite necessary. A ship with no reactor will clearly have no power to allocate to its systems. Without power, those systems will not perform. You can add everything to a ship but engines, but without engines that ship is not going to move.
You can, however, simulate unlimited fuel on a ship by leaving the fuel system off of the ship class. Without a fuel system, the ship does still function, and it consumes no fuel.
You may add up to four shields to a ship class, but you must add them in pairs. A ship class can have 0, 2, or 4 shields, but not 1 or 3. The first two shields added are always front and rear, even if you add the port and starboard instead of the fore and aft shields. The next two shields are in the port and starboard locations. It does not matter if you add port before aft or starboard before fore. The port shield is always the port, the aft is always the aft.
Finally, this guide is intended to give you a general overview of adding ship classes to the game. It does not go into in depth detail about everything you can do with ship classes, some of which may be completely incidental.
