shawn's blog

Rebuilding and Custom Editors

Posted in Tone Def, Unity by Shawn on February 24, 2012

So, the web build of Tone Def has come and gone. I did receive a bit of feedback, which I found useful, and have implemented/will plan to implement in the new and improved desktop build. It doesn’t seem like too many people took interest in it, which is okay. I have future plans for a desktop build, and hopefully it does better. But in order for this to be better, I need the code behind the game to improve.

There’s a lot that I’ve been doing behind the scenes. A lot of code has been deleted, and a lot of odd work has taken place. A god portion was me experimenting with different implementations, looking for better places to put code, and other places to delete code that is just plain foolish…and there appears to be a lot of that unfortunately.

One of the (more important) elements that was reworked was the Enemy Spawner. Originally, the spawner managed spawning in a ‘step’ format. Now, however, the enemy spawner is managed by a curve. The rate of enemy’s spawning continues to drop until the it reaches the minimum that I set for that level. The harder levels with have a lower wait time until an enemy spawns.

Enemy Spawner Collapsed

This is the new enemy spawner. This spawner has everything collapsed, and right now, spawning is disabled. It’ll be disabled on particular levels, which are puzzle levels, or levels where players are just allowed to mess around. Here is the spawner with spawning enabled:

The Spawer, and some of its information

The six slots are reserved for the different types of enemies that will be spawning for a particular level. Each slot is hooked up to a percentage, and the bot in the first slot has the highest percentage of being spawned, with the percentage lowering as you move down in slots. This isn’t finalized, as I really want to change the percentage controls, and make them easier to adjust on the fly.

Underneath the “Spawning Management” section, you can see the curve and the “Max Spawn Amount”. The max spawn amount caps the number of enemies that can be spawned at one point in time. This first worked as ‘damage control’, keeping the game from getting out of hand, but it would also assist in the learning curve for players who are potentially having a difficult time with the game. Finally, you can see the curve, which is an animation curve. Instead of moving an object with this curve, I’m evaluating the curve at certain points to handle the spawning. This way, the spawning is more gradual, as opposed to staged. It’s also better suited to allow me to have ‘burst’, akin to Plants vs Zombies, my main source of inspiration to for this game actually. (Imagine a zombie from that game showed up in mine as an enemy…….that’d be…..interesting……)

I also have two aptly named Conductors for the game. One conductor controls the level, and the other controls the musical aspects.

Do conductors tell them when to play?

Now, this custom inspector wasn’t actually necessary. However, it does make things easier to look at, and easier to organize. I can hide the Main Beat Lanes, so I’m not looking at everything all at once. Also, I have a set of lanes that play on the ‘ands’. Currently, it’s disabled (the Enable OffBeat toggle), but when it’s enabled, you’ll see another set of lanes, along with the parameter which ask how many lanes are valid. The number of lanes will be adjusted when there’s a level that has a different Time Signature. My latest build only has a 4/4 songs, but I have a few ideas for some 3/4 (and even 5/4) songs.

The Level conductor has a number of things behind scenes, but at face value, it has this:

A few things in a 'normal' stage

It’s pretty simple, and still in the works. However, changing the type of stage will also change the variables exposed:

Less is More?

There will eventually be more added, but this is what is available for now.

Here’s a fun one! The Note Selector:

Choosing Notes

The note selector holds the notes that a specific instrument will play. If the is more than one sound present, the instrument will cycle from the sound in the first slot down to the last slot. The plus/minus buttons help you quickly add or remove a slot. This was actually the first custom inspector script I wound up writing, with the help of many different online resources. While there’s a lot of documentation this stuff, sometimes, I feel as if the docs could use a bit more in the example field. Still, they are very useful.

Now, the actual first editor script I wrote and used frequently one to manage the save data. There are a number of things that I am saving via PlayerPrefs, and I needed a simple way to access them. This is another script in progress, but as of now, this is all I need for this game:

Saving some Prefs

This allows me to search for some save data, as well as set values for other pieces of information. The two larger buttons do what they say, and delete either the Player Pref in the name field, or delete all the prefs. And, no worries, there are layers of warnings before it’s actually done, it’s not a one click and “Oh jeeze, I’ve accidentally deleted everything again…”. This is actually a less complex version of the one I have set for Mr. Condyle’s Escape. That one showed the pref name/value underneath all the buttons, which was great for that type of game. There are a number of collectibles in the game, and I would hate to need to beat the game every time I want to actually a specific number of collectibles, or unlock a level. I also didn’t want to constantly update code and write “Set level x unlocked!”. With my luck, I’d forget to lock the level, and a certain level would be unlocked from the get go, causing some sort of problem somewhere.

This allows me to avoid these problems, letting me choose the value for the save data, delete individual pieces of information, and so on and so forth. Very handy!

But that’s it for now. I’m actually quite tired, and need to get up for work in the morning. Then get back home and work more on setting up my project. Maybe, in the future, and if someone really wants to know somethings, I’ll actually dive into the code of how some of this is done. However, this is really just meant to show some of the things I’ve been doing this past week. Everything but the Player Pref Window was done this past week in between day job and sleeping. Speaking of sleep…

Tagged with: , , ,

Comments Off on Rebuilding and Custom Editors

One week of work

Posted in OriGamInc, Tone Def by Shawn on February 14, 2012

So, I wrote this up one week after I started working on Tone Def, which was called Music Defense at the time. Yes, I’m out of things to say at the moment, so I’m sharing something ‘private’, I guess.

The idea for Music Defense began as a tower defense game where you lay down instruments on the grid spots to defend your base from the enemies. As of now, the target is unknown, as are the enemies.

The project began on November 30th, with a new take on how to pull this off. This project was actually attempted a few months ago, but I had poorly executed how to do things. This time, the process when much more smoothly. The Conductor was on of the first really important pieces that was added, as the conductor keeps track of when a specific lane should play. The next things added were the Beat Lanes/Grid spots. The grid spots are the areas where the instruments would be placed down, while the beat lanes housed the Grid Spots. Other important assets added were the enemy and the spawners for enemies.

A large amount of task were made for Music Defense, much more quickly than for CloneBot. Some of them, however, are for specific instruments, rather than framework details, which makes the task list look much longer than it should be. 14 task are confirmed closed at this point. There are a few that are still opened, and need to be reviewed, as some should be closed/updated.

Again, the premise of this is to lay down an instrument that plays sound when the conductor tells it to play. Different instruments have different stat points, some have more health, than strength, others vice-versa. Using in instrument cost notes (the ‘currency’ to buy things). You also have an ‘off beat’ lane, which plays between the main beat lanes. The exact use for off beat lanes have yet to be determined. However, they will add sound to the game, making the music sound a bit fuller.

This is also one support lane, which is a vertical lane on the right side of the game screen. This lane is for support instruments only. Support instruments degrade over time, as opposed to normal instruments that lose strength as an enemy damages them. Support Instruments fire some sort of ammo which can either hurt an enemy, or heal an instrument after it comes into contact with it.

Instruments are also susceptible to bonuses which come in the form of synching or duplication. Duplication bonuses are easier to acquire. When you lay down multiple the same instrument within a lane, they receive a duplication bonus, and receive either a strength increase or a health increase. Synching bonuses are a bit harder to get. There are some instruments that play multiple sounds each time they are played, cycling through a set number, maximum being 4. This means that there is a chance that if you lay down two of the same instrument that cycle notes on the same line, their notes may or may not match. If you manage to have their notes match, you then receive a music synch bonus, again raising their health or strength.

However, there are overloads as well. Overloads happen when you lay down too many of the same instruments on a line. Each instrument has an overload limit. For example, let’s say you have a bass drum, with an overload limit of 4. You begin the game, and lay down two bass drums, receiving a duplication bonus. You then lay down another one, increasing your duplication bonus. However, you then lay down a 4th instrument in the lane. You have now overloaded the lane with Bass Drums. Each instrument then loses strength or health, falling close to or below the beginning health/strength.

Bonuses/overloading does a few things to ‘guide’ the player. If a player wanted to, they could simply lay down a large number of the same note, possibly a large number of bass drums. This not only ruins the musical aesthetics of the game, but it somewhat defeats the purpose. However, it’s possible that this would happen. The overloads stop this from happening. The duplication/synching bonuses encourage players to use the same instrument to a point where it the music sounds. Synching bonuses more so, mostly because it provides bonuses if the player matches notes. This way, you don’t get a plethora of awkward notes together, even though I am working to stop that from happening during music composition time.

This is the gist of Music Defense at this point in time. I will continue work with this, as it did not take too long to put together a basic framework for important assets.

That’s all for now. This will probably help explain why I did certain things, or allow more of an insight to my brain, if anyone is interested. The game still hasn’t been uploaded online for the world yet, but that’s due to a few issues out of my control right now.

Comments Off on One week of work

More days without progress….

Posted in OriGamInc, Tone Def by Shawn on February 7, 2012

Why? Well, because my laptop wasn’t really fixed properly. It’s upsetting, but it happens.

What it does is give me some time to work/draw/plan things for this game, and future games.

What will actually wind up happening is that I’ll play an excess amount of video games. I can do both at the same time, but odds are I’d wind up playing more than thinking.

In regards to Tone Def, I’m almost done with the web build. After I’m done with the build, I do plan to continue supporting it. This means updating the game with different songs as time goes by, and of course, fixing any sort of bugs/problems. After initial work on this is finished, I will start working on a desktop build for the game. What for? To submit to IndieCade! I plan to try and submit both MCE and Tone Def to the upcoming IndieCade. The deadlines aren’t for a while, but the earlier I submit, the more relaxed I’ll be. One way or another, I do plan to head over there for the event (I need to save money!), but it’d be nicer if I could go over and actually present something, rather than just play other games. If I manage to get a lot of work done for these two games, I could work on that other project (MossHawk), and even submit that to IndieCade. Firs things first. I need to finish this build of ToneDef.

But that’s it for now. I do hope to have my laptop back by Wednesday. I do feel a bit empty during the days I do not work on my games.

Tagged with: ,

Comments Off on More days without progress….