Day 3 of Ludum Dare 40 has not been much better than day 2 unfortunately. But at least I can talk a bit about Ludum Dare and Unity.

Ludum Dare

Ludum Dare is one of the world’s largest and longest running Game Jam events. Every 4 months, we challenge creators to make a game from scratch in a weekend.

A lot of famous indie games got their start as a weekend project from Ludum Dare. This event, the 40th (which I guess means it’s been going for 10 years!), the theme is:

The more you have, the worse it is

My buddy, Sionnis, and I spent Friday night brainstorming how to use this theme. The uninventive but typical implementation might have been any sort of accumulating negative status effect, possibly gained by collecting the game’s objectives. Taking hits might slow you down, collecting coins might weigh you down and reduce your jump height, spawn more enemies as you collect more macguffins, etc.

We eventually came up with an idea to have the player act as a beat cop, patrolling larger and larger portions of a city. The catch though, is that as the player’s patrol route grows in size, so to does the area that criminals can come from. It would then become a careful balancing act between adding more streets (and the businesses and people residing there) versus having more locations for criminals to spawn from, and those spawn points being further away from the player’s current position.

Working in Unity

Unity is a cross-platform game engine developed by Unity Technologies, which is primarily used to develop video games and simulations for computers, consoles and mobile devices. - Wikipedia

In very basic terms, Unity allows you to code a game without having to worry about how to render all the graphics and calculate all of the physics. You can plop objects into a 3D space, fiddle with their properties, and attach scripts to control their behaviour.

So, whenever you start a project, the first step should be to break it down into manageable steps. My game needs:

  • a “tile” system to represent new roads being added to the player’s patrol
  • a token to represent where the player is located on the map
  • the various actions that the player can perform
  • a turn system
  • criminals

I decided to start with the tile system. It involves graph theory! Nodes, edges, vertices, connectivity, I learned all about those things at university!

I have not finished the tile system…

One problem, is that I had not used Unity or programmed in C# in over a year. So I had to relearn a lot of basic things, like setting types for variables, something I haven’t had to do in JavaScript the past few years. But the real problem, and the real time waster, was attempting to just jump back into things, coding up a storm, realizing there is a major flaw or design problem, scrapping things and starting again, and again, and again. Sure, I’m relearning lots as I go. But it has NOT been time efficient, which is what you need during a 3-day jam.

I started by creating some very basic “prefabs” of the road tiles I would be using. Prefabs are 3D objects/models that I can reuse, spawning them as my scripts require. Then I created a high-level game manager script to oversee things, instantiate the prefabs, hold the coded representation of the game board, etc. But figuring out the best way to do that has been such a headache. It was easy enough to instantiate each of my prefabs, but I also need to attach a script to tile to represent it in the code and track its connections, switch out the model if needed, etc. It’s an issue I have yet to solve. Earlier today, I had the idea to make a generic Tile prefab with references to the other prefabs required to model the different street shapes. But that had implementation issues when trying to switch one prefab for another but maintain the same Tile class as a script component.

Tomorrow’s idea is to create a Tile Factory class, a design pattern meant to manage the creation of Tiles (both their gameobjects and their scripted information/code). Thinking about it now, I even have a few more ideas.

  • a method to pull & save Tile info then “paste” it into a new object. I don’t want every single Tile to be all types of tiles, and just turn different ones on or off. I want to replace the gameobject. But script components (like the one containing the info needed to keep it in a graph) must be attached to gameobjects. So, when it comes time to switch out a blank tile for a 3-way intersection, I can save the info from the blank tile, delete the gameobject, create a new one, paste the old info in, and voila!
  • I should also really look into other design patterns. I could easily create some sort of inheritance patterns between the different types of tiles. There are managers, factories, and many more design patterns that would almost certainly be of help. And taking the time to document and design everything in detail should really help me get a better sense of what exactly I need to do, rather than just floundering in the water.

Anyways, I really just want to burrito in bed now.

Ooo, and tmrw I’ll try posting screenshots, or code snippets.