Ludum Dare 31 has ended
Entire Game on One Screen

Results for LD31
Over 2600 Games submitted

Ludum Dare 32
Coming April 17th, 2015! Our 13th year!

LD25: A delayed retrospective

Posted by
February 17th, 2013 10:41 am

For LD25, I tried using Unity for the first time. Well, that’s not quite true–I had tried using it a few times before, but never got anything done. As a programmer, the seemingly content-oriented interface threw me off, so before LD25 I read a lot of documentation to ensure I knew what Unity is all about.

Where's the code?

Where’s the code?

So, what did I learn about Unity while making my game, Entropic? Quite a bit, but in summary: Unity is awesome, it handles its component engine well, and I look forward to using it again in the future.

I made a few odd design choices near the beginning that I’d like to share, since the rest of the LD was the usual “started off well, hit a major issue in the middle, almost jumped ship, but came around in the end and finished it off.”

Entropic is, at its roots, a space sim, and in science fiction space ships tend to have gravity independent of ship acceleration. If a starship starts spinning, actors typically just stumble around a bit.

How is this accomplished in a constrained physics engine like Unity’s while retaining physics-powered movement both inside and outside the ship? One way would be to have multiple physics worlds (aka spaces), one simulating the exterior and the other the interior–but Unity only allows one world to exist. The next best thing are physics layers, which can be configured to only allow interaction between objects in the ship and objects outside the ship. Simple enough, and Unity makes this easy to configure.

I then (too eagerly, in hindsight) decided to add scale into the problem. Ships move at much greater speeds and have much larger sizes than humans within a ship, so I thought it would be a good idea to scale down the “space” world to account for potential accuracy issues. Easy enough, especially in Unity–just turn down the scale on all the “ship exterior” and “asteroid” meshes, and it’s done.

It does look really weird, though. (I hid some of the ship bridge's walls to get this screenshot of both layers combined.)

It does look really weird, though. (I hid some of the ship bridge’s walls to get this screenshot of both layers combined.)

One problem that I had early on is that there was very little visibility on the bridge. On the Enterprise, that little screen was enough because they could tell is to look at anything around the ship–with an equally-sized window on a ship, it’s surprisingly hard to tell what’s going on.

High visibility. The player can actually see "out" of the ship at almost any direction.

High visibility. The player can actually see “out” of the bridge at almost any direction.

To make the field of view much higher, I decided to apply an idea I had been holding onto for a while. By playing with the depth buffer a bit, I made some surfaces that hide the parts of the ship behind it. This dramatically improves visibility, and is also cool since it creates the effect of having an “impossible geometry.” (My explanation is that the ship is covered with tiny cameras that capture the state of the ship’s exterior, then display on interior screen-panels what the system extrapolates you would see from that point.)

It's bigger on the inside.

It’s bigger on the inside.

With some more advanced ship designs, I think that could get really cool, really quick. (Battle bridge, anyone?)

One thing that made this effect much weaker is the cloudy effect I had to use to represent the volume of the ship. They look somewhat like stars, and it is a little weird that they form a box around the ship. This is meant to represent the volume of your craft, since you don’t have any other reference with the fancy windows active. Need to find a few artists for the next time I do something like this, so it doesn’t confuse.

Overall, I’m happy with how it turned out, although as a game the project was sorely lacking. For the next LD I’ll avoid ideas that need fancy but non-value-adding programming. I hope. It’s hard to resist a challenge.

4 Responses to “LD25: A delayed retrospective”

  1. Thanks for posting this. I really enjoyed your entry, even though a lot of the controls were a mystery at first. While I have never piloted a spacecraft, I think you did a great job of making it *feel* like the player is piloting one.

  2. hdon says:

    I wish you wrote more about it :)

    What is the “cloud effect?” Is the geometry to calculate physical dynamics in Unity somehow linked to the geometry needed to visually render the image of a body?

    • 31eee384 says:

      The cloud effect is hard to really see in the screenshots–it is my attempt to give the player some sense of where the ship’s bounds are. Consider when you’re driving a car: you eventually get a feel for where its corners are. This is hard to achieve in a game, so I wanted something that might more directly give you that feeling.

      From the technical angle, yeah–the same game object that holds the collider component holds the mesh component that renders the clouds. (Unity does allow you to have only the physics components (colliders, rigid bodies) attached to a game object, if that’s what you’re interested in.) To make the clouds appear, I made a shader that makes the GPU cull triangles the other way around, so the faces are rendered pointing inwards. Other than that, it’s just a semi-transparent texture.

      It is interesting to consider that since the clouds are in the “outside” layer, they are actually rendering at 1/5 the scale of the bridge, but they appear to be outside the ship thanks to the fancy camera work.

      I’ll try to write more like this in the future, when I have more things to write about. Was fun to do.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]