DevLog - Space Ships
[h2]Intro[/h2][p]Introducing: Space freighters.[/p][p]In Trade Anchor, your main “characters” of a kind are the space ships that you fly through the galaxy. You start with one, but you can buy additional ships as you accumulate money.[/p][p]More freighters means not just more trade, but also more information. Many empires in the game make information about their markets, prices, etc. only available to those within the empire, or even only to nearby star systems. So having freighters flying through different empires can give you a huge benefit when it comes to identifying lucrative trades.[/p][p][/p][h2]The Star Hopper[/h2][p]The very first ship that you start the game with is the Star Hopper which you can see in the header image.[/p][p]A small, inefficient but cheap and reasonably fast cargo hauler. The Star Hopper is most beloved for being easy to maintain and can be repaired at even the most backwater outpost.[/p][p]This is an excellent starter ship, though it won’t get you very far once you start hauling larger loads. For that, there are other ships, which I will tell you about in future devlogs.[/p][p][/p][h2]What is in a Space Ship ?[/h2][p]The more interesting question for the moment is what you can expect from your space ships.[/p][p]The two main things to consider are its speed and its cargo capacity. Both of those come at a price, of course. Higher speed usually means higher travel costs. There are two ways in which a freighter costs you money: Operating and travel costs.[/p][p][/p][h3]Operating Costs[/h3][p]This is a flat sum you pay every two in-game weeks. It is spent on crew salaries, life support and other systems that cost money even if the ship is just sitting in a space dock. Time is the only factor. Operating costs depend on the size of the ship - larger ships require more crew - but only a bit. For freighters, the size is mostly cargo space, so one or two additional crew members can support a much larger freighter.[/p][p][/p][h3]Travel Costs[/h3][p]The second factor is the cost of travel. This is fuel, drive maintenance and other costs that occur only when the freighter is actually flying. The cost is measured per light-year. Obviously, higher speed usually means higher travel costs. But complexity of the ship and something as simple as if it is a type that was built to be cost-efficient or not, matters.[/p][p][/p][h2]Humans, Aliens, what about that?[/h2][p]Glad you asked. With so many non-human alien races in the galaxy, you cannot simply buy a, say, Qyrl ship and fly around in it. While the Qyrl are a humanoid race, they are smaller than humans and have somewhat different sensory organs.[/p][p]That does not mean you can’t fly alien ships, on the contrary. However, it means that those alien ships you can buy are retrofitted for human use. Sometimes by humans, sometimes by the aliens themselves, or they offer it as a service included in the price.[/p][p]These retrofitted ships are usually considerably more expensive, but deep within alien space you don’t have much choice, and some of these ships offer speeds or efficiency that humans can’t compete with. Not to mention that if you want to go into smuggling (currently a planned addition to the game, not yet implemented) flying in a ship that looks “native” will make things a lot easier.[/p][p][/p][h2]Some DevLog Content[/h2][p]This being a devlog, I want to talk briefly about how the ships are implemented. They are actually 3D models, but the game view being a top-down map, I render these models into a sprite sheet and use those.[/p][p]Depending on which direction it is flying, the respective sprite is used. For sub-45° rotations I simple take the closest sprite and rotate it a few degrees. It’s more clear on some other ships, but if you look closely you can see that the sprites have different highlights and shadows. I wanted to have consistent lighting, so I needed more than one sprite. The sprite in the center is used when the ship orbits a star. In that case it is so close that the light from that sun outshines everything else, so the ship will always have the same side (the one turned to the star) illuminated and I simply rotate the sprite.[/p][p]On the data side, I have defined a Scriptable Object class to hold all the information about ship types, and then a MonoBehaviour class to hold the data on individual ships (position, cargo, etc.) which references the type. Every freighter is also a game object in the scene, so having a MonoBehaviour was the logical step. Of course there is a prefab with everything set up.[/p][p]I am using a data-oriented approach and have a FreighterData class in addition to the Freighter class. This class exists as variable inside the MonoBehaviour, but it allows me to easily reference the data from elsewhere, and if I ever choose to move towards DOTS and ECS, I already have a fairly good seperation of concerns.[/p][p][/p][h2]Closing Words[/h2][p]That’s it for the moment, I hope I have entertained you for a few minutes with some more insights into the game. I am currently working on a very early demo. I expect it to arrive on Steam within the next 2-3 weeks. Which means in the first half of October 2025, in case you read this whenever.[/p][p][/p][p]The full devlog with more images is always posted on my website.[/p]