Dev Log

Jeremy Wolf Jeremy Wolf

Procedural Spaceship Generator

I find myself short these days. Short on patience. Short on time. Short on words. Just short… So here’s a short post and a quick video.

All the same I’ve been finding an hour here and 30 minutes there to slowly make more progress on my game. Yes this is the new game. The next game. If you missed it, you can read all about why I had to shelve my last game. This game is strongly influenced and inspired by the class BBS game Trade Wars 2002. I’ve been coding up a procedurally generated universe, fleshing out an inventory system and scripting the backbone of an economy.

With those pieces working, I sat back and looked at what I had. It’s not bad. It’s rough. But doable. The problem is still that to get something “shippable” or at least in the hands of testers and there’s a lot of content to create. So I had an idea…

What if I could produce a mini-game? What if I could take chunk of the big game, polish it, refine it and publish that? This would cut the immediate project size down significantly, result in quicker feedback from players and give me a second published game. So that’s what I’m doing.

The “game loop” will consist of building a ship, battling an AI ship, earn/collecting a reward and then starting the process over again. It’s simple but seems like it has potential.

I had the basics of a combat system already working so the next big piece was to develop a procedural generation script that could produce the AI ships. And that’s what I’ve been working on the last few weeks. I put together a short video showing the work.

Hope you enjoy and I’d love to hear your thoughts. You can play with the ship generator here - it’s an html build nothing to download just run it in your browser.


Read More
Jeremy Wolf Jeremy Wolf

Implementing SFX in Unity

Every year I have to work and work to convince my students to add SFX them to their games. They resist and see it as a waste of time. They value graphics over audio. But when they finally add the SFX - it's magic! The "plunk" of an object being placed or the "click" of a button adds so much to the game!

Implementing SFX can be a messy process. I'm pretty confident that I DO NOT have the best solution, but it's a better solution that I had a few years ago. So I thought I'd toss out some info out to the winds of the interwebs on my approach to adding SFX within Unity.

SFX options in the Unity Inspector

I'm not procedurally generating sounds or anything half that interesting. I'm just playing clips but doing so with some variation in the clip, volume, and pitch. I do this with a custom class (not a monobehavior) that allows easy and quick adjustments in the Unity inspector. 

The image of the inspector is from my current project and uses Odin Inspector - which is why the list looks different.

The code for the clip options is pretty sort and sweet. I've added two functions to clean up the implementation for when a clip needs to be played.

SFX options code.

The "PlaySFX" function has two parameters, the first is the AudioSource of where the clip will be played and the second is a boolean that prevents or allows the current clip (if any) to end and the new clip to be played. UI sounds interrupting other UI sounds is generally okay but sounds such as explosions getting clipped by another explosion tends to breaks player immersion.

In some cases, I have created or cloned AudioSources to allow as many concurrent SFX as needed - but that's a whole other post. It's actually not too hard either.

Defining SFX classes

Within the function the volume and pitch are both varied randomly. So no two button clicks (or other SFX) are identical, but if the variation is kept small they also sound similar avoiding possible confusion by the user that a new event has occurred. 

New instances of the SFX can then be created for different actions. I keep mine private and call them via event, but allowing them to be public could work as well.

Calling the "PlaySFX" function for different actions.

Next, I create a private function for each type of action.  This private function will get called by an event. 

Each of these functions can then subscribe to events that are called on other objects.

While this does require a bit more coding, it makes for a very clean and non-spaghetti like code base.

You can check out my full script on PasteBin.

Subscribing and Unsubscribing functions

Read More
Jeremy Wolf Jeremy Wolf

Prototyping Something New

After the demise of my previous project I've taken some time off from active game development. I've been doing a little soul searching, a little research and as much learning as I can squeeze into an already packed schedule. 

Feeling like I had an idea worth exploring, I've spent the last few weeks working to prototype a new game idea. It's an idea that I've had bouncing around for a few years and is heavily inspired by one of the first online games I ever played. And no. This new game will not have multiplayer - I've learned that lesson (I hope).

With my last project I was nearly a year into it and still didn't have a real working prototype - I had built prototypes of systems but that was it. So this time around I was determined to do things differently. I wanted something that I could prototype in a few weeks, maybe a couple months at most (real life can get in the way). 

Despite looking like a folded protein structure, it's a bunch of star systems with mapped out connections.

Despite looking like a folded protein structure, it's a bunch of star systems with mapped out connections.

So... Where is it at now?

In a about ten days, I was able to code the "procedural" generation of the world. It's not perfect, but it works. And that's all a prototype needs.

A few days later I had the player's navigation working along with some ugly but functional and relevant UI. 

The project was checking lots of boxes and doing so quickly.

The game will be a "space" game. You know planets, stars, laser beams and plenty of spaceships flying around.

So the next chunk I wanted to implement was shipbuilding. I want the player to customize their ship and design it around their desired play style.  A few days later while sticking to primitive shapes (programmer art) I had the basic code functioning. Even spent some time working on visual feedback...

Prototype of the ship building function - the camera auto centers over center of mass.

That was a few hours work that didn't move the prototype forward. Oops.

I'm pretty happy with the results. It's simple and not as smooth and polished as it needs to be, but it works. Again it's everything the prototype needs (and just a few bits more). 

With the ship building complete I had two major features that were going to need work. The game is going to be based on trading and combat (shocking I know). So I needed an inventory and shop system. 

Nothing much to see with the shop system and it's probably the part of the prototype that I'm the least happy with. But! It works. I need to revisit it, to make it "feel" good as it will likely be a central part of many player's experiences. That will come later in the production.

As much as I dreamt of making a "violence free" game with my last project, I can't imagine this game without some lasers, a healthy dose of explosions and maybe a few space pirates. Which means the last piece to build was a combat system.

I know. I know. It's a masterpiece!

I know. I know. It's a masterpiece!

The combat will be very stylized. You're won't be piloting your ship dodging asteroids or incoming missiles. Rather you'll be creating a strategy to counter a single opposing ship. You'll be able to pause the game, think, plan, act and then watch it unfold. And yes, the system is pretty heavily inspired by a  popular rogue-like minus the parts that I didn't like and hopefully with at least a few new ideas. 

Even for a prototype, the beginnings were pretty rough.

Once the code was functional I wanted maybe even needed to make this part of the game "feel" good. If I can't make this feel good, then I may need to re-evaluate the design?

I spent a few hours on the UI, a bit on the visuals and a few more on some basic AI. The results? They aren't horrible.

Clearly, there is more work to be done. 

So is this my new game? 

Maybe it is. Maybe it's not. But I'm getting close to committing.  

Read More

Older Posts