More fun with the inventory system last night, this time with most of the kinks worked out. Sometimes you just have to quit for the day and get some sleep, or you won’t get anything at all productive done. So let’s take a look at loading equipment.
The first step you’re going to follow here is loading weapons from the
Citadel Station Secretly Named Station to be Announced Later. This inventory, as we mentioned in yesterdays post, is shared with all the other members of your team. If there are 7 guns available, it’s not 7 guns for you, and your buddy, and your buddy’s girlfriend, it’s 7 guns split between all of you. Once you’ve pulled a gun out of inventory, it’s loaded onto your ship. Loading guns on your ship takes up valuable tonnage space that can be used for other components to help improve your combat capabilities. This tonnage is returned to being available when you unload equipment from your ship.
In the image below you can see we’ve loaded four guns on board our ship. These are not out of the station inventory and can’t be used by other players in your group.
Before you can use any of these guns, however, you have to load them into a weapon battery. Every ship has four batteries (Alpha, Bravo, Charlie, Delta) that can be targeted independently of each other. As we mentioned yesterday, we are splitting the difference between letting every weapon target a different ship (programatically impossible) and every weapon targeting the same ship. You can see in the image below part of the ‘Tactical Screen’ that shows what weapons are available for loading, and the current target of two of the weapon batteries.
Once you have some weapons in your inventory to assign, you have to select which weapon battery you want to load the weapons into (you can click anywhere in the general vicinity of the load out box to select this) You can see our empty load out box below (we’ve selected Alpha Battery in the image, evidenced by the red border).
Once you have the weapon battery selected, just click a gun to add it to the weapons bay. You can see below we’ve now added two Medium Anti-Capital Ship guns on board our ship, and assigned them to Weapon Battery Alpha.
Weapons not in a battery will not fire at anything, so it’s a good idea to make sure you assign everything in your inventory to a battery or it will just be wasted space!
During the development of this feature set we ran into a number of problems. For example, players can remove a weapon item from their ship inventory to return tonnage space, which also means it has to be checked against the battery and removed from the battery (we default to removing ‘extras’ from the list before we start removing weapons from batteries, but sometimes you don’t have any extras to be removed!).
We also needed the data to persist between sessions – setting up your weapon batteries is not something you should have to do every time you sign into the game. It’s easy during this process to forget the little things – like that we still needed weapons to show up in the inventory list even if some of them have been assigned, so long as there are extras in the inventory.
In the end, we ended up scraping two whole functions and adding a new callback to execute the battery creation process at the end of the inventory loading process. All our attempts to do it all at once ended badly, and if there is one thing we have learned it’s that decoupled functions are easier to modify and change later in the future.
Until next time, Sink Enemy Shipping!