Making a Game – Report 2

30Jan

Sprint 2 is done, let’s see how it went.

I got halfway through the Introduction to Unity 4 course I decided to work through. So far it covers the same ground as the Quick Start to Unity courses, skipping over some points, and focusing more on others. I’ll withhold judgement until I’ve finished it, but so far I prefer this one as it covers several extra things that, such as how to more reliably line up wall sections and other items without having to count the pixels, as rotating the textures to the level a more consistent feel. I’ll be sure to finish this off over the next sprint. For some reason, the 2nd edition of The Art of Games Design still hasn’t been released on the kindle, so I’m not sure what I’m going to do about that. The current version has a number of typos and removes all the lenses that everyone raves about, which doesn’t make it a sensible purchase. I’ll have to see if there’s a better digital copy available elsewhere.

As for Unity, I made some good progress learning how to get a lot of things working. I’ve got a rough waypoint system in place, where you can click a number of points on the map to show where your character will move. There’s a circle drawn around the current waypoint to show the maximum distance your character can move, and lines to mark out the path you’ll take. Almost all the work for this involved scripting, apart from a few bits I still had to do some within Unity to create the movement circle and waypoint marker Game Objects so they could be referenced by the scripts. Unfortunately this is where using Unity gets a bit annoying…

The movement circle for instance. What I wanted was a single line drawn in a circle. It turns out that this isn’t something you do in Unity, the in-game options only allow you to create a few predefined shapes. That itself isn’t a problem since Unity isn’t 3D modelling software, it’s just for creating the game. Unfortunately using a textured 3D model of a circle results in the line getting thicker or thinner depending on how stretched out it is. There is an option to draw an outline, but for some reason this is only visible from certain angles. In the end I had to create a very squashed invisible sphere, download a custom shader and use that to create the outline. It’s not perfectly round, but that’s something I can fix when I get around to learning some 3D modelling basics in something like Blender.

Also lines. What’s so tricky about drawing a few lines? Apparently everything… There’s only 2 ways to do this within Unity, the most “reliable” is to create a series of long, thin rectangles and line them up the way you want. That’s pretty horrible, and causes problems with Unity when you’re constantly creating/destroying objects at runtime. The other solution is to use a Line Renderer, which sounds like it would be ideal but unfortunately suffers a few issues where parts of it shrink and grow at different points, and from some angles are completely invisible. There’s a few solutions which neaten them up, but none are particularly ideal. The goto solution that most people have is to pay $30 for an external library which solves this problem entirely, but that’s something I’m willing to do at this point. I’ve read that I can put together some scripts to make a number of GL calls directly, but that sounds like a lot of work just to fix a few lines at this point. It’s a problem I’ll want to come back to later, but for now it’s 90% done, and there’s not much to be gained by spending another sprint on it.

For the next sprint I’d like to finish off the last few movement issues that are outstanding. Right now your character can move wherever you can click, even through solid objects, so that needs fixing. I also want to be able to have multiple characters on-screen at once so you can choose which one you want to move, then a finalise button to make the moves happen. Moving up/down layers isn’t something I’ve quite figured out yet either. I’m thinking of having certain hotspots such as ladders, which you can click on to take you up a level, but I’m not completely set on that yet. If necessary I’ll leave that one until later and focus on some basic combat mechanics. I’ll post another update in another 2 weeks to talk about how this goes.