Traffic Light Simulator - a Ludum Dare Game

Ludum Dare is a competition where you are making a game in 48 hours. You have to make everything yourself, so you can't download any textures or models from someone else. There's also a less hardcore competition going on at the same time where you are making a game in 72 hours and can use other people's textures and models. In the latter competition you can also work in a team, but in the 48 hour competition, you have to work on your own.

I don't know if it's easier to make a good game if you are living in a time zone in US compared with in any other part of the world? If you are living in Europe, the competition begins at 3 AM on Saturday morning and ends 3 AM on Monday morning. So if you have a job to go to on Monday, you can't work the entire 48 hours. If you are living in US, the competition begins on Friday evening and ends on Sunday evening. So I suspect it's easier to maybe come up with ideas on Friday evening, and then work for "two days" to make the game itself?

Anyway, each competition has a theme, and the theme this time was "Ancient Technology." You can stretch this theme so you won't be disqualified if the game is not 100 percent based on that theme. My original ideas included:
  • Leonardo Da Vinci's tank
  • A ship game where you are controlling one of those sailing ships from Ben Hur
  • A game where you attack a castle with a trebuchet, which is a catapult
But after brainstorming ideas I came up with an ancient technology called traffic lights, so I made a Traffic Light Simulator (click on the link if you want to play it or download the entire source code).


Have you ever heard the history of traffic lights? Neither had I so I decided to read about it on Wikipedia. The story goes as follows:
The world's first, manually operated gas-lit traffic signal was short lived. Installed in London in December 1868, it exploded less than a month later, injuring or killing its policeman operator. 
My original plan was to include exploding traffic lights, but in the end I realized that it wouldn't work. A single exploding traffic light would ruin the game, because all cars and pedestrians would collide with each other. But in hindsight it would be possible for the player to rebuild the traffic light, but 48 hours is just 48 hours so everything is easier in hindsight.

After about 48 hours I ended up with a game where you control 12 traffic lights in an intersection. There are both pedestrians and cars from the era (which I modeled in Blender. The game itself was created in Unity). The game begins slowly with just a few cars and pedestrians, but as you get more points, more cars and pedestrians will arrive. You will be punished (get negative points) if a car crashes or a pedestrian is hit by a car, and you will get points if the cars and pedestrians arrives safely to their final destination. If a car crashed it will begin to smoke and you have to click on it multiple times to remove it or other cars may hit it.

To make the game more stressful, the cars begin to honk if they have to wait for too long. I also added an ambulance that will make an annoying sound I made in a cool software called Bfxr. Remember that you are not allowed to download the sound of an ambulance, so I had to make my own ambulance sound. It all looks like this:





What you win in a Ludum Dare competition is fame and honor, so you are not taking part in the competition to make money. But you will learn something new, you can test an idea you've had in the back of your head, and if the game is good you can improve and sell it. You will also get feedback. A week has passed since the competition and people have had the time to play my game. The feedback so far includes:
  • That was really sweet, although the traffic lights weren't always clear to where they pointed. I think I killed a person or two...
  • I really enjoy this game!!! Best which I had seen on this LD! Fun and difficult. btw. why all drivers are drunk?
  • Very nice idea and well done! And quite difficult to manage after some time. It would be nice though to see where the cars and pedestrians want to go when they approach the intersection.
  • It starts off very slow, and i think it would be a lot more fun had it been faster. Overall, a nice entry.
  • The idea and the game is very fun. I would like some kind of end goal. But overall well done.

So why are the drivers acting as if they were drunk? The cars are following a series of waypoints, but the cars are not that good a driving between the waypoints. The reason is that they are just caring if they should drive left or right to reach the waypoint, so when they realize they should drive in the opposite direction, they have driven a little bit too far. I think the easiest way to solve this problem is by using a PID controller. I tried to implement one in the game, but ran out of time, so I had to leave them drunk. 48 hours is after all just 48 hours... 

Comments