Thursday, May 8, 2014

Learning Unity

I started to learn Unity 4.3 since it seems like a good thing to be able to throw on my resume and I have heard nothing but good things about the engine overall. I made Pong, it is terrible and has a lot of bugs and looks like crap because I made the art, but the goal was to learn how to create a simple game in Unity. I made a build of the game for the Unity Web Player but since I cannot upload files like that to blogspot the best I can do for now is post a screenshot of it for you to see.

Like I said before, it is pretty ugly but the point was to get the basics of a simple game up and running so that I can learn how to use the engine and complete a project. Unity has been super easy to pick up and just start running with. The user interface is wonderful, the integration of scripts in the editor make tweaking variables in the scripts incredibly simple and fast. The only thing I had any issues with so far was learning how to make a simple 2D sprite animation since there was no documentation on the Unity website that I could find about the animation tools.

I am definitely going to be using Unity more in the future, it is easy to use and I am learning a lot quickly. Also it is nice to learn some C# as I go along. I may bounce between Unity and working on a simple render engine in C++ using the latest version of OpenGL. I will post more with more projects as I continue learning!

Sunday, February 19, 2012

It's like Tetris...

I have been working on this idea I have had for a long time now. The idea is a different game mode for Tetris that I have never seen done before, so I figured I will try it out. Every time I have seen multiplayer Tetris it is where each player has their own screen with their own blocks and they compete to get the most lines which will usually drop block onto the other players screen. This works well and has been copied by many other similar puzzle games for their multiplayer features. What I wanted to try was having 2 player playing on the same screen at the same time, so that they have to work together to create lines while at the same time competing for who gets to clear the line and get the points.

Playing the game I think is pretty fun but the biggest issue I have run into with the design of how the game plays is how to best determine a winner. Right now it goes by whoever clears the most lines, but this makes for the situation where one player can get one line and then cause the game to end and they win. What I did to try and prevent this was add a score penalty for being the one to trigger the lose condition. Right now the penalty is - 10 lines, but that just means you only need an 11 line lead and we are back to the same issue. Maybe this is why I have never seen this game mode before, I cannot come up with a clever way of handling the scoring to where it is beneficial to keep going and try to get the highest score possible. I did also make a 2 player co-op game mode where both players are on the same board but lines only count toward 1 total score so they can see how well the can do together.

Since the game was made in Flash (I wanted to learn ActionScript 3.0) You can play it just below. Feel free to give me any feedback you have. The game is mostly just a proof of concept so its lacking actual art, and sound. I also would like to change how rotation that ends in collision works. Currently if you rotate into a position where you would collide with something, it just prevents you from rotating. What I would like is for it to try and push your block away from what its colliding with and allow the rotation to happen if possible. I will probably make that work soon.

Also, if you can come up with a clever name that doesn't rhyme with Tetris, I would appreciate it.

Player 1 Player 2
W Up
A S D Left Down Right

W and Up rotate the piece (only rotating one way, not sure on the best way to lay out the keys for 2 player being able to rotate both way. Please comment if you have suggestions on this!)

S and Down Arrow drop the piece fast.
A, D Left and Right move the pieces left and right.

Monday, February 13, 2012

It has been too long

It has been almost a year since my last blog post, it has gone by so fast. A lot has happened in the past year, I went to Brazil twice, and I just recently shipped Gotham City Impostors, among many other things.

There has not been a lot of progress on side projects this last year. I dropped the XNA stuff and went to work on this twist on Tetris that I have been thinking about and wanting to try. It is all done in Flash using ActionScript 3. I will make a post about it once I have picked it back up again and made some progress worth talking about.

Lets hope its not another year before my next post!

Monday, February 28, 2011

Testing out XNA

As I had stated in a previous posting, I have started a new side project. This time it will be a game that will be written using XNA 4.0. Hopefully this game can turn into something that can be shipped on PC and for Xbox Live Indie Games. For this post I am going to talk a bit about my initial experience with XNA and what my thoughts are about how it stands as a platform for creating games.

Microsoft XNA Game Studio 4.0 is a suite of tools developed by Microsoft for creating games for Xbox 360, Windows PC, and Windows Phone. XNA is a very easy to use set of tools that will easily enable someone to quickly create games that can run on any of these three platforms. I have only started toying with XNA but I can already see why it has become so popular, it is incredibly easy to use, just download the tools and install everything and you are ready to start. XNA has an extremely easy to use content system where you can load in nearly any type of content from 2D images to audio files, 3D models, or loading up sprite fonts for drawing text and have something drawing on screen in just minutes. Also since XNA is a managed language it is fairly simple and forgiving to programmers who are just learning how to code since they don't have to worry too much about the intricacies of memory management (but coming from a mainly C++ background it still pains me inside to call new and not have a matching delete...). I would easily recommend XNA to someone who has some coding experience in the past and wants to start working on some games with graphics. XNA does a ton of the back end heavy lifting off of the developers so that they can focus much more on making a game rather than resource management or other things.

The picture above is is from my little test program where I have just been following along with some tutorials and learning the basics of how XNA works. I have to recommend that anyone looking to start up with XNA check out the tutorials on RB Whitaker's site. I have been following these tutorials and these are very easy to follow, well written, and overall very enjoyable to use (which I cannot say about most other programming tutorials). There are still some tutorials on the site that have not been updated to XNA 4.0 but it is clearly posted on each tutorial if it is XNA 4.0 compliant or not. My little test program is just a mish-mash of the different tutorials I checked out with a few other things I was tinkering with on my own. That is why there is a space shuttle sprite, a planet, some alpha blending spheres and a rotating 3D helicopter... It looks like a bunch on crazy stuff on screen but I have learned a ton from it.

For my actual game project I will start working more on that now since I have a feel for XNA and how to work with it. My project will also be using the Farseer Physics Engine for the more physics based elements of the game. I have implemented this into my project and have a few things moving around and colliding which was not too much work. I will probably make a post about Farseer later once I have a better understanding of how it works and if I find any issues with it. My goal now is to get some sprites into my game and attached properly to the physics objects so they look like they are colliding with each other properly. I want to do this before my vacation to Brazil which starts in about a week. I am confident that I can accomplish this goal.

Monday, January 17, 2011

End of a project

This will be my last post about the ray tracer for a while since I will no longer be working on it. I have been slowly working on it for a while now and I have gotten to a point where I am happy with what I have accomplished but I need to move on to something new. This something new will be an XNA game that will hopefully be able to ship as an XBox Live Indie Game someday.

As you can see from the image I was able to get a 3D polygonal model loaded up and rendering. I used the ms3d format for the model since it is a very simple and easy to use model format. also the texture is a 24 bit uncompressed tga for similar ease of use reasons. Getting the ray tracer to this point was a lot of fun. I would recommend that anyone who has any interest in writing a ray tracer should give it a go. At very least you could spend a day and get some reflective spheres drawing and looking awesome! If you have any questions about how it all works or what I did feel free to ask anything in the comments.

For the next project I think its going to be a 2D platformer type game (probably 2D rendered on 3D planes). As for specifics of the gameplay and design that is still being worked out but I will have time to take care of all that while I am working on the initial tech for the game. Also I will be working with the house mates for design and content on the game. I am hoping that this will be a very fun project to work on in my free time.

Monday, December 27, 2010

Holiday Update

Now that it is the holidays and I am not at work for a whole week I have no excuse to not update this blog with the work I have done on the ray tracer. The updates since the last time I posted have not been huge visually but they have been helpful in keeping me working on this project, which at times can be the hardest part.

What I have done is a few things. First, I went through my render pipeline and used Intel's Threading Building Blocks to easily multi-thread my rendering. I did this mostly as a quick test to see what kind of performance gains I would see while running this on my laptop. The starting speed of the ray tracer before adding in TBB was about 1400-1500ms per frame. That is running at 1280x720 resolution, not a very respectable time. After (sloppily) throwing in TBB my frame time dropped to around 400-500ms per frame, just adding in TBB (which was not much work) brought me out of the realm of Seconds Per Frame and into the wonderful world of Frames Per Second! Also if I drop the resolution down to 800x600 my frame time dropped to around 140ms per frame, that's nearly interactive!

Another change that I made as you can see in the picture is that my triangles are properly casting shadows now. The first iteration of the triangles did not cast shadows because the back faces were being culled, and to properly have a shadow be cast I need a ray to hit the back face of the triangle. The big problem with having a triangle be able to cast shadows properly is that you essentially have to check against the triangle twice per ray, once for the clockwise winding and again for counter-clockwise. Adding support for this allowed me to add support for being able to choose your triangle winding though, now you can choose clockwise, counter clockwise or both. Also the single triangle shadow issue wont be an issue at all if you have a closed mesh since the ray would always intersect with a triangle in the mesh when checking for shadows.

The final update I made was actually a bug fix rather than an "update". I had anti-aliasing in place since it is very easy to do edge detection with a ray tracer, but it never quite looked right. I just passed this issue by and moved on to bigger and better things, but after talking with a friend of mine he convinced me to go back and fix this issue before the bugs started to pile up. There were actually two issues I had, one was that I was not storing off the original colors from the first ray trace that detected the edge properly, the second issue was that I screwed up some very simple math and was doing six samples when my math assumed four. I fixed those two simple problems and now my anti-aliasing looks smooth and nice around those edges.

Future work that needs to be done is that I still need to get model loading in and working, I may start with some third party library for loading models and roll my own when I see fit. Also there is one more known issue that I want to take care of which had to do with floating point precision errors I was seeing back when I was using floats for everything. I want to move back to floats because I find doubles to be a waste of memory and a potential performance sink since if I use floats ( or to be more clear, 32 bit single precision floating point values) I could optimize a lot of my vector math with SSE.

Sunday, October 31, 2010

It has been a while.

Well, I would like to say that I have been hard at work on my ray tracer but that is not very true, I have mostly been hard at work... at work. Since my last update many things have happened, Blacklight: Tango Down has shipped, it is available on XBLA, PC, and PSN, check it out! Shipping Blacklight has been the biggest thing keeping me from writing this update, also I just recently got a new job, I am starting as a UI Engineer for WB Games tomorrow (Nov 1st). I am very excited about this new position as I really like the project I will be working on and I have worked with many of the people there in the past and there are all top quality. Also the new project is not announced so I cannot talk about it, sorry.

Onto what I actually did on my side project recently! As you may be able to tell from the picture, there are two triangles on the screen, your eyes do not deceive you. On top of that there are textures on said triangles. That has been the majority of the work I have been doing lately, just getting triangles and textures in and functional. Now I can move onto whole lists of triangles and loading models and various other image formats so that I can display something that looks nicer than a reflective sphere. I have been reading a lot on barycentric coordinates lately to get the rendering and textures working for the triangles. I have been having a bit of a hard time understanding them so I have been spending a lot of time just trying to figure out how they work.

Yea, that's pretty much the progress so far, next up is to add model loading, clean up textures and materials in general. Also I need to add support for choosing the winding on triangles so that model loading can be easier and I can support shadows from triangles easier. I hope the next update will show up much quicker than this one did.