Now that we’ve split the News and Blog sections of the site, I feel more at ease talking about more of the stuff we’re working on without feeling like everything is some big official announcement. Just warning you up front, the games/projects displayed on this blog may or may not ever be finished or released. Think of it as a development diary, where you’ll see the creative process in action.
As promised, here is the first in a series of posts talking about another of our games that we currently have in development. This one doesn’t have an official name yet. We’ve been calling it “Sol Defender” for the time being, though it may not ship with that name. Here’s a very early screen with some temp art to show you what we’re shooting for:
As you can probably tell, it’s a dual-stick space shooter (stay with me) set on spherical worlds (like Super Stardust HD, Super Mario Galaxy, or Ratchet & Clank). We’ve got an interesting gameplay twist that we’re working on that uses the spherical worlds in a neat way, but I’ll save that for another post. For now, I want to give a little background on the project itself, along with some code that shows how we’re pulling off the spherical world effect.
I first encountered the concept of “spherical worlds” in games while playing Ratchet & Clank: Going Commando way back in early 2004, and immediately fell in love with the concept. Indeed, I fell in love with the rest of the game as well, so much so that I ended up working at Insomniac Games (the developers) for over two years. Spherical worlds made an appearance in Up Your Arsenal (but not in Deadlocked, sadly).
I’ve basically been enamored with the concept of spherical worlds in games ever since. I understand the physical impossibility of a small planet-like body not being able to sustain any meaningful gravitational pull, but I’m not in the games business to make simulations!
After the release of Sheepstacker, I began developing a prototype for a tower defense-ish game set on a spherical world. Then ngmoco released Star Defense. Irritating. The gameplay was actually going to be significantly different between the two games, but I decided to move on anyways.
I then began working on a prototype I called “iArena”. It was going to be a dual-stick shooter with fully animated characters running around on spherical worlds blowing things up, with full online multiplayer. We had a successful prototype and even showed it off to a few people, including publisher Chillingo. However, the game was just too much for us to pull off at the time, and probably still is. Additionally, I’m not sure the iOS devices at the time could have handled the full game anyways.
Finally, we scaled the spherical world concept all the way back to space ships waging war around a planet. In the interest of worrying more about the technical aspects of the game rather than the artistic aspects like I had for our previous two games, I bought a big pack of low-poly ship models online and some skyboxes. Here’s a test video of what we currently have (no enemies in this particular video):
Now that you have the story thus far, I’d like to delve a bit into how we’re handling the spherical movement aspect of the game. The concept is actually fairly simple: The gravity vector for all objects in a normal game world points downwards, and all physics simulations are based on this single vector. On a spherical world, however, the gravity vector for each object is a vector from the object to the center of the spherical attractor (e.g., a planet).
For our game, we were able to simplify the simulation. As all ships and objects will be at a constant distance from the surface of the planet, we don’t need to actually apply a gravity force toward the center of the attractor for each object. We simply need to orient the object to the gravity vector and lock the object to a specific distance from the center of the attractor.
Vector3 gravityDirection = Vector3.Normalize(attractor.transform.position - transform.position); transform.rotation = Quaternion.FromToRotation(transform.up, -gravityDirection) * transform.rotation; // "kDistanceFromAttractorCenter" is a float marking the radius of the "sphere" // that the ships move on top of. transform.position = attractor.transform.position + (-gravityDirection * kDistanceFromAttractorCenter);
That’ll handle the positioning and orientation of any object in the game, including ships, bullets, and anything else. For movement, take your standard movement vector and multiply it by the object’s rotation:
// "movementVector" is a vector whose z will move the ship forward along // the sphere and whose x will move the ship side-to-side. transform.position += movementVector * transform.rotation * Time.deltaTime;
While the math here isn’t entirely accurate, it’s good enough for our purposes. And that’s pretty much all we need for the spherical effect.
In my next post about this game, I’ll go into the development of some of our enemy ships. It should illuminate just how enemies can track a player when they’re on a spherical world (it’s much easier than you might think).
In Other News
In my previous post, I mentioned that we would be putting Safety First on the backburner for a while due to some level design issues. Well, level designer (and good friend of mine) Larry Charles from GoPlay Games contacted me to take a stab at it, so it’s back on! I’ll be posting updates on that game as well as development progresses on it.