Saturday, December 7, 2013

Project 4? A Slightly Different Final Project

Hello everyone, as you will see soon from a major update that I am about to upload on my blog posts regarding the Space Race game this project turned out to be a lot bigger than I imagined trying to stuff it all in this semester. Even with spending most of my Thanksgiving break working on things like making quality texture maps and UV Mapping (man UV mapping can be a pain). Anyways, I have only been able to do part of project 2 and so for the time being, my plan for the initial level will have to be smaller. I will try to do an extra tutorial in addition to this to try and learn more about Unity and programming so that as I continue to work on this project I will be better prepared.

I will be doing Digital Tutors: 2D racing Game Series in Unity: Volume 1

Here is what I have so far:

First we added 5 materials to our Materials folder. 


We specified which texture would be assigned to which material, by navigating
 through the Photoshop texture sprite sheet and finding the matching material. 


Once we dragged and dropped the the created material onto a quad (a plane created in Unity),
We went into our prefabs folder and created all the track prefabs. Dragging and dropping a
completed material in the hierarchy onto it's corresponding prefab name
 created a prefab with all it's attributes.


We added other prefabs like grass, plants, and stone dividers to our prefab folder.


After that we added a player prefab which consisted of the whole sprite sheet texture. The reason
that the player car needed access to this was because it would need to navigate through it to the
different driving frames needed depending on moving forward, turning, etc.


Using Unity's scripting interface called "MonoDevelop" we created a short 
and simple script for player movement (this covered only forward and backward motion).


After that we continued to develop the player movement script by adding in turning functionality.


We didn't want to have the car drive at a consistent speed. We wanted to have acceleration/velocity
values. So we started adding in some velocity functionality.


In the following lesson we finished the movement script and debugged any small errors we may have encountered along the way.


Next we started to write code that would change the sprite spreadsheet into the correct image
that we need for each appropriate player action. We got it to connect to the sheet and
ended the lesson with staying on it's initial sprite value (started with straight path image).


We then had to figure out how to match the sprites with real time fps (frames per second). We got it to function and keep track of real time and then restart it's count down timer.


When the game started Update( ) would call the Handle( ) function which in turn would call
FindAnimation( ) and PlayAnimation( ). Update is called several frames per second and is
always checking for changes in player movement, and in connection, necessary change to
player car sprites. We connected these functions and moved on.



Video 1 of figuring out how to cycle through sprite animations.


Video 2 of figuring out how to cycle through sprite animations.


Video 3 of figuring out how to cycle through sprite animations.



This lesson was easy to follow along and Joshua Kinney (tutor) tried to explain the process in a brief, but clear fashion. I would recommend it to others who are interested in making games in Unity (like I am). If you have a subscription to Digital Tutors you can follow along in the following volumes to go further in the project. I might just go back to it someday.

Check out my other blog posts if you are interested. I am working on a space racing game with completely customs assets.

Saturday, November 2, 2013

Project 3: Bringing everything together in Unity 3D

Hey guys. The last step of course is to bring all of my custom assets into Unity and try to see if I can get a simple game running. What I expect this semester, I might even be pushing my luck now, is to at least have a level with its lighting set up and create some kind of time trial/race course test drive option. I have been doing project 1 and project 3 at the same time so that I can make sure that the track pieces I've been modeling fit together as seamlessly as possible. Well, here starts project 3 (it's go time!). Here are some screenshots of the un-textured pieces assembled in Unity. 

I didn't have time to make a course using the full 15 or so pieces that I built, so with my 5 completed track pieces I built and lit a small track in Unity 3D.







In the future I will try to add more track pieces and make the level more complicated, but for now, this is what I did for project 2. =] Thank you for reading.

Project 2: Making everything look "Pretty"

Hello once again. Today starts the blog of project 2. Project 2 includes poly-reduction, creating normal maps, UVs, texture maps, and possibly bump maps.

Poly-reduction and normal maps are very new to me especially in 3ds Max, but I will try to learn as much as I can. I started by going through all of my models and deleting extra edgeloops and vertices that were now not adding much to the geometry. I then looked to see if there was extra geometry that I could delete that gave the models their shape/detail. I can use the high poly model to bake most of the detail back into the poly-reduced model.

I decided to test and learn some of these principals by starting with the straight track piece. (I'll post pictures soon).

Alright, I am sorry that it has taken me so long to get back to re-posting things again (it has been about a month). Things did not go quite as planned. As it turned out figuring out how to create custom texture maps, UVs, Normal Maps, and poly reduction is a bit more time consuming and complicated than I first thought. Because of this I only completed 5 out of the 15 models or so. Here is what I did. I completed some of the most essential pieces first so that just in case I ran out of time I could still make a level with the pieces.

First I had to do the poly reduction:

Straight Track
Original Smoothed/Subdivided Poly Count:    17,896
Current Smoothed/Subdivided Poly Count:     6,432


Curve Track
Original Smoothed/Subdivided Poly Count:    17,896
Current Smoothed/Subdivided Poly Count:     6,440


Tunnel Entrance
Original Smoothed/Subdivided Poly Count:    35,896
Current Smoothed/Subdivided Poly Count:     4,990


Tunnel Straight
 Original Smoothed/Subdivided Poly Count:    24,000
Current Smoothed/Subdivided Poly Count:        864


Tunnel Bend
Original Smoothed/Subdivided Poly Count:    24,000
Current Smoothed/Subdivided Poly Count:     5,776



Then I had to UV map the poly reducted models (This part took a long time). I didn't realize how long it could take to UV map a model when you are trying to map it into different sections so that it will be capable of housing multiple different textures.

Straight Track UVs



Curve Track UVs



Tunnel Entrance UVs



Tunnel Straight UVs



Tunnel Bend UVs



Texturing it came next which also took some time, besides having to look for some base textures to use, I also had to create multiple panel textures, outside textures, and floor textures. Sometimes the UVs didn't quite match up with the textures so I had to go back and redo parts of them.

Straight Track Textured


Curve Track Textured


Tunnel Entrance Textured




Tunnel Straight Textured



Tunnel Bend Textured



I put a lot of effort into these models and if I have time I would like to go back and complete the rest of them. Go to the next blog on "Project 3: Bringing Everything Together in Unity 3D" to see what I did with them.

Notes on finding textures:

I am finding it difficult to find good textures to work with. A couple of the better websites that offered decent textures were http://www.cgtextures.com/ and http://www.mayang.com/textures/ . The part that I found most difficult was trying to find textures that I could mess around with in Photoshop. If metal pieces (like the ones I was looking at) had concrete or something other than a solid color in the background it becomes time consuming and sometimes difficult to dissect the texture you want to use from its original photograph.

Monday, September 23, 2013

Project 1: The Race Track

Hello everybody, here is what I have been doing with the track pieces. I have run into some snags along the way (which I will mention briefly), so I am still trying to figure out my best course of action. This will count for project 1 of "Gaming and Animation Studio".

I looked at some examples of sci-fi architecture and race tracks on games like F-Zero and WipeOut and I saw that the track models, for the most part, looked pretty simple. Just standard walls and roads of differing shapes and directions. I noticed that lots of sci-fi space craft and buildings are very geometric, but the edges are smooth. Here is the track that I built.

In the beginning I started to build the straight track piece using a planar modeling approach, but I ran into various problems. So I started over with a cube instead and added a lot of edgeloops and extruded a bit.


Here is the track piece from various angles.




Then I started working on the bend piece. This piece only took about about a minute haha. I used the Bend modifier on the straight track piece.



I read an article about Skyrim's modular level design on how they built a specific number of pieces and then reused them over and over again in different configurations to build the game. I wanted to do similar with the track pieces. I want to make a specific amount of track pieces and then be able to connect them in Unity 3D is different configurations. As you will soon see. I have been running into some problems with this.

I then decided to make a ramp out of the of the straight track piece with slight modifications.



All of this worked so far because of all of the pieces being built from the same base track piece. In Unity everything fit seamlessly together, just like I was planning.



But things started not fitting seamlessly once I started making the tunnel pieces. In order for the sides of the track to seem to flow seamlessly into a tunnel I started making an archway piece.



Things still worked even then. I was able to fit it to a straight track piece seamlessly. I then decided that since the archway was for the tunnel track piece anyways that I should just make them one piece.

It took some doing and I had some problems with welding and bridging the the pieces together, but I was finally able to do it and made sure that the tunnel had the same amount of edges as the straight track piece. Originally, I didn't have that many edges, but I ran into problems when I tried to use the bend modifier; so I had to rebuild it.



This piece also connected correctly.


Then I built a straight tunnel piece duplicating part of the tunnel entrance. It connected, but only on on side. You might think that would normally be fine, but I started running into problems once I turned the piece into a bend tunnel.



The piece looks simple enough right? When I imported it into Unity it connected only on one side.


Then I flipped it over to see if I could connect it on the other side. Now note the fact that I took this straight piece, cut it in half, and then used the mirror modifier; so each end should be exact the same shape.



The bottom of the opposite side connected seamlessly, but the edges were always a little bit off no matter how many times I tried to connect it.

I made the bend piece from this same straight tunnel.



Because of this, I had the same issues in Unity. Also I could only make the tunnel turn to right, not to the left.

Problems Connecting Left


Connects If You Try Make the Tunnel Bend to the Right




 This is where I have left off things. I am still trying to figure this part out and can't advance until I do.

Wow! It has been about a month or more since I last updated my blog sorry everyone. A lot has been added to this project. 

First off I was able to fix the "seams not matching" problem. I went back to the original tunnel piece and found that the left side and right side of the model didn't match (lines and vertices), so I cut it in half and then used "mirror" on it and then "bridge" to connect the middle (you can also mirror them and weld the vertices, but sometimes bridging them works faster; "symmetry" works too).

Once the initial piece was fixed, everything else that I built using that base mesh worked correctly.

Okay, I will try not to be too long in my explanation of the following pieces. With some of them I had major problems while building the models and ended up learning new tools because of it. Here are all of the current pieces right now:

Straight Track Piece
 (Made with a box and extruding.)


Curve Track Piece
 (Used straight track piece with a bend modifier.)


Ramp Track Piece
(Used 2 straight track pieces. Rotated one 30 degrees. Deleted all but a small portion of the 2nd piece and then welded it (horizontal) to the rotated track piece. (Oh this may have been confusing; this is actually two of the completed ramp track pieces. I made it so that I could make the ramp as long as you want with and then connect the ramp pieces to a straight track piece))


Tunnel Entrance Track Piece
(Used 2 straight track pieces. One small section to be welded to the archway. For the second piece I deleted everything besides a segmented side and used the bend modifier on it (I had to mirror it later). Once I connected these two pieces then I extruded the border of the archway to make the tunnel.)


Ramp Tunnel Track Piece
(In the beginning I didn't know if I was going to use this piece, but I found use for it in the "Building Model". Selecting some of the faces of the tunnel entrance track piece I was able to rotate part of it into a ramp.)


Straight Tunnel Track Piece
(Once the entrance piece was mirrored  and fixed I then remade this piece too. I selected all the faces of the tunnel besides the archway and duplicated the faces. After adding one or two edgeloops I had my straight tunnel track piece)


Tunnel Bend Track Piece
 (Used straight tunnel track piece with a bend modifier.)


Slanted Curve Track Piece
(This piece took a lot of time to figure out how to build and required 6 straight track pieces. The hardest part was getting a appropriate angle that a craft could fly sideways without falling over. I used the "bend" modifier, "4 X 4 X 4" modifier, and welded a ridiculous amount of vertices.)


Forked Tunnel Track Piece
(This piece also took a lot of time to make. I used two tunnel bend pieces and a straight tunnel piece. After connect two tunnel bend piece (making a u-bend) I cut a hole in it's side. The most difficult part was trying to figure out how many extra edgeloops I needed to add in order to weld the hole's vertices to the straight tunnel piece. I was able to do it, but it was painful.)


Spiral Tunnel Track Piece
(Here was yet another time consuming project haha. This piece consisted of about 18 (might have been more) straight tunnel pieces. I connected all but two together using modifiers like "mirror", "symmetry", and "weld". I then went to the "shape" panel under "Create" and created an editable "Helix" spline. I proceeded to give it a width about the size of my tunnel and added the amount of rotations I desired. I selected my 16 piece long straight tunnel and (after a lot of research) found and attached the "Path Deform (WSM)" modifier to it. I then clicked "Pick Path" and selected the Helix. After that you use a combination of the "Percent", "Stretch", "Rotation", and "Twist" parameters to get it looking right.


Tri-Tunnels Track Piece
(This piece was composed of multiple pre-built pieces. Most of the time was spent assembling and welding them together. The idea behind it was the player would enter a space building and then choose from one of three tunnels. Two would be would be accessed through tunnel ramps and the other was there just in case you missed the jump. I had some problems building it, but I figured out a solution in the end. I duplicated some of the border edges of all of the tunnels and then used the "Boolean: Subtract A from B" to cut the right shape out of the planes. In order to get the right shape I had to add a lot of extra edgeloops to the planes so that it would cut it out correctly. They are still two separate pieces though so that one can be smoothed (the tunnels) and one can remain a wall.)


Cross Roads Track Piece
(When I was trying to assemble everything in Unity, I ran into some problems with everything connecting properly. Because of these issues, I had to build a specific track piece to connect both ends. For this piece I used two tunnel entrance pieces, one straight track piece, and a lot of patience. It took quite some time (I went through the Sherlock Holmes and Dark Knight movies while I was building it). It wouldn't have been too bad after connecting everything, but things don't always go as smoothly as you would like when you are modeling. After everything was connected there were parts of the straight track piece geometry that turned black. I researched this and some people mentioned problems with the Normals. I tried multiple things to fix it like: 1. Selecting all the faces, going to "Polygon: Smoothing Groups" and clicking "Clear All" and trying "Auto Smooth", and 2. Selecting faces and right clicking "Flip Normals". In the end, the only solution that I found was deleting faces, re-selecting the "border" of the deleted face, and "Cap-ing" off the opening. I guess rebuilding the geometry worked. I have a suspicion on how one might prevent this from happening though, I discovered it while building the next piece.)


Special End Ramp Track Piece
(This was to be connected to the cross roads piece. After building most of the track in Unity, I needed something that would re-align the track's beginning and and its end. So I built a special curve leading to a ramp piece. I used 3 straight track pieces and 1 ramp piece. While building it, I had the piece divided up into 4 parts and when I tried to connect it I ran into problems with the geometry turning black. I examined the pieces and found that the pivot points where all different!! So I decided to individually go through each piece and go to "Utilities/Reset XForm/Reset Transform: Reset Selected". This set all of the pivots to a common default value and when I "attached" them all together I received no black geometry. I am still not quite sure what the problem was, but I was happy that I found a way to fix it!)


For the time being these are all of the models I am going to use. I need to move on to poly-reduction, creating normal maps, UVs, texture maps, and possibly bump maps. This will be step 2. Get ready!!!