7:10am – I just arrived at the McDonalds and got myself a McBreakfast. It’s time to Ludum Dare! I plan to do most or all of my work here at the McDonalds, it’s become practically my office the last couple weeks.
This season’s Ludum Dare theme is One Room. I briefly considered doing something like <a href=”http://www.onemorelevel.com/game/there_is_only_one_level”>There is only one Level</a> but I don’t think I could do that well within 48 hours.
I’m going to go with my No. 2 plan from before the theme was announced and make a Snake clone. It fits in one room, and it’s simple enough to make. I hope!
But first I should eat this lovely McMeal…
7:26am – McBreakfast done, I am now setting up Unity.
7:55am – I’m making the playing field in Unity. It doesn’t really need any coding so I can just plop it down.
8:07am – Okay playing field created. Now to figure out the game mechanics I need and how to implement them.
I’m making “Caterpillar”, a clone of Snake, which was originally a clone of some early primitive game you can look up on Wikipedia if you’re curious.
In my game, there will be a 32×32 grid of squares, cubes really since I’m doing this in 3D, and this bounded area will be populated by one (1) Caterpillar. This Caterpillar will be made out of segments which follow a Head segment along the grid. The head segment does not stop moving. If the Caterpillar head runs into its body the game is over. If the Caterpillar head runs into a wall, it automatically goes in the first clockwise open direction, unless there are no valid moves, then game over. There will be fruit pickups. Picking up a fruit increases your score but also increases the length of your Caterpillar by one segment. There will be trees. Trees are random blocking objects in the gamefield to make things more interesting. They act like walls. When you run out of valid moves and run into yourself, it’s game over and a score screen will display, along with the option to play again.
So, I’ve got to make the Caterpillar Head, Caterpillar Body Segments, Fruit Pickups (Apples), and Trees, as well as the UI to cover it. I’ll probably make a few Camera Controllers for different viewpoints on your Caterpillar, but I’ll start with an overview of the whole field.
Let’s see what I can do without thinking about it too hard.
8:38am – I’ve made some basic models and materials for my game pieces. Now for the scripting.
The Caterpillar will move by transform changes rather than physics, since it’s only going to move in square segments.
The control scheme will be something like this.
If a direction is pressed, move in that direction if possible.
If no direction is pressed or the direction pressed is impossible, move in the last direction pressed.
If the direction selected is impossible, search for a possible route clockwise until one is found or game over.
All the while I’ll also be checking if the path crosses the Caterpillar’s body, in which case it’ll be game over.
I’m thinking I’ll use something like a linked list to tell each caterpillar section to move, and if a fruit is eaten the last section will spawn a new section in.
I’m going to start by making the basic movement script for the head.
10:12am – Amazingly it’s already 10:12. I’m still working on the movement script for the head.
11:43am – I’m struggling with some complex mathematical formulae to figure out the caterpillar’s movement, and I’m getting hungry. So I’ve put in an order.
12:05pm – McLunch eaten. I had a Junior Chicken Bacon Ranch, a Garden Side Salad with Greek Dressing, and a small Coca~cola. Good, cheap, filling meal.
Now back to my problem. I’m not sure what went wrong with my code but presently the head of my caterpillar flies off to the left at a constant velocity which is faster than the speed value it was moving at before. I figure my obscenely complex math was incorrect or something…
1:46pm – I’m still struggling with getting the head to move to the exact coordinates of the next square and properly test for a direction to move in. It’s bizzare that it’s eluded me this long.
1:53pm – Blasted floats! How I hate your imprecision! Well I guess I’ll have to figure out a different way of telling if I’m on a square or not.
3:04pm – Still working on this problem. I’ve tried tackling it from at least four different directions with no luck. Very frustrated.
4:21pm – Direction five seems to be working! I just need to get everything else working now…
4:26pm – I have two bugs right now. One, the down button doesn’t work. Up, left and right all work. I’m not sure what’s up with that. Also, I can turn backwards. Shouldn’t be able to do that in Caterpillar.
4:36pm – I have a lot more bugs now!
4:41pm – Bugs are all gone now!
Well except the moving backwards one. Though, I guess that will be automatically fixed when I add the segments in.
So I’m going to add the segments in!
5:10pm – I’m feeling burnt out and tired and it’s getting dark out. I’m going to go home and sleep, and get back at it when I get up.
Tags: LD37, Ludum Dare