Level Editor Get, and the Sad Loss of our Pet

It’s blog week! I remembered! I promise! Ok I’m writing this at 11am on Friday, and it needs to be out to you guys in about an hour and a half. I should probably get on with telling you about the last fortnight…

So my focus for the last couple of weeks has been on getting a level editor into the game. I’ve decided that I need to make creating levels as streamlined a process as possible for a couple of reasons. The first and most important, it reduces the risk of human error. By controlling how assets are introduced to the level, I can make sure that there’s never going to be an issue of an asset being in the wrong place.

The best example here would be differently themed objects. If I accidentally added a themed version of an obstacle instead of the generic one that I convert at runtime, I could end up in a situation where I have my assets mixed. By using a level editor instead, I’ll be able to guarantee that the correct version of the asset is used.

The other big advantage is that the easier it is to do, the more likely it is I’ll do it! Simply put, if making levels is time consuming, I won’t enjoy it, and will likely not make as many levels. If it’s simple to add or edit a level, then there’s likely going to be much more content. And as an exercise in forward thinking, it also makes a lot of sense if I ever hire a designer. Explaining a highly simplified level editor, rather than explaining the hierarchy of the game assets, what needs to be pulled from where, how to save, how to name the levels etc. is going to be much easier and should get anyone new to the project working much faster.

So, how far did I get? Well, I got a system up and running that allows me to create a new level, based on a prefab, and if it’s not already present in the scene, will also create a template grid, to give visibility of where the edge of the screen will be and whatnot. This is also instanced from a prefab. Did I explain what prefabs are already? Alright, to be safe:

Background for non-techies: So a prefab is a Unity concept whereby you can save chunks of the game into little packages that you can then add in other places as and when you like. Think of it as a convenient way of bundling an entire thing together into one neat box. For example, a table might have four legs, a top, and a tablecloth. Rather than having to add four legs, a top and a tablecloth everywhere we want a table, we can take those items, and store them together as a prefab. We then only need to add that table prefab instead of each of the six items, wherever we want a table.

It’s a really powerful tool, and you can even edit the prefab directly, and those changes will be applied anywhere you used it too. So if you decide every table needs a candle in the centre, you add it to the prefab and boom! Every table has a candle. You can also modify single instances of the prefab, if you only want to change it in one place, for example, if a candle is knocked over on one table.

I’ve also written some of the code for loading and saving the prefab, but that isn’t fully operational yet. It looks pretty mundane at the moment, but here it is:

The “Level” is the cross, and the “Guidelines” the zombie, but as a proof of concept, it works!

As for the rest of the week, well, SockMonkey have been keeping me very busy, I’ve had a lot to catch up with after the loss of work and equipment courtesy of our overly-zealous spring cleaners. It has been all I can do to keep on top of recovery, and the additional requests coming from the guys who’s project I’m working on! Sadly, as ever I cannot talk specifics, but hoo boy, has it been hectic.

And finally, I’m going to end with a bit of sad news. Unfortunately we lost our little Monster last week. Those who have followed the blog will know I rescued the little guy from death’s door last March, gave him a palace to live in in June and on Saturday, our hamster buddy finally succumbed to old age. We might have only known him for a year, and to many he might be “just a hamster”, but in the year we spent with him, we grew to love him dearly. Never have I known a hamster so eager to say hello! He was sociable, friendly, and always cheered us up if we were down. He got to live to a ripe old age, we think between 3 and 4 years old, which is not bad going given his ordeals before we rescued him! We miss him very much.

And on that, rather more sombre note, I will see you all in two weeks.
Matt out.

10 thoughts on “Level Editor Get, and the Sad Loss of our Pet

Leave a Reply

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

Back to top