Wednesday, October 24, 2012

Week 7 blog. Last day of class.

This week is the last week of class. So we had to show off our games. I saw many good games presented by other groups and got feedback on my groups level. Our level wasn't too bad, but a large setback with udk problems one of our members had caused us to fall a bit behind. As well there wasn't always a lot of time to work on it. But for the most part I like how the level went.

The last part I went over when working on the level was making guns and sounds. The guns were pretty simple, and the code was pretty general. But I found that my gun was not designed to the game like I had thought it was. The ammo it could hold was low, and the enemy was numerous. Because I wasn't as sure of how many people we were going to fight or the pickups that would be available, we had to make a shortcut that would give you infinite ammo. I had considered the idea of the weapon having infinite bullets seeing as to how it was a energy weapon, but I wasn't sure of how to code for that in script.

As for the sounds, They were all set up correctly, and I believe they were working. But when we presented the level the sounds seemed to have disappeared. I wasn't able to test the sound before hand to tell if the different way I did it would work. The way I did it was to copy the UTPawnSoundGroup files and rename them to our custom game. Then I installed them in the custom game, which may not understand that it is suppose to use the custom sounds from there.

Me and my group are hoping to get more work done on it and polish it up a bit. But with other finals and stuff like that, I'm not sure if we will get around to that.

Tuesday, October 16, 2012

Week 6 Blog.

This week we went over adding new guns, vehicles, and packaging. For the most part everything went pretty well. I ran into a few problems when working on everything. It turns out that most of the time importing things into unreal makes them have a rotation of -90 in yaw. By setting it to 0 I was able to make the gun face forward and the car drive forward.  My car also had a problem with some of its tires going backward and wobbling. I fixed this by setting inverse wheel rotation in the anim tree for the car, and adjusting the bones for the tires to stop the wobbling.

After those were done, all that was left was to package everything. I had a few problems where I had to go through the maps and reset the names of the maps to things that wouldn't cause problems. They can't have spaces or they will brake during cooking. As well, I needed to have the prefix to make it so that the maps would use my custom game type. After all that was set it packaged fine.

Tuesday, October 9, 2012

Week 5 blog. Work with a camera.

Today i finished some of the coding things we had to do for the class ilab. It was for the most part pretty easy, but the sound part was the most time consuming of all of it. Though the final outcome of the sounds in game were pretty nice, so I guess it's not that bad. Another of the tasks I had to do was make a custom camera. I always liked isomorphic style games, so I wanted to make mine with that view type. The code online gave me a pretty nice one, though I had to adjust the pitch angle a bit.

I had to customize the code a bit, so I was thinking about what could be improved. While moving around I noticed the camera didn't stay behind you, which is often a problem in a game with shooting. This would have made it impossible to work with a gun, so to fix it I had to change the code to rotate the camera around the character. It was a pretty simple fix by using sin and cos to get the new x and y location for the camera based on the characters yaw rotation.

The code looked like this at the end:
//The "Rotation" is the player's.
out_CamLoc.X -= Cos(Rotation.Yaw * UnrRotToRad) * CamOffsetDistance;
out_CamLoc.Y -= Sin(Rotation.Yaw * UnrRotToRad) * CamOffsetDistance;

out_CamLoc.Z += Sin(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;

//I also adjusted the camera yaw so that it would keep an eye on the player.

out_CamRot.Yaw = Rotation.Yaw;

/*This part of the code was just a little bit of something I found interesting. When turning with the mouse or a little with the left and right button, this would make the camera tilt in the direction you were turning.*/

out_CamRot.Roll = Rotation.Roll * 2;

There was also a small bug that I needed to fix. When I was playing with the camera I feigned and found that getting back up broke the character. I fixed this by making "var UTPlayerController UTPC;" declared at the top and writing in the code:

if (!bFeigningDeath) //bool if not feigning   {
     UTPC.SetBehindView(true);
//reset to behindview. feign resets to FPS view when in behindview.   }

After fixing up those few things I found the camera pretty well set up and ready to go. But then the obvious came to mind about what happens when a camera so far away is blocked.

After doing some searching I found that there is a trace function that will check if there's any collision with anything between the camera and player.

//If you search for trace function in unreal, you will find out what these parameters mean.
if ((Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(0,0,0), )) != none)
   {
     out_CamLoc = HitLocation;
//this sets the camera to where the collision happened.
     out_CamLoc.Z = 100; //this was just to keep the camera at a head level height when against a wall.
   }

Tuesday, October 2, 2012

Fourth week's blog.

This week we covered more interesting things. I wasn't too into the 3D work, but now it's heading back to the 2D programming. Now I just have to worry about the whole new set of syntaxes and other things that the new code language has.
The problem with 3D work in this lab was pretty big with level streaming and cameras. It was almost impossible to keep the camera from no clipping through walls, so I had to keep it nearer to the player. As well, when the character dies the actor freaks out, so I had to deal with that by adding a special camera setup for it. It worked out pretty nicely I think.
But I think what took the most time, was the level streaming. In a map that is well planned out it would have been a piece of cake; too bad I had a week and only 2 levels to use. I ended up having to mostly put the shell back together on the persistent level to keep from having graphic glitches and to keep from noticeable objects missing. If the building had more stuff in it, I would have felt more like I accomplished something. It may not have saved much space from the map to the buildings side, but at least I know the building to the map saved space.