RSS

Monthly Archives: September 2013

Thruster Phase (Proof of Concept)

Thruster Phase (Proof of Concept)

I recently came up with an idea for a new game and have spent some time fleshing out a quick demo of the concept. I want to throw this out to the community basically to get an idea if this would be fun or stupid.

Thruster Phase!!!

Concept

Thruster Phase is a science fiction game where you guide a spaceship through various levels to reach an energy source at the end. The catch is that instead of directly controlling the ship you specify a series of thruster phases that are then executed in a simulation!

Basically the ship has 4 engines each in a direction and you tell each one how long to fire and how strongly. You keep iterating on your sequence until you complete the “mission” succesfully.

If this doesn’t make sense then hopefully it will when you try the demo πŸ˜€

Screenshots

Here are a few images of the game to give you a general idea.
Unity - MainMenu
Unity - Level1_2
Unity - Level1

DEMO

Last but not least is a demo with a little tutorial and 5 introductory levels!!!

I’d love if anyone reading this would try it out and let me know what you think of the game concept!!!

CLICK HERE TO PLAY

Advertisements
 
5 Comments

Posted by on September 17, 2013 in Developer Diary, Other Stuff

 

Tags: , , , , , , ,

Random 2d Terrain

About a week ago I started wondering how random levels are achieved in games like Tiny Wings. The terrain in these games are basically just smooth rolling hills that can go on forever. After learning about some basic ways this could be implemented but after a few days of searching I couldn’t find any publicly available samples or tutorials that did this in Unity.

As a result I set out to develop this functionality myself πŸ˜€

The Plan

After doing a lot of research into how this could be achieved I came up with what I thought was a pretty simple plan…

Generate Base Points:

First a list of (x,y) coordinates are generated randomly. To do this I generated a number of random values for the y coordinates and made the x coordinates automatically by adding a set amount each time.

This resulted in a list of evenly spaced y coordinates.

Interpolating the Points:

These random coordinates were a good starting point but they don’t give me the smooth look I’m going for. The solution to this problem is to interpolate between these points. this process basically generates a set amount of points between the existing ones in order to generate a smooth curve.

I got the algorithm to do this fromΒ http://paulbourke.net/miscellaneous/interpolation/

The function is as follows

double CosineInterpolate(
   double y1,double y2,
   double mu)
{
   double mu2;

   mu2 = (1-cos(mu*PI))/2;
   return(y1*(1-mu2)+y2*mu2);
}

This function takes the 2 y values you are interpolating between (y1 and y2) as well as the location bewteen the points we want to get a value for (must be between 0 and 1). The result is a y value for that x coordinate!!!

Creating the Mesh:

For me this step was the hardest since I have very little knowledge of direct graphics programming. I took the list of coordinates generated from the interpolation and used them to create a 2d mesh of the terrain.

First I made a bunch of vertices. Each coordinate produced 2 vertices (a top and bottom one) which acted as corners of rectangles.

Next I made triangles by assigning which vertices belonged to each triangle. In Graphics programming everything is made out of triangles so for each rectangle I needed 2 triangles.

PRESTO!!!

Unity Web Player  Random 2d Terrain - Google Chrome_2013-09-06_13-16-28I learned a lot from this project and hope to use it someday in a game. I posted information about this as well as a link to the source code on the Unity Forums here in hopes that someone more knowledgeable than I might improve it and so that the Unity community can benefit from it πŸ˜€

 

Playable Demo

In case anyone wants to see this project in action. Here is the link to the webplayer demo.

http://forum.unity3d.com/threads/199287-Random-2d-Terrain

 
1 Comment

Posted by on September 6, 2013 in Other Stuff

 

Tags: , , , ,