Day 6 – Model Mayhem
Development time: 200 minutes (running total: 1320 minutes).
I was so pleased with my crowbar experience yesterday that I set out with the same approach to find models for the enemy and scientist. I hit a few more snags than expected, but managed to put out the inevitable last-minute fires and finish with a working, not-too ugly but very quiet game.
Initially, I looked for a nice tick model to use for the enemies, but decent tick models can be pretty expensive, definitely outside my budget of $0 for this project, so I tried some alternatives and found a nice classic headcrab model by 3dregenerator that’s perfect for my purpose and falls under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License, which suits my purpose for now since this is not a commercial project, but is important to keep in mind: if I ever turn this into something I want to sell I’ll have to find an alternative model or seek permission from the creator to use it.
|Not quite the size I was aiming for.|
Despite an initial scaling issue, importing and applying the headcrab model to my enemies was straightforward. Unity’s prefabs helped a lot here, as I was able to apply the drag a new copy of the enemy prefab, apply the new model to it, make necessary adjustments to related components, then drag the modified prefab copy back into the prefab.
I also ended up locking rotation completely as the most time-efficient way to stop them hopping sideways or backwards – a down side to using a model other than a nondescript blob. A preferred solution would be to allow the enemies to turn and fall over, and have them spend some time righting themselves. While this would look better, there simply wasn’t time for something that falls in the category of extra polish.
Next was the scientists. With the clock ticking I grabbed the first reasonable scientist model one I found, from the same site and under the same license as the crowbar I found yesterday. These guys just hang around at the bottom of the screen, so I didn’t spend the time to get them posed or animated, nor even to get their textures applied properly, since it would make minimal difference to the final effect.
|Out with the old, in with the new.|
Things were still looking pretty plain, so I had a quick look around for some textures for the environment. I found a suitable tile pattern for the floor, and a different tile pattern for the walls. The license for these textures is worth noting, since there is a specific limitation on use for Open Source projects. If I decide to distribute my project files I’ll probably have to find alternatives.
These still give a fairly sterile feel, but once again time constraints mean that good-enough will do, and it’s definitely an improvement on the grey. How the scientist got into this room with no doors or windows is a mystery I leave players to puzzle over.
|Applying textures to the environment.|
I hit some issues with rotation of the scientist model, which I solved by having the scientist GameObject parented to a GameObject with the model that had appropriate rotation applied. This solved the rotation issue but led to a nasty situation where the child object could be moved away from its parent, leading to major problems with enemy attachment as they appeared to ignore the scientists, then start floating in the air at what appeared to be random positions.
|Debugging position issues. The box collider was temporarily added to better show the position of the parent GameObject.|
I chose the simplest solution to the positioning issue: turned off physics for the scientists. If they don’t move they can’t move away from the parent object. It isn’t a real solution, and some interesting effects such as falling over are lost, but it does make the game work right now, which is basically all the matters with the deadline so close.
Almost out of time, there were still 3 issues I wouldn’t want to have in when shipping. The first was enemies occasionally falling through the floor or get knocked over a wall, which made a level impossible to win as the enemy accelerated away to safety. Rather than mess with complicated collision issues, I took a used a simple hack to solve the problem: enemies that find themselves more than a small distance below the floor will immediately report that they have died, then become inactive. Problem solved.
The second remaining issue was that enemies didn’t actually move toward scientists, the would just hop straight ahead and hope they end up close enough to attach, which would often leave them jumping repeatedly into the back wall with a scientist not far away. I solved this one properly, detecting the nearest surviving scientist and leaping in an appropriate direction. It makes for a much more hectic experience as you see the enemies closing in on your final scientist.
|Approaching scientists properly.|
The final issue was that dead or zombified scientists were only identifiable by the enemy on their head, which was fine until you kill it, then they look fine again even though they aren’t. Ideally the zombified scientists would start attacking their neighbours and need to be put down, but there simply wasn’t time to get that done today, so I’ve gone with a simple texture change to keep them identifiable as standing corpses. Rather than search around for or create a new texture, I tried the enemy texture – with a bit of adjustment to the tiling it was good enough so I stuck with it.
And that’s it. Bed time on a work night and all the elements are in place, almost; I didn’t get around to adding sound, which would make a big difference at this stage.
Goal for day 7: add sounds, ship it
I noted in yesterday’s post that I could make an argument for sneaking in a little more development on Monday morning. I am now making that argument. The game really needs some sound, but rather than stay up late and feel exhausted at work tomorrow, I’m leaving it until tomorrow morning. It is still within a week since I started on Monday afternoon 🙂
I still need to get to work at a reasonable time, so all I aim to do is sample a few sounds and add them to the major game events.