Gamedev Diary – SpaceLife

After creating the TapPhrase game, I regret not keeping  a running diary of events, discoveries, mistakes and milestones.

So this time I’m going to try and run some quick blogs charting the progress of the game I’m making at the moment called SpaceLife.

My biggest woe at the moment is that I don’t actually know what I am creating, other than I’m doing it because it’s fun.

I’ve always wanted to create a space-epic like Elite, X2, Galaxy On Fire, EVE, Starwars Galaxies. I would be happy with something that did even 50% of those. I’ve always had a fascination with space games, and in particularly hauling goods across the galaxy. Yes I’m weird.

I have so many ideas of what this game could be, from the basics (exploration, mining, pirate hunting, and hauling) through to Space->Planet transitions, proper exploration, surface mining, Farmville in space, tower defence.

My more left-field idea is that you are actually a Space Unicorn, whose trying to create rainbows through space. Or, you work for a bunch of Space Unicorns that require magical carrots in order to bend space for large corporations to transfer goods and governments to wage war (like the Navigators in Dune).

The tragedy is procrastination – thus, I’m just playing with spaceships at the moment.

I’ve got a few spaceships, nebulas, skyboxes and planets that I’m just getting the control mechanisms right for.

My main work yesterday was to construct camera positions around a spaceship using cameras to get the picture right, and then disable them before running the game. When the game starts up, we enable the forward facing camera, and when the user presses 1,2,3,4 we Slerp within two seconds to the location and rotation of the camera positions. It kinda works, and is good enough for now. I’ve made a nice scene which serves as my play-area in Unity to experiment with ships and planets without having any performance issues with lots of scene objects. Here’s  a sideways screenshot.

Thanks to the brilliant contributors in Unity’s asset store, I’ve not had to create a single model yet. This has accelerated my enthusiasm, so I can concentrate on the structural coding and logic (which there is very little yet).

Spaceship.png

What you see here is a small ship, probably an escape pod or ‘safe zone transport for one’, I doubt it would serve much more than that given its dimensions.

I’ve created a basic script called Base Ship Properties, which simply exposes a number of public variables that a main controller can interact with. It also defines the camera positions available. This allows me to apply this component, set some values and re-make prefabs for different ships and tweak their base properties.

2016_05_18_12_47_16_Unity_Personal_64bit_SkyboxTestScene.unity_SpaceLife_WebGL_DX11_

I haven’t yet decided if this Base Ship Properties will include basic functions for movement which are called by the main input loop – i.e. instead of having code manipulating transforms in the MainCamera’s PlayerController script, that it simply told the ship how much movement is being input – then the ship script should know how to handle the input itself. The last thing I want is a complex main control script, but also I don’t want Input.GetAxis/GetkeyCode style code anywhere else other than the main loop. – this will be a job for later.

Plauyer Controller.png

If you’re interested in how I get the cameras to move at the moment, here’s some code. TargetCamera is set up when the user presses a key to be one of the ships cameras, we then try and move our transform (the camera) over a fixed 2 seconds to the target camera position and location:

Plauyer Controller

What’s next?

Before I move code around, I want to try adding jets to the ship where its rear nozzles are, and make them proportionate to the speed. Then I’ll work out how to make it nice and generic, so that Prefabs can just add the scripts and drag in game objects as placeholders for those thrusters, and maybe assign a tag to them to identify if they are forward/roll/pitch (as required).

One thing I should mention – This isn’t realistic space simulation.

  • angular drag is on to kill some of the speed when turning.
  • I have a max-speed per ship, once we achieve that speed we do not go any faster, unlike in space. Most space games do this, because it’s no fun trying to stop with infinite acceleration!
  • I apply inertial dampening to the ship when banking/turning – so that the player can feel like they are getting the affects of air resistance, and that they don’t feel they are going backwards too long when they’ve flipped 180′.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s