With the weather being so nice outside last weekend, it was really hard to get psyched about sitting in front of the computer all weekend to make a game. However, I’ve participated in every Ludum Dare and mini-Ludum Dare since #26, so I felt compelled to make something even if it was really simple. I really didn’t have any good ideas for “Beneath the Surface”, so I decided to create a treasure hunting game. For my LD29 warmup, I made a simple MineSweeper game, so I thought it would be neat to expand on the basic concepts of that game. Instead of avoiding mines, you are trying to find buried treasure in a three dimensional world.
At first I just got the hidden treasure pieces to randomly populate on the game world, which are the items you must find. The digging unit was the first that I created, which I renamed “excavator” since it sounds fancier. He just uncovers whatever is hidden at his location. However, randomly adding excavators to the map really didn’t seem challenging.
Then I got the idea to allow the player to “ping” the map to get a general idea of the treasure location. This reminded me of the news stories about crews using scanning devices to find the missing Malaysian airplane off the coast of Australia. I originally wanted to have a heat map showing the pinged locations and the amount of treasure in the area. However, I had to settle for just colored circle areas on the ground representing the amount of treasure in the area. It was fitting that this is very similar to the job that an archaeological surveyor does, so I created a “surveyor” unit specifically for this job.
Finally, an excavator only knows about digging, and only a true expert would know the value of a lost treasure. Therefore, I created the “appraiser” unit to determine the value of each discovered treasure. The inspiration of this unit came from shows like Pawn Stars and American Pickers, where they will call in an expert to determine the value of a given “piece”.
I had plenty of more ideas which had to be cut. There was going to be rocks on the game world and an explosives expert unit which would destroy the rocks so that the excavator could dig. I also did a little research on some of the most famous lost archaeological artifacts from around the world, which I wanted to include in my game. However, I just had enough time to include one treasure piece which looks like a golden chalice. I also got suggestions to add adversaries like spiders, floods, and diseases which could eliminate units, but I didn’t have time to include any of those.
For this game, I wasn’t too worried about creating the best looking game ever. In my previous Ludum Dare entries, I spent much more time polishing, but it never seemed to have much of an impact on my ratings. I’m much less concerned about ratings this time, and more focused on learning new things. For example, this time I got fully functional map controls working with the mouse, including zoom in/out with the mouse wheel. I figured out how to create a unit on the game world at the position where the player clicks. When implementing that feature, I got stuck when trying to cast a ray from the camera to the plane on the ground. For some reason, none of the camera API calls were working. I thought my Unity libraries may have gotten hosed or there was some issue with the compiler. After taking a break and coming back to it, I realized that on the title screen I had created a script called “Camera” for moving the title camera. All calls to camera were referring to that script, which explained why I could not access any of the Camera API methods. Changing the name of my title camera script resolved that problem.
Another issue was with the appraisers. Since the player could add an appraiser at any location in the world, the appraiser would need to walk to the nearest treasure. I did learn that I can access all of the Treasure objects by tagging them with “treasure” and then calling the GameObject.GetObjectsWithTag method. This also resolves a Unity problem that I was never able to figure out, which is referencing game world objects (in the Hierarchy) from a Prefab.
I will admit that there are some things that I’ve done so many times when creating a Unity game, that it just isn’t fun anymore. One of those things is creating human models. Unfortunately, in the 48 hour compo pre-existing assets are not allowed, so I had to create a human model from scratch again. I guess it’s good for the Blender practice. I used one model for the three different units, but used a different texture and animation for each unit. I originally started by creating the excavator with a shovel, but I found that it was going to be way too difficult to animate the character with the object, so the shovel was removed.
In the end, I got most of the basics working but it really didn’t look like a completed game. There was a bug which sometimes prevented the appraisers from collecting treasures. After looking into it some more, I found that this was because I thought that code execution stopped when Destroy was called on a gameObject. Actually, the script attached to a gameObject will continue until the Update method finishes. In my code, the appraiser was targeting the next treasure after Destroy was called, so that no other appraisers could target the treasure and appraise it. That was a simple one line fix to solve.
The biggest mistake that I think I made in this Ludum Dare was spending to much time basically re-inventing the wheel. I really don’t like the default Unity GUI buttons, so I decided to make my own. However, the process of making custom buttons is not a trivial one and is time consuming. Before the next Ludum Dare, I would like to have my own personal Unity library for things like graphical toggle buttons, menus, camera controls, font outlines, and dialog boxes. That way I could spend more time making the game, rather than trying to get a button to illuminate.
I liked the concept of this game, because I haven’t seen it done before. Therefore, I spent a little time this weekend making some changes for the Post-Compo version. I looked into how to modify the Unity terrain at run-time, so now when the excavators dig, it actually makes a dip in the terrain which is what I had originally envisioned. The biggest problem I ran into is that the terrain map starts at 0 height, so there was no way to make the terrain go any lower. Setting the base terrain level to 300 fixed this problem, and I just subtract 0.005 from the terrain height where the excavator digs. It took me a little while to figure out that the height array is from 0 to 1, not actual world units.
Overall, I’m happy with the results of this game. It definitely isn’t as visually impressive as my previous Ludum Dare entries, but I think the gameplay is much deeper. Adding adversaries to the game would probably make it much more exciting. If there is enough interest, I would be willing to port it to other platforms, since I think it would make a great mobile game. Online features such as leaderboards would also be nice to have. If I ever felt really ambitious, I could have an online server containing treasure data for everyone playing the game, so everyone is excavating from the same online world.