Well, dang.
So. I did not enter Monsters and Minifigs in the Unity x LEGO® GameJam. I am very disappointed in myself for not entering Monsters and Minifigs in the Unity x LEGO® GameJam. I’m going to continue to work on it, but I had intended to enter it in the GameJam, and I am not happy that this didn’t happen.
In my initial draft of this post, I was going to continue by going into detail about exactly why I didn’t enter Monsters and Minifigs in the Unity x LEGO® GameJam, but instead of frontloading this post with backstory, maybe I should start by going over what I did get done… because I did get some things done. Maybe most notably, I got the health bar working, and made it so the player could take multiple hits before exploding. This turned out to be more difficult than I expected, though I guess it was a learning experience because of it.
Making the health bar track the player’s health was the easy part. Actually modifying the code so that the player could take multiple hits turned out to be surprisingly tricky. I created a new class, “Destructible”, with the expectation that I’d later make monsters and maybe some objects that could also take damage, and made the PlayerController class inherit from it… or tried to. The problem is that when I tried to put “Destructible” as the parent class of PlayerController, I kept getting the error that “The type or namespace ‘Destructible’ could not be found”. This was a complete mystery to me, because, well, that class clearly existed in the project. I could refer to it in a new class I created, no problem. So why couldn’t I refer to it in this one? It took me a while, but I finally tracked down the problem to the fact that the PlayerController class was part of an assembly—a collection of scripts that could be compiled separately, so it didn’t have to be recompiled every time any piece of code outside the assembly was changed. This meant, however, that since the assembly was necessarily somewhat self-contained and couldn’t depend on other code, scripts within the assembly couldn’t refer to classes defined in scripts outside the assembly unless they were parts of other assemblies that the given assembly had a reference to. (To someone who had worked with assemblies before, this would no doubt have been obvious, but they were new to me.) Once I finally realized what the issue was, it wasn’t too hard to solve; all I had to do was put my Destructible class into a new assembly, and give the other assemblies that referred to it a reference to that one.
And then I could make PlayerController inherit from Destructible and finally could get the player to take damage… sometimes. The spiked pits that I had created would lower the player’s hit points by 3, just as I had expected. But even after I modified the projectile code, projectiles shot by enemies still destroyed the player in one hit. The reason for this turned out to be a bit less abstruse: there were two places that the code checked for collisions between the player and a projectile and destroyed the player if one occurred, both in the Projectile.cs code and in the @@. Once I modified the code in both files, it worked fine.
Okay, I decided to start this post by describing what I did get done because I thought starting it with an account of why I didn’t enter it in the game jam would be a bit dry, but… I guess starting it by delving into the workings of assembly references isn’t that exciting either. Sorry about that. That wasn’t all I got done. I created a new enemy, a sort of slug monster (that, as currently implemented, somehow shot laser beams despite holding what was clearly a melee weapon in each hand).
The pattern on the eyes, of course, was a decoration and therefore didn’t import into Unity; in-game the monster’s eyes are currently a blank white. And the pieces I used for the teeth imported rotated 90 degrees; I had to once again add a line to the ldraw.xml file to get them to import correctly. Here’s the line, for anyone else who may want to use those pieces:
<Transformation ldraw="35464.dat" lego="35464" type="to_lego" angle="1.57079633" ax="0" ay="-1" az="0" tx="0" ty="0" tz="0" />
I also gave my scorpion monster a head, so it could go into the game… though I’m not really sold on it, and will probably change it later.
And I implemented health potions, that could restore the player’s hit points—ultimately I had planned for them to go into the player’s inventory and for there to be a hotkey for the player to drink a health potion when they wanted to. And I gave the game a win condition… I put a treasure chest at the end for the player to pick up. (And disabled the usual win condition display from the Microgame, so it wouldn’t get in the way of the health bar.) Here you can see a shot of the game where the slug monster, the scorpion monster, a health potion, and the treasure chest are all visible:
You might notice, however, that both the slug monster and the potion (it’s that small red thing in front of the slug monster and directly above the player) are floating above the ground. There’s a reason for that, and the reason is that… I didn’t have time to position them properly. So let me now get into why I didn’t end up entering Monsters and Minifigs into the game jam.
So, in my last post I went on about how there was finally a game jam that I would be able to fully take part in, one where I had a full two weeks to finish my game. I had failed to take into account just which two weeks those were. Specifically, they were the last two weeks of the school year… which is a bit of a problem because I was just starting my first year as a high school teacher (after taking some years off to work as a studio teacher—I had worked as a high school teacher before, but it had been a while, and of course it wasn’t at the same school). This was especially a problem because, well, with adapting to the new routines and learning the grading and assignment system used by the district (Schoology), I’d fallen rather far behind in grading—and had to spend these last two weeks catching up. The grades were due on the 18th, and I couldn’t wait till the 17th, the GameJam deadline, to start them, because it would probably take me more than one day to get them done. And besides, it wouldn’t be fair to the students to enter all the grades at the last minute; in order to give the students sufficient notice to be able to make up missing work or turn in extra credit to improve their grades, I had to get the grades done as soon as possible. So as it turned out, I had virtually no free time to work on my game after all.
Still, I was determined to get something done, even if it didn’t have quite the scope I’d originally hoped for. I just had to catch up with my grading, I thought, and then I’d be able to devote at least a few evenings entirely to Monsters and Minifigs.
I did not catch up with my grading.
I am, as a matter of fact, at the time of writing this (the morning of the 18th), still not caught up with my grading, although I just found out early this morning that the deadline has been extended to Tuesday, so I have a little more time to get it done. (Were it not for that, I wouldn’t be making this post today; I’d have been spending the whole day frantically grading.) But anyway, I never did get sufficiently current with my grading that I could devote the time I wanted to to my game.
Still, by Wednesday night, I still wasn’t quite caught up with my grading, but I had enough done (and had the exams prepared for the next few days) that I figured I could finally spend a little time on Monsters and Minifigs, and maybe have something to show for the game jam. I decided to take a nap before starting, which on the one hand was maybe unwise given that I already had very little time to get anything done before the deadline, but on the other hand I hadn’t gotten much sleep the last few days either and fully expected to be up grading all the following night, so maybe I needed the sleep. Anyway, as related above, I got some things done… partly by working on the game during the schoolday, while my students were taking exams and so I could afford to split my attention. But there was so much I wanted to get done before submitting it. Cliffs surrounding the play area so the forest didn’t just drop off into nothing. More variety in terrain, including turns in the road and intersection. More variety in trees, aside from the two models I had. Maybe a stat screen that the player could see, even if I knew I wasn’t going to have time to implement the full RPG system with experience and stat increases. I’d even intended to once again reuse the dialogue system I’d first created for Last Day to Live, and have an NPC at the beginning who talked to the player and gave them their mission.
Instead, I had time for none of this. I barely had time to get the health bar and damage system working and to toss together a small play area of 96 by 192 LEGO studs. Still, a little before 1 p.m., with the deadline looming at 3, I figured I had gotten done as much as I was likely to get done, and I should go ahead and start building and submitting the game before time ran out.
This did not happen.
Not that time didn’t run out, of course. Quite the reverse. I didn’t manage to build and submit the game before time ran out. I started building the game, and it took… a bit longer than I expected. And then, when it was mostly through, I realized, I’d forgotten to set the build settings to the correct scenes; it was building a scene with the Playground that came with the Microgame, not the custom scene I’d put all that work into! I thought about stopping it, but figured it was far enough along I might as well finish, so I did, and then made sure to include my scene and restarted it.
This time it took even longer to build. It took well over an hour. By 2:00, it was still building. And by 2:30. And 2:40. I was afraid it had frozen, but finally, around a quarter to three, the build was finished.
Was there still time to upload it? I could but try. I started the Publish process from Unity, but that, too, was taking a while, so I also uploaded the game to this site and opened up the GameJam Showcase page to see if I could maybe submit it with a link to an external site instead. I couldn’t—the only choices were to either upload the zipped file directly to the showcase page or to submit a game previously uploaded to Unity Connect. Still, the upload seemed to be working; it was getting close but at the rate it was going, it might just finish in time. Nervously, I watched the percentage uploaded tick upward, and then with minutes to spare before the deadline, it hit 100% and…
Something Went Wrong.
An internal server error. I tried again, but it was clear it wouldn’t upload again in time. (And even when it did, I got another internal server error.) Why wouldn’t it upload? I don’t know for sure, but my guess is that the game was just too big. Even the zip file that the GameJam submission page refused to accept was more than 150 megabytes. Why was the game so darn big? Yes, I had a lot of complex builds, but they were mostly prefabs. Except that a few of them I’d forgotten to set to Static, and they had merged together into a single, non-prefab game object. Though it’s unlikely that single object made that much difference. Hmm.
In any case, with less than a minute left before the deadline, I kind of panicked. I hadn’t done all this for nothing! I had to submit something! So I submitted the Bricking Point game I’d previously created to the GameJam. Not even the more recent version I made during the Live Learning series. The one I made way back when I was first testing out the demo version of the Microgame. (I’d intended to submit the more recent version, but was in too much of a hurry to check which was which.) This was stupid, and I really should have just not submitted anything at all, but, like I said, I kind of panicked.
Might I have been able to submit if I’d had more time? Well… maybe not, really; if the file size was the issue I’m not sure what I could have done about it. Sure, if it was just those prefabs that had merged together, I could have fixed that, but it’s unlikely that that would have been enough. But In any case, even if I had managed to get Monsters and Minifigs submitted, it wouldn’t have done much good. It was a pale shadow of what I’d hoped to accomplish; there just wasn’t much to it. And what there was was shoddy and buggy. I’d already remarked on the fact that the slug monster and the health potion are floating above the ground in the screenshot above–that’s because in my haste I just didn’t take the time to position them properly; I kind of slapped them in wherever they weren’t overlapping other pieces, and didn’t have the time to make sure they were on the ground. And there were some significant bugs, too. I had intended to make the scorpion monsters move toward the player, but the monster’s head is attached to the body by a hinge, and apparently Unity doesn’t count that hinge as a solid connection, so what would happen when I applied the Look At and Move actions to one of the bricks of the scorpion’s head is that the scorpion’s body stayed put while the head hared off on its own. I ended up just removing those scripts and having the scorpion monsters not move at all. Worst of all, the player would sometimes just fall through the ground for no apparent reason and plummet to their doom—and that doom just consisted of a black screen without the usual losing message. Hm. So, yeah, maybe it’s for the best I didn’t manage to get this uploaded. (Though I still shouldn’t have panicked and uploaded Bricking Point in its stead.)
Still, like I said, I’m going to keep working on it. One thing I figured that might (or might not) cut down on the file size is that I don’t really need all the overhead of the Microgame; could I use the packages separately? Well, they certainly seemed like packages that should exist independent of the Microgame, but they didn’t show up in the Package Manager, and I couldn’t find them anywhere else. A Google search for “LEGO Model Importer” turned up only five hits—two of which were for posts on this blog! I tracked down the package files themselves in AppData/Local/Unity/cache/packages/packages.unity.com, and found in the package.json files for each package URLs of git repositories… but both of those URLs yielded 404 errors when I tried to go there. (Come to think of it, maybe that’s not because they don’t exist, but because git repositories are supposed to be accessed some other way and not from a web browser? I admit I don’t know much about git files. This is one of the many, many subjects I really ought to learn more about.) I sent a message to an email address at lego.com mentioned in the README file for the packages to ask if there was a way to use them outside of the Microgame. Eventually I took a look at the files in the Packages directory of the game, manifest.json and packages-lock.json—not in Unity, but in the file directory directly—and I reasoned that maybe if I copied the lines from those files referring to the appropriate directories into the corresponding files in the Packages directory of the new game, it would import those packages into the new game. So I tried this, and it seemed to work—though of course with the grading looming over me I haven’t had much time to work with it yet.
I also received this morning a reply to the e-mail I’d sent to the lego,com address, from LEGO Games Senior Technical Lead Anders Tankred Holm. The message said that yes, I could use the packages outside the Microgame, and that to do so I just needed to add them to my Package manifest file—which by then I’d figured out, but I guess it was good to have confirmation that this was the official way to do it. I’d included in the e-mail I sent a link to my previous post about Monsters and Minifigs, and Holm’s reply included the following paragraph:
Your game looks really fun, so definitely keep us in the loop, we are working on a way to highlight/promote creations like this – more on this later in the new year.
So… that’s encouraging, though I’m not sure exactly how I’m supposed to keep them in the loop. I guess I’ll drop him another line when I’ve made significant progress on the game. In any case, it definitely seems like big(ger) things may be in store for the LEGO/Unity collaboration. It’s certainly receiving continuing support; within the last few weeks they released a “Santa’s Brickshop” Microgame Add-On, complete with a giant angry gingerbread man that kills you as soon as you start the demo scene if you don’t move quickly.
So, I said I was going to keep working on this game, and I know I’ve said the same of Last Day to Live and House of Secrets, and I meant it for both of those, too… though obviously I ought to prioritize a bit, and realistically Last Day to Live, in particular, I’m going to put on the back burner; it’s an ambitious enough game that I should wait to seriously tackle it till I’ve got a little more experience.
Still, at some point I ought to try, well, something smaller. Something achievable in a relatively short time frame. My problem—well, no doubt one of many problems, but the problem relevant to this post—is that I bite off way more than I can chew; instead of starting with something small, I immediately jump into some huge undertaking that I absolutely don’t have the time or knowledge to finish. I mean, yes, part of the reason I’ve so far failed to get anywhere near as much done as I’d hoped for either of the game jams I’ve tried to participate in recently was due to time constraints due to work… but also part of it was that I was probably aiming to make bigger and more complex games than I realistically could have even without the time constraints. I actually did have ideas for a few much smaller and more doable LEGO games. Why didn’t I make one of them for the game jam? Because I am an idiot. Would I have been able to get one of them done? Well… maybe not, still, in the limited time I had available around my grading. But maybe. And at the very least I probably would have gotten a lot closer.
I considered that maybe I could finish one of these games and submit it to the My First Game December Showcase, but I wasn’t sure whether that would really be appropriate because, well, by this point I feel like I’ve been using Unity enough that I’m not a complete beginner anymore; would it really be fair to submit to a showcase among other people who were showing off their first games? But then I realized that, as many games as I’d started with Unity, I hadn’t really finished any (unless you count the Roll-A-Ball game, but that one’s simple enough I don’t think it counts). Sure, I’ve started a lot of games, but this actually would be my first finished game.
So, that being the case, I have two Unity-related goals over the next few weeks, while I’m on break from school and have some free time. (Not that I don’t have a lot of other things I want to get done over these next few weeks, but at the very least I have some flexibility.)
- I am going to finish one of the other, much simpler, LEGO games I had conceived, using the LEGO Microgame kit. I am going to submit it to the My First Game December Showcase. Or, no, actually, I won’t… these showcases seem to be monthly, and there’s no need to rush. I’ll submit it to the My First Game Showcase for whenever I get it done.
- I’m going to participate in a game jam some time in the next three weeks, when I know I won’t have any conflicts and will have the full time to devote to them. A relatively short duration game jam; one that only lasts a few days at most—like I said, I do have a lot else I want to get done during the break, and I want to make sure I can devote my full attention to the game jam for a change and finally feel like I had a chance to do something. Right now I’m leaning toward the Discord Jam from January 1 to 3, although the biweekly Mini Jam also looks tempting… maybe I’ll try both?
Actually, I said I had two Unity-related goals, but really I should add a third:
- Get more involved in the gamedev community in some way! One of the things I most enjoyed about the Unity Live Learning sessions I participated in was the interaction with the hosts and with other participants, and the sense of community. There don’t seem to be as many of the Live Learning sessions going on anymore, and those that are going on are generally during school hours so I can’t participate. But that’s not the only way to get that sense of community. I’m sure there are forums, Discord servers (I’ve barely used Discord, but I should get more familiar with it), and the like where I can interact with other aspiring game developers—I’m going to seek them out and try to get involved. (I guess the aforementioned Discord Jam is one place to start… and I know Unity has its own Discord server as well. And heck, maybe just being more active on Twitter would be a start too; I barely go on Twitter except when I just made a post here on the blog and want to tweet about it.)
So, yeah, I completely failed to do what I’d wanted to do for the Unity x LEGO® GameJam—but I’ve learned an important lesson (that I should have learned some time ago, and that probably won’t stick because I am dumb), and I have a path forward. So, onward, to more games, more game jams, and, at least for the next few weeks, a little more free time…