Loops, Lessons and Last Pushes

Once more unto the breach! Though the weather has been dire, we’ve been keeping warm and dry (mostly), and working towards our goal of world domination! Or at least, running a somewhat successful games studio…

I did it! I found time to work on Horde! True, I had to purchase a laptop, talk to a lawyer about a contract, sort out this month’s payroll, and who knows what else, but it finally happened. Last Friday I resolved to get the win conditions working, in doing so finally completing the game loop of Horde. Want to see?

… Alright, so it still looks like a university project from that one stoner kid who does everything on the last day, but I promise you, there’s a lot more going on under the hood! I tried to record the development process to do another speed build, but it turns out OBS didn’t like my setup for automated focus switching, so there are huge swathes of time where it looks like I’m playing with the mouse for no reason. I figured without the full trio of Code, Unity, and Krita, the footage lacked a certain… interest. So it’s in the bin.

The main focus of the day was creating a delegate network to respond to the barricade being destroyed. After that was the simple matter of creating the barricade to be destroyed, the only shortfall with which was converting the obstacle code to use multiple trigger volumes, rather than just one. Something that may not be needed long term, but was vital to getting it up and running.

Background for non-techies: Let’s take the last paragraph in reverse order, as there are a couple of things to cover. In Unity, the simplest way of detecting collision events is using their built-in collision system. You add a Rigidbody to your character, which allows an object to detect a collider on an object. When this happens a function is fired off that you can override in your character to respond to this event. In my case I added code to find the health component for the obstacle, and store it to make it take damage later. Problem is, that component used to be on the same object as the collider, but now the colliders are children of the main object with the health component:

This meant that my code was unable to find the obstacle component, as it wasn’t with the collider anymore. The fix was simple; instead of just looking for the component on the object, we look for it on the parent as well.

Secondly, a delegate is essentially a stored reference to a function or collection of functions that you can call. It’s a useful way of dynamically responding to a situation. In my example I needed every zombie and human to respond to the final barricade breaking, but I don’t necessarily know which zombies are alive and active. So I add their OnBarrierBreak function to the GameManager’s barrier break delegate when they come to life, and when the barrier is broken, the GameManager calls any functions added to that delegate.

In SockMonkey news, I’ve moved onto a new project! It’s a temporary measure to help it out of the door as it’s close to release, and boy is it good to be able to tackle bugs at a decent rate again! The other project was constantly slowed by technical requirements, or by waiting for info, but with this project there’s a list of work ready to roll! It’s fun.

However, as I mentioned, it is pushing release now, so I’m volunteering to do a couple of extra days to help it through, today included. As such, you’ll have to wait till the next blog to find out about what else has been going on in the #EgoHousehold, as I’ve run out of non-workday time! Till then!

Matt out.

One thought on “Loops, Lessons and Last Pushes

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top