Monday, December 13, 2010

Something to Write About

Last time I wrote a non-technical post, I promised that I would have a cool 3D project to show off. Since then I started school, became overwhelmed with work, class, family and homework, quit school, went into a bit of a slump for a while, created new goals for my life, celebrated by playing way too many video games, and have now finally sat down and started working on my project again.

Unfortunately, I still have nothing to show. But to be able to go through all that and still not have abandoned the project is a good sign for me.

The reason why that's relevant to this post is that during all that time I kept telling myself that I did not want to post again until I could show off something from my project, otherwise, I feared those that read this blog would assume that I've given up on it and would have one more entry to add to the list of projects that I start and never finish. For this reason, I didn't feel I could post anything unless it was Something to Write About.*

Last Friday I found something to write about on my kitchen table, where my wife typically leaves cool things for me to write about when they come in the mail. Fortunately for the sake of a chain reaction process that I like to use for an opener for my blog posts, this something was facing down, and this is all I could see:

The first thing I thought when I saw this was "The new 'Tomb Raider!'", followed by "'Lara Croft Reborn?' Does that mean the rumors are..." followed by "A bow? The rumors WERE true!" I think all my wife heard was *gasp*, *gasp!*, *GASP!*

In case you don't know what rumors I'm talking about, about a year and a half ago the concept art below was supposedly leaked**:




After going through this thought process, I turned the cover over and found myself staring into a mostly unfamiliar face:

The accompanying article, written by Meagan Marie, expertly summarized Crystal Dynamic's reasoning's behind the new direction for the franchise, Lara's new look, and the first few moments of game play. I would highly recommend reading the pre-game play part of the article if you can find it as Meagan - while explaining to us the improvements to Lara's character - makes some good points about what it takes to create an interesting character, rather than just a strong, yet hollow character.

A few notes about Lara's new look:

Brian Horton, the Senior Art Director for Crystal Dynamics says that Lara was redesigned from the inside out, rather then taking the original Lara and trying to fit her into a new perspective. This Lara is meant to be thought of as a character, a person that you can relate to, rather than an untouchable sex symbol. In fact, there is special emphasis in the article that a great deal of time went into Lara's eyes, which they were apparently successful at. From the article; "Eye tracking studies of the new Lara versus the old revealed that instead of looking at Lara's arsenal of curves, most participants spent their time gazing at her piercing brown eyes."

Another interesting change to the franchise is that while it still technically fits under the realm of the action adventure genre, Crystal Dynamics is referring to the game as "action survival." The images that accompany the article are dark, and somewhat disturbing. Bodies hanging upside down in burlap sacs, or strung stigmatically over burning candles. Lara seems to be covered in more blood than her usual dirt, and the descriptions of the ways that Lara can kill or hurt herself within the first fifteen minutes of the game make it apparent that the game will be M rated.

While I'm concerned about the M rating, which may stop me from purchasing the game, the article in Game Informer made Crystal's next installment out to have the characteristics of the types of games I want to support on this blog. I've ignored all the Tomb Raider games before Legends, because they seemed to have little more to offer than... well... a curvy woman in short shorts and a tank top. However, after I played Legends at a friend's house (after I had beaten nearly every other game that he owned), I realized that Chrystal Dynamics was building upon what was already there, and adding something of their own. I always felt that behind each scripted puzzle, there was a sense of freedom and adventure. Behind the death of each human there was a moral, or a warning trying to be made. There was something to be said for the fact that most of the enemies were non-human. Unfortunately these contributions were thrown off by making unlockable costumes and bikinis the motivation for replaying the game, or when you control Lara as she effortlessly and shamelessly kills every living person in the second level of Underworld. But there was always a sense that Chrystel Dynamics was trying to express something, which I feel is expressed in these words from Meagan:

To build Lara Croft into a culturally relevant hero worthy of the attention that once came so effortlessly, Crystal must break her first. This Lara isn't a shadow of the predecessor, nor the game a precursor to her later adventures. While she echoes the intelligence, strength, and beauty of Teflon Lara, she is a woman all her own. This Lara won't be invincible. She bleeds and bruises, trembles and cries, but ultimately pushes forward. Her coy and knowing smile may have been replaced with a grimace of pain and fear, but it's all part of the process.

Well, now all I can think of is that all this time I could have spent working on my project instead of writing this. So it might be a while before I write anything substantial again. ^_^

____________________________________________________
* Self Reference, or Recursive Link?

**Here is the comment that accompanied my Facebook post on the subject: "Supposedly Leaked Tomb Raider Concepts... looks like the Dead Space aliens crash landed in the middle of a Renaissance festival that Lara was attending in Silent Hill..." Called it!

Monday, September 6, 2010

How to Compile a GLUT Application in Eclipse

After a week of research, trail and error, and plenty of building and cleaning, I've finally figured out how to get GLUT to compile in Eclipse. Here are the steps that I used, however, unlike most of the "I finally got this to work so here is how I did it" posts I found out there that described this process, I will include as many relevant links as I can at the end of this post. I will also try to explain why we are doing the steps, so that if you have to trouble-shoot it yourself you will understand what you are doing:

1. Download Eclipse Wascana. This is an Eclipse IDE that is already set up with the C++ plugins, the CDT (C/C++ Development Tooling) and the correct version of MinGW (a C++ compiler) and the tools that it uses. This will install in your C: directory and will also add your mingw directory (C:\Wascana\mingw) to the system path. By downloading Wascana you're saving somewhere around 5-10 additional installation steps :)

2. Start Wascana. Go to File -> New -> C++ Project. Under Project Type go to Executable -> Empty Project. IMPORTANT: Under Toolchains select MinGW GCC. If MinGW GCC is not selectable and you are only showing toolchains that are supported in your system, then you probably didn't follow step 1, and you installed MinGW incorrectly on your own version of Eclipse. You will need to reinstall at the above MinGW site.

3. Create a new .cpp file in the root directory of your project. For a quick test I used this one.

4. Download GLUT 3.7.6 here.

5. Once you've unpacked the zip file (containing the .h, .lib and .dll, not the source files) you will want to create a new directory in the root of your C++ project called 'GL'. Copy the glut.h file there. MinGW will also need a copy of glut.h in order to compile correctly. Copy glut.h to C:\Wascana\mingw\include\GL.

6. Optionally, you can create another directory in the root of your project called 'lib'. Add the glut.lib file you just unpacked in your GLUT download to the directory However, this does not add the library to your project! THIS PART IS NOT OPTIONAL: To add the library to your project right click on the project and go to properties -> C/C++ Build -> Settings. Then under Tool Settings go to MinGW C++ Linker -> Libraries. Add glut32, glu32, opengl32 one at a time to the Libraries. You will need to do this for every GLUT project that you create. Also, MinGW comes with the opengl and glu libraries, but you will need to specify where the glut32 library is stored. Add a new Library search path below the libraries. Press the "File System..." button and navigate to and add the lib directory we just created, or add the directory where you chose to keep the glut32.lib file.

7. Now add the glut32.dll to a directory where your system will look for it. For XP users, put it in 'C:\Windows\System32'. if you are using a Vista or Windows 7, my understanding is that you should put it in 'C:\Windows\SysWOW64'. For my Windows 7 machine I put it in both directories, just to be safe. *shrug* Also, you will need to add the .dll file to the root of your C++ project.

8. If you cleaned your code now, there is a possibility that your code might work fine. However myself and many of the people on the forums seemed to get an error at this point that said something like:

undefined reference to `__glutCreateWindowWithExit'

If you get this, then you will need to add one or both of the following lines to your .cpp file before you include glut.h:

#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>

Now you should be able to clean your project without any errors. When I tried to build it would say that there was nothing to build, but after cleaning I could right click and run as a Local C++ app.

If you continue to have problems, here are some sites that I found helpful:


Also, I tried to get GLUI to compile in Eclipse. It's impossible. GLUI was built using Microsoft Visual C, and therefore does not get along with MinGW. I'm not sure if there's a way you can build the source using MinGW, but for as many times as I saw this mentioned as a possible solution by the know it alls of the development forums to anyone who was trying to get it to work, I never saw anyone who claimed to be successful at it. But then again, I hadn't seen anyone who had attempted to try it either. I gave it a shot and it quickly looked like if it was possible that it was going to take just as long if not longer to figure out as getting GLUT to work, so for the sake of my sanity and marriage, I didn't pursue it any further than that.

There are supposedly newer and better tools that can be used instead of GLUI. If I find a good substitute, I will post it here.

Good Luck!

Tuesday, August 10, 2010

Lovely Lady Bump Maps

My eyes were immediately drawn to the cover of the GameInformer magazine peeking from under a stack of mail on my kitchen table when I came home this afternoon. Before I knew what the game on the front cover was I knew I loved the design, and had tried my hand at it frequently in my drawings in the past. Black and White. Strong Highlights. Dark Shadows. Due to the topics' iconic ears I quickly recognized the game to be the sequel to Batman: Arkham Asylum. However even while my subconscious was making these connections in the back of my mind, my first real thought when looking at this picture was "Wow! Look at Catwoman's bump map!"


Bump maps have been being used for at least a few years now to make models look more detailed without having to model all of those details. For example, the mesh patterned shadows on Catwoman's outfit, or the criss-cross lines, seams bolts and possibly even the beveled logo on his chest are all made to look like they were modeled in 3D using bump maps.

I have read a lot about bump maps, had a fair idea of how to implement them in Blender, but had never actually done it before. While I hear it's bad form to post test renders rather than actual pieces of art, I still thought I would post these anyway, just for fun. I mean... I haven't posted anything else in a while anyway...

If you came across this trying to learn how to implement bump maps yourself, here is a quick how-to for Blender 2.49:
1. Create an object.
2. Add a new material under the material panel.
3. Create a custom texture for that material under the texture panel. This texture is Veroni: W1=0.884, W2=-0.810, all others are default.
4. Go back to the material panel. Under the Map Input tab press the "Nor" button.
5. Under the Map To tab, deselect the "Col" button, and press the "Nor" button. Click it once for regular mapping (text is white) or twice for negative mapping (text is yellow).
6. Adjust the "Nor" slider to your satisfaction. The bump mapping isn't very impressive at 0.00. (In this example the value is equal to 11.31).

Other settings of note. There are two default lamps, and one spotlight in the scene. Material color is a very light gray. Diffuse shader is Lambert: Ref=0.496, Specular Shader is Toon: Spec = 0.153, Size=0.323, Smooth=0.10. There is also a Spec Ramp, first color is clear (alpha = 1) and second color is white positioned at 0.690 on the colorband.

Finally, here is Suzie doing a very bad Catwoman impersonation, but doing a good job of demonstrating a combination of smooth and bumped materials on the same mesh. Joey and Kimmie thought I was trying to make Bugmonkey:

That's all for now. I have some other 3D projects I'm working that I hope to be able to post soon that should be WAY more exciting, so be sure to keep an eye open!

Saturday, June 5, 2010

Apostrophes in JSPs

I recently came across an interesting problem trying to c:out Strings containing apostrophes in a JSP generated web page.

Let's say you had a call to a JavaScript function -- similar to the one below -- that was called when an html component was clicked and the parameters were populated by JSP c:out tags:

onclick = "doSomething('<c:out value="${text}">')"

As you can see, when the variable text contains an apostrophe, it will close the parameter String for doSomething early, causing the rest of characters in text to be read as uncompilable code.

Now I don't claim to be a JSP/Javascript/HTML ninja, so there may be a more obvious solution then the one I eventually arrived to. But due to the number of people I found asking for solutions to problems like this online, and the lack of finding the solution I eventually arrived at, I thought this was worth sharing.

The solution that I found on numerous sites was to use escape characters to display the apostrophe. In my Tag on the server side I replaced the apostrophe in the text variable with something like this:

text = text.replaceAll("'", "\\\\'");

That's one escape character to tell JSP to display the apostrophe instead of using it to close the sting, another escape character to put in front of that escape character to tell Java that you want to pass an escape character, and another escape character in front of each of those escape characters because replaceAll uses regular expressions to find and replace your substrings. This worked fine, but even as I released it it felt flimsy to me, and in when tested on another environment, was still throwing an error unless another escape character was added. I couldn't find the discrepancy between the two environments, but this was proof enough for me that it was not a solid enough fix. It seemed to me that if on a different environment our string went through some additional protocol that uses backslash as a character escape, then it would mess up the whole code.

The solution I found was to substitute HTML codes for the escape character and the apostrophe:

text = text.replaceAll("'", "&#092;&#039;'");

where &#092 is the HTML code for the "\" and &#039; is the HTML code for an apostrophe. Using these character codes, we can bypass any code that might process our escape characters and break our code before it gets to our page.

However, by default JSP will convert our HTML codes, process the character break and display an apostrophe, thus defeating our original purpose in replacing the apostrophe. This can be disabled per c:out tag by setting the escapeXML tag to false

onclick = "doSomething('<c:out value="${text}" escapeXML = "{false}">')"

If you view the source, you will wee the HTML codes used in your String instead of an apostrophe. If you want the apostrophe to display, just don't add the escapeXML = "{false}" parameter.

Thursday, May 13, 2010

With Great Power...

It's almost scary how much power one person can have on the internet. Below is today's xkcd:



And here is the pandemonium that ensued on Wikipedia.

I sometimes wonder what it would be like to have a presence like that on the internet, and if it's a good thing or a bad thing. I always imagine Munroe sitting in a dark room, twisting his mustached and laughing manically to himself whenever he submits a new web-comic to his site. Then sitting back in his padded chair the next morning with a hot cup of coffee and a pleased smirk on his face after performing a quick Google search to view the resulting mayhem.

Wednesday, January 6, 2010

Holiday Cheer

nother part of gaming I hope to share from time to time is game development, something that I dabble in from time to time and hope to dive into much stronger in the future. However one of my favorite parts of game design is character design which stems from an interest in drawing that I've had as a child.

Eventually I would like to share with you some things I've learned about character design and share with you the development of a character that I've been working on for years. But today, I just want to share with you an exciting new tool I've received as a Christmas present from my mother-in-law. She got me this graphics tablet, which is basically a pad that allows the user to draw with a pen rather than a difficult to use mouse on the computer.

I've had some experience coloring my drawings using Photoshop and the Gimp before, one of my least favorite parts was having to draw the picture, scan it and then either having to find single whit pixels in the middle of black lines or having to retrace the drawing. When I draw th image directly on the computer I instantly have an inked drawing, which cuts out a whole extra step in the drawing process. Here is the inked drawing:


Another thing that I liked about drawing in The Gimp directly with a graphics table was that I could draw a light rough sketch on one layer, and then draw the image on top. This means instead of having to erase a bunch of pencil marked circles and guidelines, all I have to do is delete the layer.

Some of my past experiments with coloring that you can see on my website involved basically coloring everything flat, and then creating a highlight and shadow color for each color on the image. Recently I've been looking at a lot of american comic drawings, and was really impressed with their "airbrush" style coloring, which was actually using lots of gradients to blend highlights, shadows, and then to create brighter highlights and darker shadows on top of those. I think it makes the image pop more. Here is my attempt at that type of coloring:
Unfortunately, before learning how to use gradients to color I first tried using the airbrush, which is how I colored the hair and her black leotard. I feel it made the hair look more like a blob, and the black clothes look too shiny. But for the most part, I feel happy with the way it turned out. I was specifically excited about the way the highlights turned out on the bow on her back, and the way I was able to shade the back leg so the it literally looks below and behind her.

Looking at it now, I feel like I could have spent some more time lightening some of the highlights and darkening some of the shadows. I've also seen some images that have some really good examples of secondary lighting, that can add even more dimension to a drawing, but for now, I'm pretty happy with this first attempt and coloring with gradients.