int main(void)
{

My Blog

Posted 02/24/12 @ 3:19am - By Ross

Day One DLC…more like Day None!

OK, so it’s a lame pun. The point is I’ve seen a lot of talk about DLC content being available on launch day lately, most recently with Mass Effect 3. The reaction to this can be summed up as follows:

To be perfectly honest I think some of that is justified. I can’t say that EA or Bioware has done a terribly good job of handling the PR surrounding this. Its easy to look in from the outside and say that they took time away from making the game to make DLC that they could charge for before the game was even released. The reality, though, is that it’s not that simple.

Looking at it from the dev cycle side of things, by the time the game is largely finished the content generation team is about done. They might help fix bugs as the testing team finds them or correct small things here and there. But their primary function is over. Then, once the game is fully tested, you have to send it off to production. The point is, there is a fair amount of potential wasted time. Why not keep the content generation team generating content after they’ve finished the game? It seems very reasonable and more efficient in terms of resource use.

However, if you take issue with DLC in general then I see your argument as being completely valid. The industry is largely changing direction towards a micro payment system and not everyone is on board with that. Still, EA and Bioware should be given some slack. It may not be hats, but at least they are trying to provide content.

Posted 02/17/12 @ 11:09pm - By Ross

Interviews

Interview questions are the bane of my existence. Something about someone waiting on you to solve a problem causes me to second guess everything I do. However, I do find them interesting to think on after the interview is over. In a recent interview I was asked a question about removal of spaces from a string. My first take on the problem came up with the standard O(n2) version of the algorithm.

Here was my take on it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void TrimSpaces(char* word, int size)
{
  int ii, jj;

  for(ii = 0; ii < size;ii++)
  {
    if(word[ii] == ' ')
    {
      for(jj = ii; jj < size - 1; jj++)
      {
        word[jj] = word[jj + 1];
      }
      size--;
    }
  }
}

It’s a fairly straightforward implementation. Loop through and find each space and then shift over all the other characters in the string. In use it actually shouldn’t be too bad since spaces are typically less than half of the characters in a string. Regardless, it’s still not as efficient as it could be.

So as I laid in bed the other night a better solution occurred to me that can be done in linear time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void TrimSpaces(char* word, int size)
{
  int ii;
  int offset = 0;

  for(ii = 0; ii < size;ii++)
  {
    if(word[ii] == ' ')
    {
      offset++;
    }
    else
    {
      word[ii - offset] = word[ii];
    }
  }
}

In going through the string we simply keep track of how many spaces we have, then we know how much to shift the string as we go.

Another possibility is the allocation of a new string and copying over all characters except for spaces. This works well if you must preserve the original string. However, if you are merely editing the string an in place solution is superior.

Posted 02/15/12 @ 5:13pm - By Ross

Dashed Lines!

So I recently have been playing around with shaders on my Android project and with the removal of stippling from the OpenGL I thought that I had found the perfect opportunity to use a shader. With some thoughts in mind I decided to search the interwebs to see if I was thinking along the right lines. Unfortunately there isn’t much out there on OpenGL ES 2.0 yet. So it fell to me to come up with something that would work, and work it does!

The basic premise was pretty simple. Find out the world coordinates of each fragment and then, using that, determine it’s length from the line origin. Then plug that into a cosine function and alternate drawing it based off if the value returned is negative or positive.

The key to the whole thing is sourcePoint being passed in as the origin of the line. It’s also worth noting that I pass in the modelview matrix and multiply it with the vertex to determine where it is in world space. The use of position as a varying variable is also important since it is interpolated based off all the vertices that affect it. This allows for the position variable in the fragment shader to be the actual position of the fragment in world space.

With all this, I determine the distance between those two points and then use the cosine function (modified based off how I want the dashes to look) to decide to draw it or not.

So without further ado, here is my vertex shader:

1
2
3
4
5
6
7
8
9
10
11
12
uniform mat4 u_modelViewProjectionMatrix;
uniform mat4 mv;
attribute vec4 a_position;
attribute vec4 a_color;
varying vec4 v_color;
varying vec4 position;

void main() {
  gl_Position = u_modelViewProjectionMatrix * a_position;
  position = mv * a_position;
  v_color = a_color;
}

and the fragment shader:

1
2
3
4
5
6
7
8
9
10
11
12
precision mediump float;
uniform vec2 sourcePoint;
varying vec4 v_color;
varying vec4 position;

void main() {
  if (cos(0.1*abs(distance(sourcePoint.xy, position.xy))) + 0.5 > 0.0) {
    gl_FragColor = vec4(0,0,0,0);
  } else {
    gl_FragColor = v_color;
  }
}
Posted 02/11/12 @ 1:19am - By Ross

Added some old sites

Went through some of my old files and found a few of the old sites I designed. Unfortunately they aren’t fully functional, but they are the basic designs I came up with so I figured I might as well put them on here to preserve their memory. I wish I had all the sites I’ve made over the years but, hindsight being 50/50 and all, I’m glad I have these few.

Check out my portfolio page if you’re curious what they look like!

Posted 02/08/12 @ 3:31pm - By Ross

GLES2 conversion

The game I’m developing for Android utilizes an open source OpenGL library called AndEngine. I’ve been experimenting with it for about a year now and finally feel as though I’ve got a solid handle on it. But about a month ago I got thrown a curve ball. The core got a huge update as they converted it to support OpenGL ES 2.0. While this is great as it increases it’s functionality, there is a whole new slew of relearning I had to do.

So what changed? First off, the use of a VertexBuffer manager that is now referenced on all drawn objects. This obviously follows from the other big benefit of going to ES 2.0, programmable shaders! I haven’t yet played around with writing my own GLSL programs as I’ve been updating my code to work with the new update, but it’s high on my list to see what it can do. Another nice change is the division of extensions out of the main library. The library itself was starting to get bloated with the inclusion of things like the tmx file format and box2d physics.

The best thing about the conversion is I got a HUGE performance increase after the upgrade. Previously, zooming out all the way on the tmx map would drop frame rates down to the teens. Now it rarely dips below 50. This is credited to big improvements with tmx handling and the A* path generation along with better hardware use.

Another nice side effect is I’ve been going through and rewriting a lot of my code to clean it up. This project started during my junior year in college and there were many mistakes to be found. Not to say it’s now perfect, but it is much better than what it was.

Posted 01/08/12 @ 12:57am - By Ross

Balancing Act

For those that haven’t been following the competitive gaming scene, there has been a big surge in the last year or two. So much so that esports, as it is known, has started generating some big money. Two games in particular seem to be drawing the biggest crowd (and most of my attention). These two games are League of Legends and Starcraft II.

What I find unique about each game is that they seem to take a much different approach to achieving a balanced gameplay system. Starcraft II, as with the original, is a tightly knit balance between each of its three races. Zerg plays aggressive and relies on numbers for an advantage, Protoss relies on the strength of its units to crush the opponents, and Terran has versatility to adapt and slowly take control of the map. The races are themed and units are set (at least until the expansion) with small tweaks as needed. It’s a fragile arrangement that requires meticulous and somewhat timid changes to the system.

League of Legends, on the other hand, seems to take the opposite approach. Releasing champions every few weeks and potentially changing the game dramatically. This is not to say that Riot (the developer of League of Legends) is careless, simply that they take a different approach. Relying on the frequent changes allows for the game to stay fresh and new strategies to constantly evolve.

The reason I find the difference so interesting is that both seem to be working. Starcraft II has seen great success across the world and League of Legends has grown tremendously since its first MLG appearance. I find this to be a compelling example of two different trains of thought providing equal success. I take it as a lesson that you shouldn’t always force yourself to follow one path just because someone else has done it. Whats important is the feedback you receive and the passion you put into your project.

Posted 01/04/12 @ 8:18pm - By Ross

Bring the noise

Well it started with my RoadBuilder class and my research into procedural generation. There was one thing I kept on seeing during my research and that was noise generation techniques. In particular, Perlin noise.

So what, you may ask, is Perlin noise? To answer this, we must first look at what noise is. Conceptually, noise can be thought of as random looking numbers that can be consistently generated based off input. Rereading that it sounds a little cryptic so think of it this way. If I give you a number, you can give me a random number that corresponds to that number. Here is a theoretical chart that would represent a input corresponding to an output:

1 : 22
2 : 8
3 : 34
4 : 3
5 : 16

An input of 1 would correspond to an output of 22, an input of 2 corresponds to an output of 8, etc. The output of this magic function appears to be random, but whenever you give me 1, you get 22 back. That magic function is a noise generating function. So the question of what that magic function might look like probably comes to mind, and that’s where we get into Perlin noise.

Disclaimer: This section contains
Math

(more…)

Posted 12/22/11 @ 4:18pm - By Ross

Goodbye Pullman!

Been a long time but I’ve been super busy with graduation and finalizing everything as I get ready to move back home. Most of my room is packed up at this point, just my clothes and electronics left. I’ve gotten excitingly efficient at dismantling my computer so I’ll save that for tomorrow.

I’ve headed home multiple times so the packing and getting ready to head home isn’t throwing me off. What blows my mind is that I’m not returning. I’m done! I got my BS in Computer Science which is also kinda blowing my mind. Obviously that was the goal but during classes you aren’t acknowledging that you are making progress towards your degree. You’re worried about projects and tests for a given class. So while I was freaking out over finals and my senior design project it just kinda happened. I’m a college graduate.

So now I sit in my mostly empty room typing up my last post from Pullman. Hard not to think of all the crazy stuff that happened while I was here. But it’s on to the next phase and finding a good dev position for myself. I also can finally finish Right to Rule as I haven’t even had the chance to touch it in the last 2 months.

Peace out Pullman!

Posted 11/02/11 @ 11:27pm - By Ross

colds are bad

The days are steadily counting down now, 43 to be exact. Unfortunately development of Right to Rule has pretty much hit a road block until graduation as projects are piling up along with a job search and all the ins and outs of graduating. It serves as more of tech demo in its current form but once I get free time I have a lot still planned.

As the title suggests, the common cold is making its rounds at WSU and I was unfortunately unable to dodge it completely. Luckily it didn’t hit until after midterms, but its still makes me angry and grumpy. Sleep and water are my companions for the next few days…and my senior design project…

Posted 10/18/11 @ 11:21pm - By Ross

Wanted: More Time

Unfortunately I may be getting a cold…not happy! With Minecraft and MLG vying for my attention from projects that are piling up I haven’t gotten much done with Right to Rule. Hopefully I’ll be getting some time in the coming days to start actually implementing the menu system for castles but Blizzcon and the GSL finals are this weekend so…yea.

Either way, I’ve at least started mocking up what I want the layout to be in photoshop. I may post a picture once I finish the mock-up and then start implementing it. It’s always entertaining to look back on mock-ups I’ve made of websites and how they differ from the final versions. I’m hoping to get the same nostalgia kick from this once a few years go by.

return 0;

}