Ludum Dare 34 had two themes “Growing,” and “Two button controls”. I tried to hit both making a 2 button controlled infinite runner with a vine growing in front of you. This was my first time using Unreal for a game jam, and tried doing many other things differently this time.
Going into the Compo I had some specific goals in mind…
- Use Unreal Engine 4, my first time using it in a game jam.
- Do all programming in blueprint to practice visual scripting.
- Add music, planning to use Figure for iPhone.
- Hooking up Unreal to ToritseSVN, my first time connecting the two.
- Make a game that would work on mobile.
Proud to say that I accomplished all those goals and more with my entry. Though I struggled initially and wasted much time trying to solve issues with Unreal. What’s funny about Unreal is that some stuff is super easy but other stuff takes way longer you’d expect.
Friday – Concept
I liked theme this time around, thinking about how to combine two different themes was really fun. Two button controls works perfectly with my idea of making a mobile game. For growing I wanted to experiment with organic looking procedural level generation using spline meshs. I started by scribbling down about 10 possible game ideas. My best idea at the time involved 3 or more splines that you flip between using two buttons, maybe you are spiraling around the splines. I wasn’t fully sold on the idea though and wanted to sleep on it before starting any actual development.
Saturday – Procedural level generation
I must have been thinking a lot in my sleep because I woke up with a completely new and fairly complete idea, racing along a tube shaped object, using the two button controls to rotate around. Something like the map in f zero where it’s a tube shape, but as an infinite runner. I decided to keep it simple and not try too experimental of an idea since I was trying a new game engine.
I started a new blank project with starter content. My first goal was getting the procedural generation working. A few weeks ago I followed a pretty cool infinite runner in unreal tutorial in unreal. I recommend that tutorial for a first introduction to Unreal. For my idea it needed do work much differently in order to generate the level along random spline. Also I couldn’t rely on physics since there is no collision generated from spline meshes and it would probably be too bumpy anyway so I started from scratch for the player movement and controls.
I use TortiseSVN for all my home brew projects and heard that it had direct support in Unreal. It was fairly simple to hook and worked well, at least in this simple test case.
The level generation took almost all day on Saturday. There were some things from the content example project that helped me figure out how to work with spline meshes. I started out by generating a bunch of random spline curves and creating spline meshes for each section. This took a long time because of various issues I ran into with spline meshes. It would be nice to be able to visualize a spline mesh in game but I couldn’t find a way. I also had a problem with them twisting into a singularity and had to limit the maximum random angle that could be applied. I seemed to mostly have fixed it by limiting the maximum angle, but need to experiment with it more to figure out what exactly is going on.
For the spline mesh I started using the pipe shape from the UE starter content. That worked well enough for testing but I wanted to smooth the normals to be more round. I tried making a cylinder BSP by extruding it into a few intermediate sections and converting it to a static mesh, but that also caused lighting issues and bad UVs. I have never used Blender before but heard it was free so I downloaded it and set about making a simple cylinder. I found the interface to be extremely confusing and was constantly clicking on things accidentally that I would have to undo. Somehow after well over an hour I managed to make the cylinder, the UVs still don’t wrap properly but it’s good enough.
I spent a while messing around with the procedural generation, tweaking different variables that control how much it bends and stuff. I originally planned to have the track go straight up like a beanstalk, but noticed that it looked cooler when you could see the sun and horizon.
With the level generation working I moved on to player movement. I wasn’t able to use physics for this game because the spline mesh doesn’t actually have collision. So the player moves along the spline automatically using controls to change the roll component. I started with a first person perspective, but after experimenting I noticed that seeing the player in front of the camera feels much better and helps players understand their collision size.
One problem with the splines in Unreal is there’s no built in way to remove a point from the front of the spline. I need to remove the parts of the spline behind the player as they went along. So I wrote a function that dumps the spline into an array, clears the spline, then dumps it back minus the front node, pretty sloppy but it worked.
I also added some obstacles to avoid that are randomly placed around the mesh, a score display, and damage the player when they hit something. I like to have at least the basic gameplay in by the second night.
Before going to sleep I crammed in a bunch more stuff like a high score save and blue pickups that give health.
Sunday – Making it fun and polish
I began the day by adding polish to make it feel more like a complete game. Generated a bunch of random sounds in BFXR. Added camera shake when you collide. Added a start and end screen. Play tested and did a full tweak pass.
I spent a while working on materials for stuff, finding it very slow to iterate in the Unreal material editor. The preview window would sometimes take a minute to update after making a tiny change and applying the material to stuff in the game took several minutes. I ended up just making modifications to the default materials. The thorn and berry materials was originally the default steel material but I added some code to make them emissive and colored. I also made a simple dot material for the pickup particle system.
The destruction effects were made by taking the cone and donuts meshes and making them into destructible meshes. I have them set to listen for overlap events from the player and apply a damage event with physics impulse. For the berry powerup I created a particle system from scratch. For collisions I just used the default explosion effect and default smoke when you die, and didn’t get a chance to tweak them. I also enabled depth of field and played with other visual settings and colors for a while.
I used Figure on iPhone to make the music. This is a great little program for making music quickly. I made a few 8 bar loops, then picked the best one and improvised with it in a live performance, changing around which tracks are played and adding tweaks/filters. I spent maybe two hours the most making the music. I also hooked up the music to speed up with the player movement and slow down when you take damage.
With only a few hours left in the jam I still didn’t have a jump mechanic. I really wanted do something when you press both buttons at once, kind of a way to sneak in a third button. So I added the yellow donuts you jump over. They work similar to the cones but are oriented differently. The jump physics were done from scratch, using a timeline to control the height.
Towards the end of the compo I had some time left so I added a bit of a difficulty ramp so it starts out straighter with a few less obstacles. As I was making some final tweaks and play testing and I had a few last minute scares. One where I noticed a major kink in the road caused by setting the max spline rotation too high. Another where I had lowered the start point to increase the initial fog density and that caused the yellow donuts to not show up, weird stuff. Thankfully I managed to fix those bugs and check it all in before the deadline.
What went right
- Unreal is a pretty fun engine to work with, but some seemingly simple things can often be difficult to figure out.
- Using TortiseSVN with Unreal worked really well, though I didn’t need to do anything advanced.
- I really tried hard to keep things simple and it worked out well.
What went wrong
- Converting BSPs to static meshs in Unreal has some bugs and is very limited.
- Blender is a very difficult and non-intuitive program to use, I spent over an hour trying to make a simple cylinder shape and still messed up the UVs.
- Making material changes in Unreal was an extremely slow process with changes sometimes taking over a minute just to preview then when I save a change it wanted to rebuild all the shaders in the project. This seems like it really needs to me improved by Epic.
- Made what I thought was a harmless change at the last minute and almost broke a major component of my game.
- I don’t like how big my project is, just the final zip file is over 100 meg.