C.W.I.S Devlog #6 | WATER!

Welcome to C.W.I.S, a tactical shooter where you controls the weapons systems of a destroyer that was constantly under missile attack. Previously the devlog for this game have been in a video format on my personal YouTube channel. If you want to see these early devlogs they can be viewed below:

I have since made a blog post for each with a little text and the video that came out with that devlog. I also transferred the Project Tilly devlogs from IndieDB to here as well so there is just a lot more content on the blog to give it some footprint on the site, so feel free to check those out as I do play to go back to that project in the future.

What’s new!

Water shader

By far one of the worst bits of the last few months has been choosing a good water shader. Now I’m no artist so I couldn’t make my own & I have 0 budget so I couldn’t just buy one. So I had to go off the free options on the asset store & GitHub to find something to use for this project. While a lot of the shaders would be great of other games where the player is at the level or more or less the level of the water. However in a top-down view there is the common problem with the tiling texture or effects with the shaders that the user can easily notice.

After trying upwards of 50 shaders and/or effects I finally decided to stick with one of the more customisable, that being the stylized water for URP:

https://assetstore.unity.com/packages/vfx/shaders/stylized-water-for-urp-162025

https://carter.games/wp-content/uploads/2022/09/image-6.png

A screenshot of the arcade scene in C.W.I.S with the new water shader

The shader still isn’t perfect and I would certainly prefer a more random tiling one, but it is better than the old shader I used in the jam version of the game which was much worse than this option in my opinion.

Missile Launchers

I’ve spent a fair bit of time on these launchers and still have more time to spend on them before they are completely working as intended. I did however spend a fair bit of time getting them up to scratch with fixed to the actual prefabs so they can be correctly reset when reaching their target.

Previously the missiles would throw an error on their reset due to a coroutine still running on them when the object is disabled. The routine was the one that managed the missiles pathing lifetime and would not quite reach the end due to the physics collision detecting the hit between both the player missile & the incoming missile.

On top of this I’ve added the actual launch sequence of the missile so when you fire a missile it takes a little longer to get into the air. This is done by having the hatch of the missile tube actually open before the missile fires. Once it has opened an event fires that tells the missile to spawn as it did beforehand so the rest is just as it was before. Though I did fix an issue where only 3-4 tubes were been used to launch missiles due to a little mistake on my part with a boolean value not updating correctly.

Below is a little video of the new launcher in action:

No more five-inch gun?

For the purposes of the arcade build I’ve decided to turn off the five-inch gun as its usage is not needed in the basic missile defence scenario. All the code is still there and all, its just had its script disabled in the scene so the player can’t select it when playing. Instead the player start on the forward C.I.W.S instead which is more practical. Down the line the five inch or the main gun would be used to target surface target at a defined range which will have more use in the campaign, missions or PVP/PVE combat.

Supply Drops

In the arcade build supply drops where just crates that came by every now and then, when they hit the mid point of the ship you would get some ammo and a chance to get some health back. I do plan to add a ship health regen setup to the game, but it won’t be through supply crates. Its more likely the ship will heal over time if its not been hit for x amount of seconds with some UI to help indicate the change of state. The new setup has you calling in a supply drop via the communications array which starts a timer in the top left. When that timer completes a supply drop drops down onto the heli-pad section of the ship and when it reaches the ship the user gets ammo for their weapons systems at random amounts.

The visuals for this still needs a little work as they are currently just primitives and it shows. So more on that soon. I’m also considering possibly adding a few upgrades to the communications array to speed up the time it takes for a drop to arrive & the quantity of the ammo provided. But these are yet to be implemented.

Controls Menu

Another minor change since the last update is a new panel & button in the game menu showing the controls for the game. There is controller support planned as its super easy to add that in the future, but that’ll be after the arcade build. These controls are also shown on the pause menu of the game for convivence.

Closing notes

That wraps up this devlog/update, these written logs will be the main form of updates from here on out instead of videos. Its a lot quicker for me to type stuff out as the videos took almost a day and a half to make so its a much better use of my time. The next written log will be around a month from now or sooner if there is a lot to show off. Feel free to comment below this post if you have an questions or feedback to give and I’ll speak to y’all again soon!

C# Actions

So, you’ve probably done this at-least once as a developer, you’ve got a value or element of your game that needs regularly checking and updating, like; player health, score or if a level has ended. Now you can just check for these in update which in small games is fine, but you’ll find you are calling this code way more than you really need to, if only there was a way to eliminate that xD.

Introducing Actions

This is where actions come into play. They work like events such as the OnClick on a Unity UI button. When you invoke them they run, otherwise to stay as disabled. What makes them handy, like how you can have multiple methods run at once of a button is that you can add and remove methods or delegations on the fly as well as listen for actions being invoked from other scripts. Here’s the four main steps to using actions in you code:

  • Initialise the action, you can pass varied parameters into the action to pass through information you may need to use in the actions subscribers.
// Its recommended to make the action null be default, 
// as you can check for this when you call the action. 
public Action<float, float> OnHealthChange = null;
  • Subscribe our method or delegate our code to run at this point. Methods are easier to manage and are generally recommended, but if you just need to do a quick value change a delegate will work too. Its normally best to do this when the action has no parameters though. It is important to note that your method or delegation must have the same parameters defined in the initialisation.
// Subscribing to the action 
OnHealthChange += UpdateHealthBar;
// The method setup, note the parameters are the same as the action init
private void UpdateHealthBar(float health, float maxHealth)
  • Invoke the action, doing this will call all the methods subscribed to the action.
// Invoking the action... (NOTE: that we call with a null check ("?.") 
// So it doesn't invoke if nothing is subscribed to it. 
OnHealthChange?.Invoke();
  • Un-Subscribe from the action to avoid null exception errors. Recommended to run this on OnDisable or similar to avoid errors.
// Un-subscribes from the action 
OnHealthChange -= UpdateHealthBar;

Usage Example

Here’s an example which is what I used to learn how to use actions.

Health.cs (on a player)

using System;
using UnityEngine;
public class Health : MonoBehaviuor
{
	[SerialzeField] private float maxHealth = 10f;
	private float currentHealth = 10f;
	// init actions
	public Action <float, float> OnHealthChange = null;
	public Action OnNoHealth = null;
	
	public void TakeDamage(float dmg)
	{
		currentHealth -= dmg;
		// Invoking action....
		OnHealthChange?.Invoke(currentHealth, maxHealth);
		if (currentHealth <= 0)
			OnNoHealth?.Invoke();
	}
}

Healthbar.cs (on the health bar UI for the player)

using System;
using UnityEngine;
public class HealthBar : Monobehaviour
{
	[SerialzeField] private Image hpImage;
	
	private Health health;
	private void OnDisable()
	{
		// Un-subscribing from action...
		health.OnHealthChange -= UpdateHPBar;
	}
	private void Start()
	{
		// subscribing to action
		health.OnHealthChange += UpdateHPBar;
		hpSlider = GetComponent<Slider>();
	}
	// Method that has subscribed to the OnHealthChange method
       // Note: It has the same parameters!
	private void UpdateHPBar(float currentHealth, float maxHealth)
	{
		hpSlider.fillAmount = currentHealth / maxHealth;
	}
}

C.W.I.S Project Update

So this would be the day for the next monthly devlog, but I’m a bit behind with things this month with some life stuff taking about half of the month and then not getting as much done as I would like in the other half.

Due to this I’ve decided to hold off on the next video until I’m happy with the progress I’ve made to show it off. To fill the void left by this I’m showing off the new menu layout seen above. The old one can be seen below for comparison:

old_menu.png

With the new layout I’ve also updated the radar art drastically as the old art I have was a bit low res as it was originally for the in-game radar only. But now it’s in the menu it needed to be a better quality.

Also during this last month, the logo for the brand “Carter Games” has been updated after like 2-3 years of the old logo xD, you can see the difference below. I’m pretty proud of how the logo turned out given I have like no photoshop or graphic design skills what so ever:

new_branding.png

If you’re unsure what’s going on in the logo, it’s a cart-wheel mixed with a controller xD

Build Version 1.1.0 Update

What is Build Versions?

Build Versions is a tool I made back in 2021 to fix an issue I was having far too often. This being that when it came to making builds to release or even test, I would forget to increment the version number of the game in the player settings. I got so annoyed by it that I looked into if there were any tools to automate this. While I found a few build based tools, most of them were geared to being a custom build manager or something, while I personally just wanted a simple build number incrementor. So I made one

How it works

Unity has some interfaces that tie into the build process such as IPostprocessBuildWithReport which can be used to perform logic when a build is made. From there I add my own logic to update the numbers I need as well as a scriptable object holding some extra data.

What changed in the latest update?

Slowly over the last few months I’ve been kinda sitting on the update due to figuring out how I was going to improve the documentation setup. As before it was a little jank. But I also changed a lot of the backend logic for the tool so the logic that updates on build could be modular, improved the settings for the tool to be in the project settings window instead of a custom editor window & better formatted logs.

Where can I get it?

Like all my tools I offer this for FREE! You get get it on the Unity Asset Store, Itchio or Github, links below:

C.W.I.S Devlog #5 | Leaderboards & Build?

Welcome back to C.W.I.S, now with leaderboard, scoring & less bugs… well possibly the same amount of bugs, just in different places xD

What’s New!

  • A new blur panel setup to better focus the user on the foreground elements.
  • A working reload system for the main gun & missile launchers!
  • An improved upgrades panel setup, with upgrade costs & lockable upgrades.
  • A scoring system & local leaderboard using the Carter Games Leaderboard Manager asset, with a few adjustments.
  • Early build mostly working minus a few bugs, aiming for public build by September xD

The Video

Admittedly not a good at some of the others this time around, but I’m still new to this whole YT thing, so hopefully I’ll get it right next month xD

None the less here is it!