Click here to play the demo!

Objectives for this ongoing project:

  • Program some custom physics, avoiding built in functions
  • Make something more advanced than my Chinese character project
  • Try some basic sprite animation

I can definitely see physics programming becoming my thing. I have the background for it with my mechanical engineering degree and I just enjoy pure mechanics. I wanted this next project to be my first try at some more low level physics programming. I’ve had a play with Unity 2D physics before but I found out that much of it was done for you, and most of it is kept entirely out of sight of the developer to avoid bombarding them with too much Maths. I’m a big fan of Maths so after a frustrating time trying to figure out how long the AddForce() function applies the force for I chose to chuck built in Unity physics out of the window and program some of my own from scratch. Since I haven’t gone over graphics programming yet I chose to stick with Unity for now though and had to use some built in functions since there seemed no way to access the internal axes of an object themselves.

I wanted to do something more original than the standard earth physics simulator so I chose to do something with space physics and orbit, the core mechanic of which is shooting a little satellite into orbit without crashing it or sending it off into the depths of space.

The main thing I’ve learned about game physics so far is that games are not simulations- what physics does in real life is not always intuitive, so you have to program pseudo-physics which does the user expects to happen and what works for the game. It would be nice to make my game a little physics lesson but I’m already having screen space issues and the realistic elliptical orbits that I started off with took up too much space, as well as being too awkward to get the satellite into orbit.

In the end I implemented the gravity mechanic as aiming towards a target orbit. Gravity will slowly pull satellites in to this orbit, and if they come in at the right angle that won’t crash them into the planet (with a little leeway) they join the orbit and go around quite happily. I’ve changed the mechanics of firing the satellites into a click-and-drag aiming affair as before my click to shoot, click to boost speed method didn’t make much sense when there was more than one satellite in the game and was awkward to handle. Not to mention there’s no air resistance in space so slowing it down after the speed boost didn’t make much sense unless I want to put a booster animation on the other side!

I’ve had some fun painting some sprites for this game. I’m no artist but I took a watercolour class once and I can hack out something that looks ok, in the same way that my approach to cake decorating is dusting a cake with icing sugar and calling it rustic.

Complete features:

  • Almost all the sprites.
  • Basic gravity functionality as described above.
  • A gravity “area of effect” that effects the ship much more (since it is heavier) that prevents the player from driving right into orbit and firing the satellite from there. Also prevents gravity from more than one planet acting on object, which would again be awkward for the player to account for.
  • Ship flies around using arrow keys or WASD and is currently confined to the screen area.
  • Satellites are fired by clicking and dragging on the ship, so that the direction and power can be input by the user.

Features to come and bugs to fix

  • A demo where you can adjust perameters such as target orbit radius, coefficient of firing power, gravity strength, size of gravity AOE.
  • Flame animations out of the back of the ship to show when it’s accelerating and a better explosion animation.
  • Explode the satellite on collision with the planet, not on failiure to join the target orbit.
  • Rotate the satellite to face the direction it is going.
  • Fix the massive drop in framerate on firing the satellite.- fixed! My collider was generated by unity and had lots and lots of vertices.
  • Object pooling of satellites. I don’t have enough of them floating around to cause a problem with instantiating and destroying, but it’s good practice.
  • Camera programming- hopefully more advanced than just following the player.
  • Gameplay! Use satellites to scan planets for resources, send landers to collect them, use them to build settlements on planets, fend off hostile ships.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s