Tuesday, November 6, 2012

man i don't like blogging

we finally did a bit of playtesting (kinda since it wasn't with anyone else) and I think it went fairly well. I have learned a lot from doing the prototypes, the biggest thing being that we need to work and plan together. Doing the physical prototype at the start of the project i think helped everyone get on the same page about how the game will play and how the components will work together. And this first iteration I thnk was also helpful to do. It took a lot of time and could have been more useful, but I still think it was worth it.
It allowed us as a group to see the game and comment on what we need done. I feel like we probably spent a bit too much time on specifics of what we want in the game and less on the fun of the game. We did talk about how we think we can make the game fun a bit. So we do have an idea on what to iterate to find the fun, but I felt it was more vague than I had hoped. So maybe we could have spent more of that time on what would make this fun and less on specific components to implement. Although we needed to discuss those things I think they could have been discussed offline between just the programmer of it and the designer. Although this would take out the rest of the group from the design of that component.
Overall I am happy I have finally iterated on a game at least once (or in the process of the first iteration after the creation of the game). I also feel like we could do this iteration process better, and that even just this one try will allow us to do better the next time.

Thursday, October 18, 2012

Using a texture for data

For coloring the world I was putting the color value into the vertex. then in the pixel shader i would multiple the color by that color percent. this worked, however it depended on the size of the triangle and even more importantly it required changing of vertex data. So I had a dynamic vertex buffer and was setting data to it each frame. However this became a problem when the grass was added as it had 17 vertices and 84 thousand objects.
So after reading an article about GPU particle systems from Jon, i realized I could use a texture to hold the color value of that area. The texture would be like a grid over the world such that every spot on the world points to a pixel in the texture (which holds a float of its color value). I can calculate that location in the pixel shader (or vertex shader for the grass) by (position.X - minWorldPosition.X) / worldSize.X. Then i can do the same for the Z axis. I do not consider the Y axis for this, although i could use a 3D texture if i wanted to include the Y axis.
The nice thing about this is to change it i do a draw call and the GPU handles it (which is very optimed for exactly this). I have a circle in a vertex buffer which is what i actually do the draw call on. I set a scale and translation matrix for that circle in the shader so the circle will be centered to where i want it and the size i want. I wrote the circle's vertex positions in screen space (which is really texture space) so i only needed to scale and translation, not project.
This would set all of the values on that circle to the color percent. However i also wanted a gradient. So I used the Z value of the vertex position (of the circle's vertices). I wasn't using the Z value because i was drawing right to a texture of floats, aka i didn't have a depth buffer and so wasn't doing any depth testing. I set the center of the circle to a Z value of 1 and the outside edges to 0. Then when the pixel shader got that value it was between 1 and 0 for how far out it is from the center. Thus i can set it darker or lighter according to how close it is to the center.
Then for lighting the world i used an alpha blending of Max. Where it would take the larger value between the value i was setting from the draw call and the value that was already on the texture. And for darkening i used a Min alpha blending.

Overall this helped the efficiency of this tremendously. Although the grass itself still needed more optimization (such as cpu visibility culling). But i learned a lot about shaders doing this process and any time i need to pass a lot of dynamic data to a shader i will first look into using a texture.

Monday, October 1, 2012

Change in philosophy

This weekend was interesting for making the game. we had a working version of the game but it was very simple and did not feel like a game. The giant just walked around and the lanterns were simple. However Sagar is working on the giants and Jon is working on the lanterns. So i decided to take on atmosphere of the game instead of gameplay mechanics. To do this i made grass that moves by wind and snow.
The grass was interesting to make, at first i made it without it moving. but grass that does not waver at all looks strange and not like grass. So I made it bend. However i made it bend away from the player so the the wind is coming out from the player. However when an object is bending away from you it isn't easy to tell what it is doing because the only real change you get is that it gets shorter. So the grass looks like it is just getting shorter and taller. Also i have them all oscillate at the same time which is also not how grass works. Wind as it goes through makes the grass bend in some local areas and not bend in others. So i need to implement the bending of the grass using a sine wave that will move through the area. Overall it was good because i am challenging myself in making both the particle system of the snow and the grass.

Tuesday, September 18, 2012

Starting with a new project

This is an extremely interesting project. For the second time we have a client that does not have anywhere near a set idea of what they want. For this client they may not even want a game. I think they would be happy with even just an interesting virtual world without game objectives in it. But being left with very open options could provide for very interesting ideas from the groups. Overall the project is awesome because of the technology we get to work with. We are going to be the only four groups developing games for this technology. Also the project is grant funded, which means we have a good chance at continuing work for this after the prototype ends. People more easily give grant money out than their own money from my experience.
The other part of the project is the team I am working with. I remember taking note of Jon when we came into the game design class as he seemed to really know what he was talking about. It is still my dear wish to have him on the project team I am on for the really game project. I had also wanted to work with Sagar because he seemed intelligent and inquisitive in regards to game programming. He had come up to me a few times in the past weeks to ask questions, which shows he isn't just here to get through it. So I get a group with two engineers whom I wanted to work with during this prototyping projects course. Then Andrew I had already had a few good conversations with and he really seems to know technology quiet well.
Although the one downside to a team this god is that we have a hard time coming up with an idea for a game. But hopefully they figure something out, all the ideas we have had are good ideas. And any game idea we come up with I think will turn out well as long as we keep it within scope.

Wednesday, September 12, 2012

Post Mortem

The project went well overall. I was able to learn some interesting things about game developement and just working on a project in a team. The main thing that I learned from doing this project was that we need to not try to do too much in the last part of the project (in crunch time). Trying to add so many things right near the end ended up making them not very productive. If we had chosen one thing to work on then i think we could have put that one thing into the game and done it well. However trying to doing three to four things for the game in the last few days ended up hurting our productivity for those last days.
Another important thing is that I learned further the importance of a version control system. Even if we don't use a program for it, we should set an exact way we are going to handle version control.

One other thing is that the other engineer did not get involved in the project until alter into it. I am not exactly sure how to make sure we are both working on the project, but at least i will make a consorted effort to have both of us working on the project early.

Monday, September 10, 2012

Third Week

This week was good, which is needed because it is the last week of development.
I was able to load in the level after some time. I had to go back into the fbx loading and bring in the rotation and scaling of the objects. Then when loading them have moai do the rotation and scaling.
I just made a separate collision object for each piece of cheese instead of doing something automatically. For the collision object i figured out I could just take the aabb info from it instead of the geometry. Then for collision detection i just did a point vs aabb. So the game has collision detection and still runs smoothly. I was also able to load in animations. Although i did it in a very inefficient way by having each frame of the animation put in a different picture, then just flipping through the different pictures. This makes the game load about 17 mb into memory but it still runs quickly.
I ran into some strange problems when doing animation stuff though. The game would just crash, at the same point every time, without an error or any reason i could discern. Then i would add a print statement above where it crashed and it would work. So i have a few print statements which i think is slowing down the processing long enough for the data to actually load.

Awesome work by someone to get sound to work, apparently it was just linking directX to that project and then compiling it. But for a bit of work during the final week it looks like we may put sound into the game, at least some. Although he said there is a delay from when you play in the game to when you start hearing it. So that would make it so we can't do a sound by reaction, like every time they hit a piece of cheese. But we can at least have background music.

second week

Second week got a lot done. Was able to get a level parsed from fbx and loaded into the game.
Figaured out that if you have the unform World_Transform then MOAI will put the objects world transform into that variable in the shader. So i am able to have one piece of geometry copied around the level. Still don't have the ability to run a character through the track or to pick up cheese (or have cheese in the level).
I tried to work on sound but it was strange. The guide said you link directX to the project and then compile. However it was able to compile without directX linked, which means to me that something isn't set for it to try to include sound or I just have the wrong project.

next week I'll start to really make a game, Damean said he will get me a level and i'll then work on loading that in and doing collision detection. Then I can start working on features like scoring, menus, animations.