• entries
6
2
• views
5346

A walk through the game dev process from my eyes

## Genesis Phase II complete - physics on the ship to station collision

[font=arial]The screenshot remains the same as in phase 1, only this time we added some physics to the mix to bounce the ship off of it. This took a little bit of playing around...[/font]

[font=arial][/font]

[font=arial]The first thing that I had to do was get my ship model loaded in. I'm using the basic ship from the Direct X SDK that Microsoft provides. This is just a basic model... added a reflective material to the surface. Spent time positioning the camera over the cockpit (and in the bottom render you can see the nose of the craft) and then added mesh colliders to both the ship and the space station.[/font]

[font=arial]The majority of this phase was figuring out Unity and how to get colliders to work.[/font]
[font=arial]I set the station and the ship to both have a collider, to have rigid bodies, and to not be kinemetic. This was very important... as this is how the OnCollision trigger is fired. If the colliders are kinemetic then you must use the trigger properties instead, which I chose to not implement because I actually want my ship to be able to collide with things and not necessarily destroy them.[/font]

[font=arial]Once that was done I created a new script called "ShipPhysics" and added that to my ship (the motor script is attached to the camera, that may be changed in the future but for right now the camera still controls the movement of the parent body). I inserted a simple event handler that would check the tag of the object I collide with, and if its a space station, to run a custom method to end my app if my current speed is over 40m/s.[/font]private void OnCollisionEnter(Collision collision){//rigid bodies collidedif (collision.gameObject.tag == TAG_STATION){CollideWithSpaceStation();}}private void CollideWithSpaceStation(){//if current speed is slow, nudge the station//if current speed is not slow, the ship will be destroyed for right nowif (this.GetComponentInChildren().CurrentSpeed > 40){Debug.Log ("Quitting");Application.Quit ();}}
[font=arial]Testing the code confirms that it works. I can now fly around the station and run into it and it bounces my ship off of it, and if over 40 m/s will end the app (blowing me up)[/font]

[font=arial]Now I need to start constructing a GUI...[/font]

## Fun with Unity - Making spaceships move

I have my project broken into milestones, which I call phases... and the first phase is nearing completion. The first phase is simply to be able to render a space station of appropriate scale, and then be able to "fly" around it.

This involved a few things:

1) finding a good space station model and then rendering it (done)
2) creating a camera
3) mapping my XBox controller's DPAD to the game (by default, the xbox dpad is not part of the project, it follows the 6th and 7th axis from the input object so I had to go into the input manager and add this)
4) create a new ship class which would be tied to the camera which would have the code required for making it move

As of right now the ship will turn on its x and y axis (i will add rotating on the z later as currently that's not vital). Still to do is add acceleration and max speed.

I have a few variables in line to hold this information... a maxSpeed which will represent meters/second and a throttle which will allow the player to incrementally raise the speed up by 10% each time to a max of 100. This was mapped to the DPAD up and down.

Working with acceleration. Spacecraft shouldn't just start moving at X meters per second, it needs to build up.

Stabalizer code. Pure space means with no friction that once moving in a direction you will continue to move in that direction indefinitely. I have added stabalizer settings which a ship will have to counteract zero-gravity. However... perfect stabalizer should not exist. If I rotate right on the X axis I should slowly continue to rotate on the X axis when I release my joystick for a short time while the stabalizers kick in to stop the motion.

Once this is complete I will add rotation of the Z axis and my phase one will be complete: a moving camera in first person mode flying around a space station set on a black backdrop of nothing.

I also added some point lighting to the station to light up some of the features from interior lights. I discovered a thing called lightmapping last night but I'm not sure if its relevant at this point as there is no real scenery in space... at least not at the moment. It appears that UNITY doesn't light map objects... when I put my station's objects STATIC and tried to lightmap the mesh it told me there was nothing to lightmap.
I could also be doing it wrong. Which is a likely possibility.

## Project Crucible Basic Screen

Very basic learning with terrain editor for my virtual tabletop. Unity has been a lot of fun so far... needing to raise \$1500 for the full version now so I can get the full water version ;)

## Title Screenshot Rendered

Nothing spectacular... title screen shot renders and buttons hooked in:

## XNA vs Unity - Moving Forward

I've spent the better part of the week analyzing continuing my work in XNA for my game development, or moving into a system called UNITY 3D.

When I first started hearing about Unity and researching it, a lot of people were saying that its nothing more than a design tool and that people were better off sticking with XNA or Monobuild to create their game. It took a couple of days to really start analyzing the whys and what ifs.

First it is true, Unity is an engine... one that seems to be wrapped around an XNA-like framework. The thing is, the more that I think about it, the better that sounds because quite honestly I have discovered that I am not a fan of having to write engines.
I've never written a 3D engine. Most of me is not excited about having to write one. There is the cool-factor of having done one that would be nice, but really my main interest is putting the ideas in my head on screen and sharing them. Unity lets me do that.

I was able to do a couple of simple shooters in Unity in about 1/60th the time it would take me to do in XNA. The downfalls are that I don't understand the matrix math underneath the hood but honestly, I don't care about that.

As such, I will be moving forward with using the Unity 3D engine for the projects I have going on for the forseeable future.

There are two main projects that I am toying with at the moment. Both are ideas I have had for a long time but the lack of time and willingness to commit to writing an engine were the roadblocks that have kept them off the table for me.

The first is Project Genesis which I dub the beginning for me as a game developer using 3D engine to develop a game. Genesis is a mix of space dogfighting ala the old XWING series of the 90s mixed with galactic management akin to Civilization mixed with a little EVE. I would ultimately like the end product to be able to support mutliplayer... as that was the initial catalyst for wanting to do this... dogfighting with (or against) your friends!

It is also a sandbox in that the galaxy is never the same twice. It can quickly be fairly ambitious and large so to keep my scope down... Project Genesis Phase 0.1a will simply be about piloting a transport from a moon orbiting station, around dockyards with the earth in the backdrop.

To accomplish this, I have found an excellent set of assets found here: http://forum.unity3d.com/threads/147954-Space-Graphics-Toolkit-RELEASED