My awesome post-mortem

Posted by
September 6th, 2016 6:31 am

Hi ludumdarlings, I’m kinda late out writing a post-mortem about my game but here it goes. I had a great time participating in ludum dare as usual and it was very enjoyable for me. I completed a game even though I did not get to include all the features I intended to include.

Thanks for all the amazing feedback I have received on my game, it has certainly been useful to me and is something I will bring with me next time around.

Check out my game here if you like or take a look at the timelapse where I create the game. Oh and I found my game in the very bottom of this cool mosaic art for LD36:


Anyway so back to the actual game. I did come up with a weird idea right away for the theme “Ancient Technologies”, I can’t recall now what it was exactly but I quickly threw it away because I realized how it wouldn’t really make for a very good game. So, after an hour or so of planning I came up with the idea to “Reinvent the wheel” (hence the name of my game). Yeah I know, the name of the game isn’t very creative but I find that to be one of the hardest things during ludum dare!

Here is a picture of my game (the graphics aren’t the best):

Below is a detailed explanation on how stuff works in the game and also what I could improve with the game and what I was happy with.

I wanted to explore what I could (and couldn’t) do with the unity3d engine. I wanted to do a game which was very procedural and also had a high replay value if possible. So I needed a way to procedurally generate 3d meshes in unity from user input. The first thing I realized was that I would have to abstract the shapes that people draw, because otherwise it would be a big performance bottleneck for the physics engine to use non-convex shapes. Atleast this was my intentions in the beginning, later on I realized I wouldn’t be able to use normal mesh colliders for the wheels because the unity3d physics engine is not exclusively designed for car games. I needed to use the wheel colliders, which only allow for circlular shapes. What I did instead is to calculate the radius of the userdrawn wheels and use that for the wheel colliders. This way you needed to draw wheels that were approximently the same radius or otherwise it will be difficult to steer.

I learned a lot about how 3d meshes work during this ludum dare. How the vertecies and triangles should be connected etc. I used a quick hull algorithm which I looked up the psuedo code here.

This is basically the result before and after (the dots represent the vertecies the user has drawn with the mouse):


After performing a quick hull we see which vertecies will be connected (we remove the other ones):


So after having the vertecies calculated, I needed to create a polygon flat mesh from this. To do this I used something called Delaunay Triangulation. I used this implementation as reference. After applying this algorithm you will have a list of triangles connecting the vertecies (below is a simplification):


But 2d flat meshes doesn’t make for very good wheels, do they? So the next operation is to extrude the 2d mesh into a 3d mesh with depth. To do this we just have to duplicate the vertecies of the 2d face and just increase the z value. Then we take the outer edges of the triangles and connect the edges with two adjacent triangles making a rectangle:


If you are interested you can read more about the specific method to do this here. Since we already have the vertecies making up the 2d face, we can just take those and we have our outer edges that we need.

So, this is essentially how the procedural wheel mesh generation works. Now, for the procedural terrain and road I use much of the same principles. It was very easy to generate the procedural infinite road. I just add two triangles connected to two new vertecies with random x values and increasing z. It is like having a block with a fixed length that we add to the end of the road. Since I was running out of time I needed a quick implementation of procedural terrain generation. I used this implementation which uses a PerlinNoise image as a heightmap for the terrain and generates chunks based on the player position. Here is a link to much more information about this specific implementation and a detailed explanation.

For the web build of my game, it wasn’t as easy to generate procedural terrain. Because I was running out of time and needed to port it to the web I quickly found a implementation on how to generate infinite flat terrain. It works good enough for the web build anyway.

I used blender for my very rough 3d models which weren’t the best looking but I needed something quick. I took a picture of my brother and mapped the photo to the 3d model and I had my game character. The sound effects weren’t the most entusiatic but they work. For music I used an autotracker to generate 10 sound tracks that I could include in my game. My initial plan was to generate a MIDI music track at runtime, but I prioritized other more important stuff over procedural music generation. That would have been very cool however, and I wish to do something like this some other ludum dare.

For the textures I used in my game I needed them to be tilable so I found a very cool python script to do this. It basically swaps the corners and uses a blur to merge the corners to create a relatively seamless texture (it works better for less detailed images).

Finally for the scoreboard. Yikes, this part of the game was RUSHED!! I barely made time to add a scoreboard to the game, but it became a very important part of my game. If I had not added this, the replay value would be very small. It would become very boring quickly if you had no goal. I realize by adding some sort of positiong at the top of the screen or something like “x meters left to y” where y is the next highscore and x is the distance.

In conclusion, I spent too much time on the procedural mesh generation and did not get to include some important features that I would have liked to include. Thanks for reading, I hope you learnt something from it perhaps. Don’t forget to check out my game here!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]