Saturday, August 20, 2016

Cosmoteer 0.9.7 - Customizable Controls & More!

Yesterday I released Cosmoteer 0.9.7. There's not much super exciting in this release, but it still has a couple notable improvements worth talking about. (Don't worry, I'm hard at work on some big gameplay improvements, but I'm not ready to talk about those yet because I'm still figuring out what exactly those will be!)

Customizable Controls

I love PC games, and one of the reasons that I love PC games is because, at their best, they're very customizable. But it really bothers me when a PC game (frequently ports of console games) lack what IMHO are pretty standard PC gaming features; things like borderless window mode, support for computers with multiple monitors, support for high-resolution displays, triple-buffering, and good alt-tab handling, all of which Cosmoteer does well. But there's one standard PC gaming feature that Cosmoteer hasn't had (which I've been a bit ashamed about, as an avid PC gamer), and that is customize keyboard controls.

Until now!

Cosmoteer now lets you customize pretty much every control in the game. Want to change the hotkey for opening build mode to Shift-B? You can do that! Want to set Q as a shortcut to select the Crew's Quarters in build mode? You can do that! Want to make shift-tilde-apostrophe act as a left mouse click? Well, you're insane, but you can do that! There are currently 134 different actions that can be assigned to keyboard keys or mouse buttons, and each action can have two different key/mouse button combinations set to it.


Customizable controls are great for those of us who really like to personalize our gaming experiences, but they're also really important for making the game accessible to people who have physical disabilities; customizable controls allow them to tailor the game's controls to their own abilities so that they can still play and enjoy the game, even if the default setup doesn't work for them.

Oh, and also, by popular demand, WASD is now supported by default (in addition to the arrow keys) as a way of panning the game view. (And some existing shortcut keys got moved as a result.)

New Main Menu Design & Layout

The Main Menu has received a bit of an overhaul:


Now, the most-commonly-used options (New Game, Load Game, and Exit) are at the top of the screen, while lesser-used options are at the bottom. The primary purpose of this change is to create more room for options to be added as the game expands. I've already used this newfound room to add a "Community" button, which takes you directly to the online forum. Eventually I may add more options, such as multiplayer and mod settings.

Multi-Language Technology

Until this release, most of the text displayed by the game was written directly into the game's source code. This worked fine while the game was in the prototype stage, but it made it impossible to translate ("localize") the game into other languages. So I spent a couple days building a system to allow all of the game's text to be loaded from an external file, which can then be translated into other languages. While currently the only included language is English, it's now possible to translate the "en.txt" file into other languages and simply drop them into the "Data/Strings" directory. The game will automatically detect the additional languages and allow the player to switch between them in the Settings menu.

Here's an example of what the "en.txt" file looks like:


Thursday, July 21, 2016

Cosmoteer 0.9.6 - Part Micromanagement

I just released Cosmoteer 0.9.6, which adds the ability to micromanage individual parts, letting you give them individual targets, turn them off or back on, or tell them to hold fire.

To control the individual parts on your ship, first select your ship if it isn't already selected. Then, click on a specific part or drag a box around the parts you want to select:



The user interface in the bottom-left will change to give you some options pertaining to the parts you have selected. Most parts that consume power or ammo can be turned off, causing their crew to go perform any other jobs that need doing. And weapons can be told to "hold fire", which will prevent them from shooting unless you've given them a specific target, which you can do by right-clicking on a part of an enemy ship.

Additionally, this release also adds "control groups" like those found in most conventional RTS games. To put the selected ships into a control group, press Ctrl-F1 through Ctrl-F8, and then press F1 through F8 to select the ships in that control group. To put the selected parts into a control group, press Ctrl-0 through Ctrl-9, and then press 0 through 9 to select the parts (of the currently-selected ships) in that control group.

This release also adds some other minor but still nice improvements, such as being able to see health bars for your own parts without going into repair mode, and being able to focus the camera on specific parts (alt-click to focus on the ship, and then alt-click again to focus on a specific part).

Enjoy!

Sunday, July 10, 2016

Cosmoteer 0.9.4 - Copy & Paste

Today I released Cosmoteer 0.9.4. This is a release light on exciting new gameplay, but it still contains one very useful feature that's worth a blog post:

Copy & Paste

I'm generally very happy with how intuitive ship design has become. When I watch new players play the game, rarely do they have much trouble figuring out how to modify and expand their ship, thanks to many iterations and improvements to the user interface

But many players, myself included, found the process of designing larger ships (especially in Creative Mode) with repeated sections (possibly rotated and/or flipped) to be very tedious, since every part on the ship had to be added individually, even if a whole section of the ship was merely a copy of another section.

Let's say that you want to build a symmetrical ship with a center fuselage and mirrored wings on each side. So you start by designing the center fuselage and one of the wings. Prior to this release, you'd have to manually design the other wing as well, being very careful to exactly mirror the original wing. But now, you can use the new "copy and paste" tool, first selecting all the parts on the left wing...


... then clicking the "copy" button (ctrl-c works, too), followed by the "paste" (ctrl-v) button, which will load the copied parts as blueprints on your mouse cursor. Once in paste mode, you can choose to rotate and/or flip the blueprints before pasting them onto your ship...


... and then you simply click to add those parts to your ship, giving us the final result:


I'm very hopeful that this will make designing large, interesting ships much easier. Indeed, I can already find myself being more creative in my own ship designs, knowing that I won't have to duplicate any designs that I want to repeat elsewhere. (It's also worth noting that the copy & paste tool can be used to copy between ships as well.)

While this may seem like a pretty basic feature, it was actually a very serious technical undertaking to get this working. Ever since I (re)introduced the now-default "live design" mode, I've had code logic to determine whether adding a single part to a particular location was legal, but there was no code to determine whether adding multiple parts in arbitrary locations was legal, which is a far harder problem to solve, because some of those new parts may only be legal because of other parts that are also being added or may be illegal because of other added parts.

Wednesday, June 29, 2016

Cosmoteer 0.9.0 - Name Change, Exterior Customization, and more!

On Friday I released version 0.9.0 of StarWr--er, I mean Cosmoteer. Here's the big-ticket improvements since my last post...

New Name (version 0.9.0)

Yes, the name has changed! "StarWright" was always intended to be a temporary name. The full name is now Cosmoteer: Starship Architect & Commander. But I imagine most people will just say "Cosmoteer".


Choosing names is hard, and coming up with a name for this game was no different. (And it could still change again!) An ideal name is short, easy to remember, evocative, descriptive, and not used by another game. In my opinion, "Cosmoteer" is short, pretty easy to remember, and evocative. It's also, somewhat shockingly, not used by any existing game I could find. It's not, however, very descriptive of what you actually do in the game (build ships and fight other ships), and so that's where the Starship Architect & Commander subtitle comes in. Ideally, someone seeing the game's page or logo for the first time will read the subtitle and understand the basic premise of the game, but can still use the much shorter Cosmoteer when actually referring the game in conversation.

Performance Improvements (version 0.8.1)

I spent a good couple of weeks improving the game's overall framerate, especially when there are lots of large ships in the game at once. This involved using a performance profiler to find which functions were taking so much time and finding ways to do less CPU work in those functions. There ended up being two big areas where performance was greatly improved:

Rendering. While Cosmoteer/StarWright has never pushed the video card particularly hard, the CPU side of rendering (that is, the code that sends commands and data to the GPU) was using a considerable amount of CPU time. By finding particularly slow functions and rewriting them, I reduced the amount of time the CPU spends rendering each from from over 50% to about 20%.

Crew. Large ships can have hundreds and sometimes even more than a thousand individual crew on them. Most of these crew are constantly running around the ship carrying ammo and batteries. Each of these crew needs to decide what job to do, figure out how to get there (pathfinding), and then actually move to their destination.

The pathfinding code was already pretty well-optimized, so I didn't improve that much. But the algorithm that assigns crew to jobs was rewritten from scratch and is now both much faster and does a better job of assigning crew to all jobs on large ships.

Additionally, in previous versions of the game, every single crewperson on every ship was "updated" every single frame, moving a tiny bit towards their destination. But updating thousands of crew every frame was very expensive, and so the current version of the game only updates crew every 1/8 of a second and moves them a greater distance every update. In more practical terms, this means that, if the game is running at 60 FPS, it can update about 7-8 times as many crew as it could before! And if you're wondering why they still look silky-smooth, that's because their movement is smoothed out by the GPU.

Tutorials (version 0.8.4)

I've always known I would need some sort of in-game guide or tutorial to help players understand how to play. While I've tried to make the user interface and controls as intuitive as possible, there's frankly no way that most players will be able to figure out everything in a game this complex. I was originally planning to create the tutorials much later when the game was much closer to completion, but I got frustrated knowing that any friends of acquaintances I told to go download the game would probably not be able to figure it out without me standing over their shoulders.

So I decided to bite the bullet and create a simple tutorial system. As I was designing the system, I had a few goals in mind:
  1. It needed to be clear and descriptive. Duh.
  2. I didn't want to have to create any kind of special missions or in-game content for it, since that content takes a lot of work to make and would likely have to be thrown out and recreated multiple times as the game evolves. The tutorials needed to work with the existing game content.
  3. I wanted players to be able to go through the tutorials at their own pace or even ignore them entirely. This means that access to game features and content can't be blocked simply because the player hasn't done a tutorial. It also means that the player should be able to be able to experiment and play with what they've just learned from a tutorial without being forced to move on to the next one before they are ready.
(Notice that I had no explicit goal to make tutorials "fun", since that would likely require special content to be made for the tutorials.)

Here's a brief description and explanation of the tutorial system I came up with that I think satisfies these three conditions:

When the player loads Cosmoteer for the first time and starts a new game, they are given the standard Model-1 starting ship and full access to the user interface. In addition to that, there's a small "How to Play" section in the upper-left corner, underneath of which there are one or more tutorial topics that the player can access.


The player can completely ignore or dismiss (by clicking the X) a tutorial if they don't want to view it. But clicking on one of the topics will expand it, showing (hopefully) clear and concise instructions with some accompanying informational graphics.


The tutorial never actually asks or requires the player to do anything. It simply trusts that the player will read the tutorial and experiment with the controls until they are comfortable and ready to move on. When they are, clicking the "Got it!" button will hide the tutorial.

As players play the game, certain actions (such as defeating an enemy or opening a particular interface panel) will cause a new topic to be offered to the player to read at their leisure.

By creating a tutorial that can be experienced at the player's pace, I hope that it will adapt to the individual preferences of many kinds of players.

New Backgrounds (version 0.8.5)

The original starry blue background (which was a a public domain image from NASA) was fine for telling you that you were in space, but because it was a single static image that never changed from game to game or as you played, it was ultimately pretty boring and repetitive.

I have replaced that original background with three different styles of dynamically-generated backgrounds: Blue, Red, and Gold. These three styles add some game-to-game variety, and even within a style the background will change game-to-game.

Additionally, these backgrounds feel more alive and dynamic thanks to a subtle twinkling of stars (yes, I know that stars only appear to twinkle because of Earth's atmosphere, but I thought it looked nice). There's also a small amount of parallax as you pan the view that makes some stars and nebula appear farther away than others, giving a nice sense of depth.




A potentially nice thing about having computer-generated backgrounds is that I now have the ability to generate as much background as I need. For example, until now I haven't wanted to ever rotate the camera because then the player would have seen the edges of the background image, but now I can rotate the camera because more background can be generated as-needed.

Purchasing Additional Ships in Standard Mode (version 0.8.7)

It's always been possible to control multiple ships in Creative Mode, and while it has also always been technically possible to own multiple ships in Standard (Bounty) Mode, doing so involved getting a piece of your ship blown off and then building onto the blown-off piece. I've always intended to let the player control multiple ships at the same time, but now you can simply buy any ship whose design you've previously saved as long as you have enough money.

DirectX 11 (version 0.8.9)

StarWright used to be written on top of Microsoft DirectX 9.0c, which is now about 12 years old and no longer has great support from graphics hardware manufacturers. Indeed, some players were getting frequent crashes that I was unable to reproduce and had no way of figuring out how to fix.

I made a decision to upgrade to DirectX 11, hopeful that doing so would solve those crashes and make the game a lot more stable. Thankfully, the two weeks I spent upgrading the code to use DirectX 11 proved worthwhile, because all of those crashes have stopped.

There are a couple other improvements as well, besides the better stability:
  1. The player can now change what monitor the game runs on without restarting the application.
  2. DirectX 11 is a more efficient graphics API, and I saw framerate improvements of up to 50% compared to DirectX 9.
Note that the game doesn't actually require a DirectX 11 graphics card and should still work fine on older DirectX 9.0c+ graphics cards.

Customizable Ship Exteriors (version 0.9.0)

And lastly, we have the biggest new feature in months: Ship exterior views with aesthetic customization.

I had two big goals with this update:
  1. Make ships feel more tangible and real.
  2. Let players customize their ship's appearance.
Make ships feel more tangible and real. Until now, ships have been these strange flying floorplans in space that shoot each other. Because of this, ships didn't really feel like physical, tangible objects flying through space:


And so I added an "exterior view" that is shown by default but can be toggled on & off by the player:


Already this helps the ship feel more present, physical, and tangible, even though its appearance is rather plain. My original prototype for exteriors didn't have any windows, which made ships feel much less alive and uninteresting, so I added windows to most parts which give you glimpses of the activity going on inside.

Let players customize their ship's appearance. Adding exteriors to ships also created a great opportunity to allow players to customize those exteriors. But the question then became, in what way can players customize their ship's appearance? I wanted to give players as much control over painting their ship as they have over building their ship, but not so much control that players would feel like they have to nitpick over every pixel or that less-artistic players would be intimidated. I also wanted to make sure that players who weren't interested in going deep into appearance customization could still make cool-looking ships with just a few clicks.

So I first added the ability to set a base paint color and "wallpaper" pattern, which already provided a good amount of aesthetic options:


Players who didn't want to go deeper into customization could just pick a color and pattern they like. But for players who wanted more fine-grained control, I added what I call "decals":


Decals are small shapes, icons, letters, numbers, and symbols that the player can stamp onto their ship. There are actually two "layers" of decals (Decals 2 is on top of Decals 1), and each layer has its own color that can also be chosen by the player (all decals in a layer have the same color).

Most decals are only the size of a single tile, and many of the decals are basic shapes that can be combined into larger designs however the player wants.

With the base paint color and two decal colors, the player can pick three colors for their ship, which allows for a good but not overwhelming amount of flexibility.

Another advantage of this system is that it's easy to save and swap "paint schemes", allowing multiple ships with the same decal layout to still look radically different:


A downside of allowing this level of appearance customization is that it's very possible to make ships that just look really ugly. But I think that this downside is a small price to pay in a game that's all about player customization.

Overall, I'm quite happy with how customizable ship exteriors turned out. As always, I welcome your feedback!

Tuesday, April 12, 2016

StarWright 0.8.0 - User Interface Revamp

Yesterday I released StarWright 0.8.0. The main focus of this release was to greatly improve the user interface (or "user experience" to use the trendy modern term) for designing and constructing ships. This is the culmination of the U.I. work that started with 0.7.1 (the ship "info card" in the corner) and 0.7.2 (the separate repair and crew management U.I.s), which I will also talk about in this post.

Let's back way up first, and talk about the original U.I. for constructing ships: At the beginning of time (StarWright's lifetime, anyway), designing starships was done using a user interface that was completely separate from the gameplay:


You'd hop into the "Builder" and design your ship on a grid. When you were happy with your design and wanted to test it, you'd press the "Save & Test" button, which would switch you to a testing game environment where you could spawn enemy ships to test your ship's combat prowess against.

And then I watched a talk by Bret Victor in which he persuasively argued that user interfaces are hampered when the user makes a choice but the feedback from the user interface about that choice is delayed. I realized that StarWright (called "ShipBuilder" at the time) suffered from the same delay in that the player didn't see the effects of their design changes until they actually hit the "Save & Test" button. This was unlike most other "construction" games such as SimCity in which you can immediately see how placing a building effects things like power, water, and roads. And so I decided to merge the ship editor and gameplay environment into a new environment that I called the "Sandbox":


In this new environment you could add a part to your ship (like a cannon) and very quickly see how that new part interacts with the simulation of your ship as a whole (crew running over to operate it) and any problems that it has (crew can't get any ammo to it). (I wrote about this change more extensively in a blog post from way back in 2012.)

This was a really big improvement! Being able to watch a ship operate as it was designed really made learning the rules of the ship simulation much more intuitive, and players felt like they were making much more informed (and successful) ship design decisions.

Now let's fast forward again by a few years (I had a job, okay?) to late 2015, as I was beginning to ramp development on StarWright back up to full speed. Up to this point, there was no real challenge or economy in the game; it was just a free-form sandbox mode where you could build whatever you want. And while creative/sandbox modes in these kinds of games are great (yes, I plan on keeping the "Creative Mode" forever and ever), my ultimate vision for the game was that the player would start with a small ship, earn money by going on missions and defeating enemy ships, and expand their own ship over time.

But this caused a couple of conflicts with how ships were built:

  • Adding parts to ships needed to cost money, but the player shouldn't be forced to waste money when they accidentally place a part in the wrong location or if they change their mind halfway through an in-progress design.
  • It needed to be easy and convenient for the player to restore a partially-destroyed ship back to its intended design.
My solution to these two problems was to introduce the "Blueprint" mode, which separated a ship's design (i.e., its blueprints) from its current physical condition:


I talk more about the Blueprint mode in another blog post, but to summarize how it solved these two problems:
  • Players would make modifications to the ship's blueprints instead of the ship itself. The player could freely modify the blueprints without being charged any money. Once the player was satisfied with their design, they pressed the big "MAKE IT SO" button on the right, and -- voila! -- their ship was updated to match their blueprint design and the appropriate amount of money was subtracted from their funds. (If you're thinking, "But Walt, wasn't being able to immediately see the results of design changes a good thing? Why get rid of that?", then my only response to you is, I wish you were there to remind me of that in Nov. 2015!)
  • While a ship could take damage and have parts of it completely destroyed, its blueprints would remain unaffected. If the player wanted to repair their ship back to its intended design, they could just open up the Blueprints mode and click "MAKE IT SO" again.
The first problem I realized that blueprints had was with repairing: While it was definitely A Good Thing that players were able to easily repair their ship back to its original state, I quickly discovered that players (including me) would often do the following:
  1. Fight and defeat an enemy, taking some damage and earning some bounty money.
  2. Open up the Blueprint mode and design some awesome additions for their ship.
  3. Realize they can't afford their new awesome design, and so decide to go earn another bounty.
  4. Want to repair their ship, but realize they can't without undoing all their glorious design work!
  5. Get really angry.
And so I decided to add a "Repair" option. When this option was selected, pressing the "MAKE IT SO" button, instead of making your ship's physical condition match its blueprints, would make your ship match how it was the last time you pressed that button.

And this is how it's worked for the past few months. All problems solved?

Of course not:
  • I realized (again) that players were having a harder time designing their ships because they weren't getting immediate feedback from the game simulation on their design changes. Somehow, in my excitement to make Bounty Mode work, I had forgotten that immediate feedback was A Really Good Thing.
  • The "Repair" option next to the "MAKE IT SO" button was both confusing and limiting. Confusing because it was a very important feature that was buried as an option inside the Blueprint mode user interface despite having, literally, nothing to do with blueprints. And limiting because it was an all-or-nothing choice; there was no option to selectively repair only certain parts of your ship.
And so I embarked on my weeks-long journey to fix these two problems...

First up, I decided to dedicate a separate user interface to repairing ships; a U.I. which would be accessed by its own "Repair" button sitting co-equally right next to the "Build" button.

And so I started to work on-- screeeech, halt! ... Nevermind. Instead, I decided to first implement another U.I. feature that I'd been wanting for a while. Even though that feature wasn't really necessary to solve the above problems, its code would be very intertwined with the code for solving the above problems, and it'd take less time to implement it before solving those problems than after. This feature was the Ship Hub:


The general idea behind the Ship Hub was that it'd be the place on the screen where the player would go to interact with their ship in any way. The dark rectangular card shows a silhouette icon of the ship, it's name, and some other basic information. (And the '...' button exposes some lesser-used options that used to be in the super-awkward alt-right-click menu.) Above the informational card would be all the buttons to access various ship features, such as the ship design U.I. and, eventually, repairs and crew. The Ship Hub was released in version 0.7.1.

With the Ship Hub completed and out-of-the-way, I did, finally, implement the new repairing U.I.:


The "Repair Mode" is accessed by clicking the green wrench icon next to the Build button.

The cool thing about Repair Mode is that it shows you exactly which parts are damaged or destroyed with a red wrench icon for damaged parts or a red overlay for missing destroyed parts. Clicking on a damaged or missing part will repair that specific part. Or you can simply click the big "REPAIR ALL" button to fix everything at once!

I'm pretty happy with this new Repair Mode user interface. It's much more easily accessed and prominently displayed, and it is also much more flexible since you can, optionally, pick individual parts to be repaired. Repair Mode was released in version 0.7.2.

Also released in 0.7.2 was a little U.I. for managing your ship's crew:


This shows you your current number of crew relative to the number of crew your ship can carry. And it has three buttons for adjusting the number of crew: The first button adds one crew, the second button fills your ship up to its maximum crew capacity (or as many crew as you can afford to hire), and the third button fires one crew. That's it!

This also wasn't strictly necessary for solving those two big problems, but it was easy to implement and is nice to have. Eventually I plan on having individual crew members with different ranks and abilities, and this user interface will be fleshed out to manage them.

0.7.3 and 0.7.4 were interim bugfix released that I put out while I was working on revamping the user interface for designing ships.

With repairing ships handled via a completely separate interface, I realized that the only major design impediment to letting the player directly add and remove parts from their ship was the risk of them wasting money by making accidental mistakes or backtracking on their design. And then I realized that the only reason this was actually a problem was that removing a part didn't refund the full cost of adding that part in the first place (it refunded 75%). And so I made the decision to refund the player the full original cost when removing a part, and now the player can undo any design change they make without having wasted any money. (I had originally added the 25% "deconstruction" tax as a way to incentivize picking a design and sticking with it, but I think being able to directly modify your ship and freely experiment is worth getting rid of the tax.)

And so with that last design hurdle out-of-the-way, I split ship designing into two separate modes: Direct Edit mode and Blueprint mode...

Blueprint mode
Blueprint mode isn't much changed from how it worked these past few months: You can freely make modifications to your ship's blueprints without regard for cost, and then when you're happy with them, you press the "MAKE IT SO" button. In fact, Blueprint mode has gotten even better, because now it will let you temporarily place blueprints in illegal locations as you plan things out, so long as you fix any problems before clicking "MAKE IT SO".

Direct Edit mode
Direct Edit mode on the other hand is brand new. In this mode you directly add and remove parts to and from your ship, being charged or refunded as you go. (And behind-the-scenes, the blueprints will be kept up-to-date with your changes as well.) It's somewhat more restrictive than Blueprint mode in that you can't make any change that would put your ship into an illegal configuration. But on the flip side, you can see the immediate effects or problems of any changes you make, such as whether crew can access a room or whether a laser cannon has power.

Both modes are accessed by clicking the "Build" button in the lower-left above the ship information card. The Direct Edit mode will be shown by default (although if you prefer Blueprint mode, you can make it the default in the settings), and you can then switch to Blueprint mode by clicking the blue blueprints button that expands out from the build button.

There are some restrictions to when you can use Direct Edit mode that don't apply to Blueprint mode. In particular, you can't use Direct Edit mode during combat or while in debt. In addition, if your ship has any destroyed parts, those parts must be repaired before entering Direct Edit. And if you've made any modifications in blueprint mode, those modifications must be either committed or discarded before returning to Direct Edit mode. (If you open the ship designer and Direct Edit mode is unavailable for any reason, Blueprint mode will be shown instead.) These restrictions are necessary to make sure that you can't make any changes in Direct Edit mode that would break either the Blueprint or Repair modes.

I also took the opportunity to improve the design experience of both Direct Edit and Blueprint modes in some nice ways:
  • While in either Direct Edit or Blueprint modes, the background is dimmed and a build grid is displayed underneath your ship. This should make it easier to eyeball distances and also make it more obvious when you're in design mode instead of being able to control your ship.
  • The cost (or refund) of making any changes to your ship is shown underneath the mouse cursor.
  • The logic that determines where to automatically add doors between parts has been greatly improved, especially when the "Overwrite Existing Parts" option is turned on (as it is now by default). It will no longer remove any doors that didn't actually need to be removed, and it's much smarter and more aggressive about adding doors as new parts are placed. This is the kind of improvement that, if it works well, you won't notice it at all!
  • Adding a Crew's Quarters or Crew's Bunk in Direct Edit mode will, by default, automatically hire crew to go along with it.
  • And lots of other little improvements that you can read about in the version history.
As always, thanks for playing! And please post whatever feedback you have!

Sunday, March 20, 2016

StarWright 0.7.0 - Ion Beams!

Today I released StarWright 0.7.0!

This latest major release adds the 'Ion Beam Emitter' weapon:



The Ion Beam shoots an extremely powerful (and power-hungry) beam of ion energy that will quickly rip holes in enemy ships. It is currently the most powerful weapon in the game in terms of how much damage it can do every second, and it's particularly effective at sawing ships into pieces.

But as powerful as the Ion Beam is, it does have some key weaknesses:

  1. Unlike the other weapons currently in the game, the Ion Beam Emitter is so heavy that it can't be mounted on a turret and thus must be fixed directly to the ship's hull. This means that the ion beam can only shoot in a straight line (as determined by which way the ship is facing), and thus is very difficult to aim with any precision.
  2. Firing the ion beam uses a lot of power very fast. If you want to keep the ion beam active for more than a few seconds, you'll need a lot of power being constantly delivered to it.
  3. Unlike the other weapons, the Ion Beam Emitter is very weakly armored, making it a potential Achilles' heel through which enemy fire can reach the inside of your ship.
  4. While the Ion Beam Emitter is only two spaces wide, it is four spaces deep, three of which cannot be traveled by crew. This may force you to re-think your ship's layout and cause issues with ammo and power delivery to other systems.
Please feel free to download the game and post your feedback!

Sunday, March 6, 2016

StarWright 0.6.0 - Shields!

Today I released StarWright 0.6.0, which (in addition to a handful of other improvements) features the game's first active defensive system: the Shield Generator!


Until today, the only defensive additions you could make to your ship were the lowly armor tiles. Armor tiles are useful for protecting the innards of your ship from enemy fire (and especially from penetrating cannon rounds), but, since weapons and thrusters have to be placed on the exterior of your ship, armor was a limited use in protecting those kinds of systems.

The Shield Generator changes that, providing protection for your ship's exterior, but at a hefty cost in credits and power. As you can see in the above screenshot, the shield generator (the purple room next to the big cannon) projects a curved force field in a 90-degree arc in front of your ship. This force field blocks all incoming enemy fire attempting to pass through the arc, while allowing your own shots to pass through unimpeded.

Of course, as powerful as the shield generator is, it's not without some serious drawbacks to prevent it from being imbalanced:

  • The shield only protects against shots passing through its limited 90-degree arc, meaning that, without extra shield generators, you could be flanked from the side where the shield won't protect you.
  • While the shield blocks incoming weapons fire, it does not actually prevent enemy ships themselves from passing through. So if an enemy ship gets close enough that its weapons fire from within the shield's arc, then the shield will do nothing to protect you.
  • Shields use a lot of power while operating. Not only is there a substantial per-second power drain just to keep the shield operating, the shield also loses power quickly as it absorbs enemy fire. And once a shield generator runs out of power, its protective force field will shutdown until the generator can be fully re-powered, leaving a sizable window of opportunity for the enemy to destroy the shield generator or the other systems it was protecting. Keeping a single shield generator powered during an an enemy attack can require many crew working hard to carry power from a nearby reactor or power storage.
  • The shield generator itself is very weak and is easily destroyed once its force field shuts down. This leaves a potential weak point in the perimeter of your ship through which enemy rounds can penetrate and damage your internal systems.

One mechanic not yet implemented that I'm considering adding is heat buildup. The potential reason for this mechanic is that it's theoretically possible for a ship to have so many shields and enough crew and power to keep them active that you'll never be able to bust through; and if your ship also has impenetrable shields, that could cause a stalemate. A potential solution to this kind of stalemate is to, as the shield takes enemy fire, have it build up more and more heat until, eventually, the shield generator either deactivates or maybe even explodes.

I have not added this heat-buildup mechanic because I don't want to make the rules for shield generators unnecessarily complex and less intuitive unless I'm absolutely sure that they're needed. If you find that you're getting into these kinds of stalemates while playing, then please let me know!

As always, I encourage you to download StarWright and post your feedback!

Tuesday, February 23, 2016

StarWright 0.5.0 - Sounds!

I'm a bit ashamed to say this, but until today no version of StarWright has ever had even a single sound effect. Well it took me a lot longer than I anticipated, but sounds are finally here! (Or should I say hear?) I just released StarWright 0.5.0 which you can download, play, and hear right now!

I had told myself for the longest time that sounds were a lower priority than getting in core gameplay features. I guess that might be true to an extent, but now that I'm playing the game with sounds, I'm really regretting not adding audio months ago, because the game feels much better with sound effects. (And also some accompanying screen-shake effects, which really help to give the sounds some added punch.)

Sound Design


Sounds in StarWright can be grouped broadly into two categories: User interface sounds and gameplay sounds. User interface sounds are easy because they never vary in volume or pitch and always get played whenever the user interacts with the interface. Gameplay sounds on the other hand are much trickier to design and implement because whether they're played, their volume, and sometimes even their pitch depend on what's happening in the gameplay.

Designing gameplay sounds for any game is hard, but StarWright has proven to be by far the hardest sound design challenge I've yet tackled. There are two primary reasons for this challenge:

First, unlike most games where the area that the player can see is relatively constant, in StarWright the scale of the player's view can change dramatically as the player zooms in and out; the player's view can scale from a dozen meters across to a kilometer across or more in a second. What the player hears when zoomed in at 10 meters (the loading of ammo and beeps of controls and charging of lasers) is not what the player should hear at 100 meters (the muted, distant reverb of cannons and thrusters) nor what the player should hear at 1000 meters (the almost-empty yet strangely-beautiful resonance of space).

Many of the more-detailed gameplay sounds (such as beeping controls, loading ammo, and charging weapons) are only audible when zoomed-in near the 10-meter scale; they quickly fade out as the player zooms away. But the louder sounds (such as firing cannons, projectile impacts, and explosions) can be hard at the 100-meter scale as well. However, I wanted these louder sounds to sound more muted and distant when the player is zoomed out, and so each of these sounds is actually authored as two separate sounds; one containing higher-frequency elements that fade out quickly as the player zooms out, and one containing lower-frequency elements that fade out much more slowly. Eventually though, near the 1000-meter scale, no gameplay sounds are audible and the only sound left is the eerie sound of space itself. (Yes, I know space IRL has no sound, but in StarWright it does!)

Sounds don't just fade out as the player zooms out; they also fade out as their point-of-origin moves farther away from the center of the player's view. This works like most games in that more distant sounds are quieter (an enemy shooting you from ten meters away is a lot louder than one shooting at you from a hundred), with the added wrinkle that the distance that a sound can travel increases as the player zooms out the camera. This may seem unnatural, but if the distance didn't scale then the player would either (when zoomed in) be able to hear loudly a lot of sounds from objects they can't see or (when zoomed out) not hear sounds from objects that they can see.

The effect of fading sounds as the player zooms out while simultaneously increasing their audible distance leads to a nice "level of detail" -- that is, when zoomed in, the player hears a relatively small number of higher-pitched, high-details sounds; whereas when zoomed out, the player hears a large number of more muted, less-detailed sounds.

The other big challenge to designing sounds for StarWright is the sheer number of objects that can make sounds. While a typical side-scroller or action game might have a few dozen sound-emitting objects (on screen or near the player) at once, StarWright can have hundreds or even thousands since every weapon, thruster, projectile, explosion, and crew member could be making a sound. And the problem with so many sounds at once (aside from being computationally expensive) is that when they all combine together, too many sounds will start to be like gray noise and the individual details will get lost in the chaos; that's neither pleasant to listen to nor useful information for the player.

My solution is conceptually simple enough: limit the number of gameplay sounds of any single type that can be played at once; the theory being that there should be enough simultaneous sounds that the player won't notice when some don't play while also not having so many sounds that they just create unrecognizable noise.

Gameplay sounds in StarWright can be subdivided into two general groups: One-shot sounds and continuous sounds. One-shot sounds are those that are tied to a particular event happening in the game (such as a cannon firing or a battery being delivered) and are over within a few seconds. Continuous sounds loop indefinitely for as long as some state is true (such as while the control room is powered). The ways in which each of these two groups of sounds is limited differs significantly:

For one-shot sounds, there is a simple limit to the number of sounds of any particular type (such as the sound of the regular cannon firing) that can be played simultaneously. (Usually around 3-5 simultaneous sounds, which seems to be about the point at which players will stop noticing when some don't play.) When a one-shot sound is about to be played, the game checks how many other sounds of the same type are playing, and if the maximum number is already reached, it simply doesn't play the sound.

Continuous sounds are a bit more complicated. Any particular type of continuous sound is typically limited to only 1 playing at once. But unlike one-shot sounds, once the limit is reached, any additional continuous sounds will increase the volume of the currently-playing sound. For example, two thruster rumble sounds playing at 0.5 volume will get combined into one thruster rumble sound playing at 1.0 volume.

Sound Implementation


One of the biggest reasons that it took me so long to release 0.5.0 is that I almost completely rewrote my audio-playing code.

StarWright is based on the same codebase that I originally created for my game Tanky-Tank almost a decade ago. At the time, the best API for playing sounds on Windows was DirectSound. However, in the many years since, DirectSound has been obsoleted by the much-more-modern and well-maintained XAudio2 (and on newer systems, DirectSound is actually emulated on top of XAudio2).

When I started working on sounds for StarWright, I started with my old DirectSound-based code, but I quickly ran into some nasty race conditions that would cause crashes in the above-discussed sound-limiting code. These race conditions were going to be very difficult if not impossible to work around, and so I chose to spend a few days rewriting all of my audio code to use XAudio2 instead of DirectSound.

This rewrite went relatively smoothly, except that I found a few bugs in SharpDX, the C#-language DirectX wrapper I use. I spent at least a day tracking down and then fixing those bugs in SharpDX. (But on the bright side, I had my first-ever GitHub pull request accepted to fix those bugs!)

Screen Shake!


The greatest lesson I've learned in my years as a game developer is that every game is made better by adding screen shake!

While this may be a bit of an exaggeration, it's true enough for StarWright.

You may notice while playing that a lot of explosions and firing sounds are accompanied by a subtle (or not-so-subtle) screen shake effect. They started as kind of a silly experiment but they really added a great sense of weight and power to the louder, more explosion-y sounds. When you get hit by a Large Cannon, it feels quite impactful, and a lot of that has to do with the accompanying screen shake.

Screen shakes work a lot like sounds in the sense that they get weaker as the player zooms out or as the origin gets farther from the center of the screen. (And yes, that distance-to-center is scaled by the zoom, just like sounds.) But unlike sounds, there is only one type of screen shake, and so the magnitudes of all the currently-in-effect screen shakes get added together to determine the final amount by which the screen is actually shaking.

Saturday, January 16, 2016

StarWright 0.4.0 - Laser Blasters!

Today I released version 0.4.0 of StarWright. The big feature of this release is a new weapon: the Small Laser Blaster!

The Small Laser Blaster is an energy weapon that fires pulses of raw energy. Unlike the cannons, the laser blaster draws its power from plasma batteries instead of using ammo that has to be manufactured elsewhere. Compared to the cannons, the laser blaster deals less damage but has a higher rate of fire and is considerably more accurate. Its rounds also cannot penetrate inside enemy ships, unlike the cannons, making it more effective at destroying perimeter systems than interior systems.


Related to the addition of laser blasters, the player now starts with a new class of ship, which I dubbed the Model-1. The Model-1 is a bit smaller than the previous starting-ship, and instead of having two Regular Cannons it has two Small Laser Blasters. I made this change to reduce the number of game mechanics that the player has to learn and understand at the beginning of the game; laser blasters use no ammo, and so the player only has to understand the power mechanic instead of both the power and ammo mechanics. Also, because laser blasters are more accurate than the cannons, new players will be frustrated less by missed shots.


I have also made some major balance & pacing adjustments in this release. First of all, the damage dealt by all weapons has been greatly increased (cannons do more than twice as much damage); a change I made to increase the pace of combat, which I felt was feeling sluggish. Also, the thrusters and the Ammo Factory both use power much more rapidly, which, combined with the power-consuming new laser blasters, makes balancing power usage and providing sufficient reactors & power supplies much more important.

Go ahead and download it now! I welcome all of your feedback!

Monday, January 11, 2016

StarWright 0.3.0 - New Art!

Which much relief, I've finally released version 0.3.0 of StarWright! (Which you can download here.) This release contains a handful of balance changes and, much more exciting, completely revamped art for the ship interiors.

The new art is much more detailed and attractive than the old "art" (which was really just quick "programmer art" sketches). Most of it is even animated! While I don't consider this art to be "final" and I intend to eventually have it replaced by a professional artist, I think it's good enough for (what is currently) a free game. Even so, I welcome your feedback on it if you have any!

Here's a (rather rough) gameplay video featuring the new art:


And a handful of screenshots as well: