Space Game

This entry is part 1 of 4 in the series Space Game

Getting Started

After a few false starts, I’m finally getting something put together for an untitled space game. The premise is simple; it’s a mix between a tower defense, MOBA, and space shooter. I have many ideas that I’d like to include in the game, but I’m tackling them all slowly, figuring out how to properly implement them into the overall concept.

I’ve bookmarked a lot of tutorials that should help me with pieces of the game. So far I’ve got a tutorial on infinite space, homing missiles, and I’m even reaching back to one of the first tutorials I used, Ruby’s Adventure.

It Begins

My first steps were to get a simple controllable object in the game. I grabbed a sprite from one of the asset packs off the Humble Bundle store. I started off with a simple control script that moves the object around the screen. Of course, that’s not good enough, so instead I decided to use the physic engine, set gravity to zero and applied thrust to the object instead of direct position translation.

This means that I can hit an arrow key and start the object in motion! Of course, right away that set off a few issues, the biggest being a static camera. Simple enough to correct with Cinemachine. Just set that to follow the object and now the camera goes wherever you go! There’s a little bit of movement inside the camera frame, but the camera itself navigates all over the scene.

Setting the Scene

A spaceship floating around the camera viewport is nifty and all, but also kinda boring. Next up was adding a cool background. Not just any background though, stars. Stars that move as you move! Parallax stars that move in relation to the ships movement. Really makes it feel like you’re flying through space.

So using that video tutorial and a couple different assets I put together a cool 3D looking space background that my ship flies through. At first things moved too fast or too slow. I had issues with rotation and the stars moving in the wrong direction! After much tweaking I got it working mostly in the manner I wanted.

Space Game Beginnings
Rudimentary Beginnings

Objectives

Flying around space is cool and all, but there’s really nothing to do. Time to add some objectives, or at least one objective. What exactly is an objective though? Let’s see, I’ll need a object, and it will probably need a collider. The ship will need a collider too. When the two colliders come in contact, something happens.

So I did just that, in a few minutes I had another ship floating out in space. When you navigate your ship to the other ship a message pops up in the log saying it happened. That’s it, it’s a done game. . . Time to ship!

Design Decisions

One thing I keep mulling over in my head is movement. Currently, it’s in a rudimentary state, the ship is pushed in a direction. Thrust is given at an adjustable fixed rate, but there is no speed cap. Should there be? The ship doesn’t rotate. I want it to rotate, but I can’t fully implement that until I decide if I want to change thrust. There are a few different ways I could treat thrust.

I think I want to keep thrust the way it is, but instead of treating it as a uniform, each direction needs it’s own routine or function. I need to be able to adjust the four cardinal thrust directions independently. . . or should that be six directions? No, controls for six directions of thrust in a 2D world would be disastrous.

So, I need to keep 4 directions of thrust, which can be independently tuned (stronger/weaker), and add in rotation. Keep the thrust relative to the rotation of the ship, not relative to the world. This leads into my list of things to do next.

To Do

  • Ship rotation
  • Correct thrust mechanic
    • Edit: I fixed thrust in relation to the ship rotation. It was as simple as changing AddForce to AddRelativeForce in my script.
  • Pause Menu
  • Main Menu
  • Ship Design
  • Enemies

Conclusion

Well, I never really thought I’d make a game so quickly. Sure, it’s rudimentary, no frills, and definitely not the end product I’m looking for but it’s a game. I sat down this morning to start working on a game and now I have something. I have the groundwork for what I hope will become even better.

Series NavigationTurning It Around >>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.