Wednesday, January 3, 2018

Cosmoteer 0.13.2 - Miscellaneous Improvements

Cosmoteer 0.13.2 has been released! This is a relatively minor update that fixes bugs, reduces RAM usage, and adds some quality-of-life improvements and modding tools.

The reduction in RAM (and VRAM) usage is largely because Cosmoteer now uses "texture compression" to reduce the size of almost all of the graphics textures by 75%. This saves a couple hundred MB of RAM in the vanilla game, and it makes an enormous impact for some mods: "Abh Mod" for example has gone from using more than 4 GB of ram to around 1.2 GB of RAM.

Most games use texture compression and package already-compressed textures as part of the game installation. But Cosmoteer is a bit different in that it compresses textures on the fly from the raw PNG files during loading. It does this primarily to keep the game very easy to mod (most paint programs are unable to save textures using GPU-compatible texture compression formats, and none can generate the texture atlases that Cosmoteer uses for its ship graphics). The downside is that it takes much longer to compress a texture than it does to load an uncompressed texture, and so after compressing a texture for the first time, Cosmoteer caches the compressed texture on your hard drive and only re-compresses it if the original PNG file has changed.

This update also adds a "Developer Mode" to Cosmoteer, which makes available a number of development tools and features that should hopefully make mods easier and more convenient to create. These tools include a particle effect editor, a planet editor, and the ability to "cheat" by giving yourself money and fuel.

Tuesday, November 28, 2017

Cosmoteer 0.13.1 - Perimeter of Death!

Cosmoteer 0.13.1 has just been released! The majority of changes are bug fixes, but there are still a couple of nice other improvements:

First, this update adds to multiplayer a feature called the "Perimeter of Death". This is a giant circle around the battle area that will quickly damage and destroy any ships that stray outside of it. It is intended to reduce the effectiveness of "kiters" (ships with long-range weapons and lots of thrust that simply stay out of range of enemies) as well as prevent players from simply running away indefinitely.

The other feature is something that a lot of players have been asking for: a "sort" function for the Ship Library. Now, players can sort their ships by name (the default), cost, crew, or date modified.

Sunday, November 12, 2017

Cosmoteer 0.13.0 - Multiplayer!!!

Given the lack of updates for the past couple of months, you'd be forgiven for thinking that I had stopped working on Cosmoteer. Thankfully, you could not be more mistaken!

I've actually been working on one of the biggest new features in the history of Cosmoteer: Multiplayer!

Those of you who have been following Cosmoteer for a really long time probably know that the original prototype versions had support for multiplayer in which players could design ships and battle them with their friends. But I realized that having to support multiplayer was dramatically slowing down the development of Cosmoteer, including development of singleplayer-only features. And so I removed multiplayer support from the game's code, hoping (but not expecting) that one day I would be able to bring it back.

Well, that day has arrived! I am incredibly proud and excited to announce that multiplayer is returning to Cosmoteer!

In this first version, multiplayer is a simple team-versus-team battle of up to 8 players spread across two teams. Each team has a certain amount of money (configured by the host) to spend on a fleet of up to 5 ships per player (or fewer, as configured by the host). Then the game starts and the players control their own ships, attempting to destroy the other team's fleet. The game ends and one team is declared the winner when either the other team's fleet is sufficiently destroyed or the timer runs out.

You can play with anyone on the same LAN (Local Area Network) as you, and you can also play with a friend anywhere else in the world by typing in the host computer's I.P. address. (There is not yet a public online list of games, but I hope to add that soon.)

This is just the beginning! This first version lays the coding foundation for more improvements to come. In the long term, I may add entirely different game modes, such as multiplayer co-op and creative modes. In the near future, I plan to add:
  • A.I. players in multiplayer battles
  • Observers (for streaming tournaments)
  • More than two teams & free-for-all battles
  • Some sort of boundary around the playing area to prevent people from being able to run away indefinitely
  • Limit price per-ship and not just total price per fleet
There's lots more details and plenty of other fixes and improvements in the full changelog.

Technical Implementation

You may be wondering why I've chosen to bring back multiplayer given the fact that I originally removed it because it was slowing down development too much. Wouldn't bringing back multiplayer cause all future development to become a lot slower?

Thankfully, the answer to that is mostly "no", and the reason for that is that I've taken an entirely different approach to implementing the multiplayer code.

The original implementation of the multiplayer code required that every single change in the state of the game (such as a ship firing a weapon, a ship moving a millimeter, a crew person walking a foot, or a bullet hitting an enemy) be synchronized among all players by sending packets over the internet. This was a huge problem for two very important reasons:
  1. In a game as complex as Cosmoteer with potentially dozens of ships and thousands of crew, that's a potentially huge amount data that needs to be transferred over the internet between all the players. We're talking megabytes per second of data for a large battle, which made the game really only playable on LAN or very-high-speed internet connections.
  2. The code for anything that could affect gameplay even in the slightest became way more complicated due to the need to send those aforementioned internet packets. For example, if I wanted a bullet to inflict 1000 damage on an enemy ship, I couldn't just call the TakeDamage(1000) function; I first had to construct a network packet with all the needed information and send it to all other players. This made working on gameplay code far more time-consuming that it would've been without having to send all those packets.
The new multiplayer code uses an entirely different approach that's called "deterministic lockstep". Essentially, this approach requires that two computers running the same version of the game with the same initial battle setup and same player inputs will simulate the game in exactly the same way. (Not even off by a millimeter, or else the butterfly effect will cause bigger and bigger errors until the game desyncs.) There are two big advantages to using deterministic lockstep:
  1. Only player inputs (commands issued to the ship) need to be turned into packets and sent over the internet. Everything else (physics, weapons, damage, etc...) will happen exactly the same way on every computer by virtue of them running completely deterministic game simulations. This saves massively on bandwidth, so much so that Cosmoteer now only uses a few KB of bandwidth per second.
  2. Code that affects gameplay no longer needs to be synchronized using packets sent over the internet, so long as the gameplay code can be written to be 100% deterministic. Writing deterministic gameplay code isn't very hard as long as you know what kinds of things to avoid (primarily code whose outcome could change based on framerate).
There are, however, some important disadvantages to using deterministic lockstep:
  1. The gameplay really does have to be 100% deterministic. 99% deterministic is not good enough. And non-determinism bugs can be very tricky to track down. I have written myself some pretty nice tools for debugging determinism issues, but it still took me several weeks to comb through the whole Cosmoteer codebase and convert everything to be deterministic.
  2. Games that use deterministic lockstep typically have more latency than other types of games. You may notice that when playing multiplayer Cosmoteer (and most RTS games) that there's a small delay after assigning a ship an order and before you see it actually respond. That's because it has to wait for the other computers to receive the order before it can process it. In action games like first-person-shooters, this would be a huge problem, but in slower games like Cosmoteer, it's not a big issue.
  3. Differences in how different CPUs compute floating-point (fractional) numbers can cause an otherwise 100% deterministic simulation to become only 99% deterministic, which due to the butterfly effect will ultimately lead to desyncs. In practice, this means that players running on 64-bit operating systems can't play with players on 32-bit operating systems. (Although there is a mode to force the game into 32-bits so that friends on different operating systems can play with each other.)
While these downsides are significant, none of them are deal-breaking, and are certainly preferable than the problems caused by the original way I implemented the multiplayer code.

All in all, getting multiplayer working again was a pretty huge undertaking -- one that I wasn't even sure I could pull off -- but in the end I think it has proven to be well worth it. And I'm looking forward to playing a ton of Cosmoteer multiplayer as a result!

Tuesday, September 19, 2017

Cosmoteer 0.12.12 - Balance improvements and bug fixes

Cosmoteer 0.12.12 is out! And while it's not as huge as 0.12.11 or 0.12.10, it's still got some nice stuff in it. Specifically, thanks to some great work by the community crunching some numbers, I have done a pass over all of the weapons to adjust their damage, rate of fire, and ammo usage, to make them more balanced. (Standard Cannons are no longer the clear best weapon as measured by DPS.) There's also a bunch of other improvements and bug fixes, which you can read about in the changelog.

Monday, September 11, 2017

Cosmoteer 0.12.11 - Difficulty levels, new game options, and balance changes

Cosmoteer 0.12.11 is out! And if you thought that 0.12.10 had a lot of improvements, then you will not be disappointed by 0.12.11!

The biggest and most obvious improvement can be seen when starting a new game:

When starting a new Bounty Hunter game, you are now given several options to customize your play experience...

First up, there are three difficulty levels that you can choose from: "Ensign" (easy), "Captain" (standard), and "Admiral" (hard). Each difficulty level affects what kinds of enemy ships spawn, the intelligence of their A.I., how much money you start the game with, and how much money you earn as a reward for destroying enemies. The "Captain" difficulty is the closest to the single difficulty level that's been available until now.

Second, you can also customize the size of the galaxy, which simply determines how many solar systems will be in it. "Standard" is the closest to the single size that was available until now, but you can play with a huge galaxy if you want a really long game or a small galaxy if you want a shorter experience.

And lastly, you can now choose between three different starting ships, each with its own advantages and disadvantages. Or if you don't like any of them, you can even start the game with your own design. The amount of funds you'll start the game with will depend on how expensive your starting ship is -- the more expensive it is, the fewer funds you'll start the game with.

Another big change to Bounty Hunter is the presence of enemy "fleets". Now, in some cases when a single enemy would have spawned in older versions, in 0.12.11 that single enemy will be replaced with 2 or more smaller enemies that will work together as a single fleet. This means that you'll have to design your own ship(s) to be able to combat multiple enemies at once. The chance of enemy fleets spawning depends on the difficulty level selected.

This update also has a ton of big balance changes that I hope will make ship design more strategic. These include a nerf to Point Defenses (to make them less effective versus swarms of missiles), an area-of-effect buff to missiles themselves (to make them a possible counter against parts placed directly in front of shield generators), cannons now have a random "spread" (to make them less effective at sniping specific enemy parts), and Electro-Bolts can now penetrate through shields (meaning they can drain from multiple overlapping shields).

Lastly, players complained a lot about how moving parts of ships to different locations cost money to move, and so I made a change that allows you to move a part from one location to another without losing any money. Basically, if you pick up or remove a part, you'll only get a 75% refund, but then if you place the same kind of part somewhere else, you'll only pay 75% of the base cost. Once your ship fights a battle or makes an FTL jump, you'll lose the 25% discount for any parts you've removed but not re-added and you'll have to pay the full 100% price.

There are a whole ton of other improvements and bug fixes in this update, which you can read about in the changelog.

Wednesday, August 16, 2017

Cosmoteer 0.12.10 - Formations

Cosmoteer 0.12.10 is out! And it has a pretty nice new feature: Formations!

When multiple ships are selected, a new "Formations" button will appear, and clicking on it will let you pick from one of three pre-defined formations: Line, Wedge, and Claw.

Additionally, you can create your own formations by selecting a ship, right-clicking on another ship it should follow, holding the mouse button, and dragging the mouse cursor to where the selected ship should position itself relative to the "lead" ship. You can then save the custom formation to be used later.

And by default, when you issue a command to a group of ships that aren't already in formation, the game will automatically create an "ad hoc" formation, causing the ships to stay in their same relative positions and move at the same speed.

This update has a huge number of other improvements and fixes (possibly the largest number of individual changes in the history of Cosmoteer updates), which you can read about in the detailed changelog.

Wednesday, July 26, 2017

Cosmoteer 0.12.9 - A ton of bug fixes!

These past few weeks have seen an absolutely massive increase in the number of people playing Cosmoteer! There used to be less than a hundred players per day, but now there are more than ten thousand! That's amazing!

What's not so amazing are all the bugs that people are now finding in the game. (It turns out that when ten thousand people play your game, they find all the bugs...)

And so I present to you Cosmoteer version 0.12.9, which is just chock full of fixes for many of those bugs that people have found in the past couple of weeks.

Also, the number of bugs that have been caused by new updates has convinced me that from now on I should do more testing before I release updates to everyone. To that end, I am planning, for most updates, to first release what I'm calling "unstable release candidates" that any interested players can opt-in to playing, with the understanding that these unstable versions are likely to be more buggy than the "official" stable updates. As 0.12.9 you can opt-in to unstable updates in the settings under the "Misc" tab. Hopefully this extra testing by the community will make the official updates much more stable.