Thursday, April 28, 2016

Entertaining Video Games

I am sitting at the airport in San Diego getting ready to play a video game on my PS Vita and I have a couple of choices. I have been trying to get through Sly Cooper but find myself grinding through the various levels and it has stopped being fun. Given the choice of continuing the game or watching paint dry, I am leaning towards the latter. Others may disagree but that is how I feel. Knowing this, I threw in another game in my computer bag before leaving home: Lego The Hobbit.

I have never played a Lego video game for more than a few minutes but find them hilarious. When your character blows up or is killed, there is no blood nor gore. Just Lego blocks being broken down into their individual components. It always makes me laugh.

So what makes one video game more entertaining than another? That is the all-important question and I wish I had a complete answer. I do know that there are a number of games that I have played that are like abusive relationships. The game is difficult and you only continue because you have invested time in the relationship and want to see it all the way to the end. Rather than feeling good because things are going well, you feel good because you didn't get the crap kicked out of you. I hate those types of games and that is what Sly Cooper is turning into.

Contrast that with Tomb Raider or Red Dead Redemption where I got totally involved in the game and looked forward to playing them on a daily basis. Some parts of the games seemed difficult but then they got easier for a time and the story built, allowing me to reinvest in my relationship with the characters.

Sly Cooper was amazing when it first hit the market. Since then games have evolved and it makes it difficult to go back to that style of game. I may eventually go back to it but right now I need something else to entertain me. Hopefully Lego The Hobbit is it.

Monday, April 18, 2016

How Smart Traffic Lights Work

One of the advantages of taking Electrical Engineering classes in college and having a degree in the subject is that I learned how a number of devices in our society work. The other day I saw someone who sent their children to jump up and down on a sensor used to detect if a car is overhead. In this case they were trying to open an arm for a parking lot but it is the same technology for traffic lights. Unfortunately this adult erroneously believed that traffic sensors are triggered by weight. I thought the same thing growing up. Imagine my surprise when I attended my Electromagnetic Physics class and the professor informed us that it is just a metal detector buried under the asphalt?

Before college I tried like those kids to get my bicycle to trigger traffic lights to turn green for me. After doing a number of bunny-hops with no luck, I would sheepishly walk over and push the pedestrian button. After college I learned a trick and can now trigger traffic signals to turn green for me about 80% of the time. The bike I currently use to commute has an aluminum frame. While aluminum is a great conductor of electricity, it isn't magnetic and that is what a metal detector is looking for. Iron is magnetic and also rather heavy so they try to use as little as possible of it in bicycles. There is one place they can't avoid it though and that is the bike chain. I have discovered that if you ride so your chain is directly over the sensor, there is enough iron in it to trigger the light. This may take a bit of trial and error for some lights but I have learned where all of the sensors are on my 3-mile ride to and from work each day.

When I saw those kids jumping up and down on the car sensor, I politely asked them to move and rode over the sensor. My trick worked and they entered the parking lot without any trouble. It is a simple trick but looks like magic to young kids.

Tuesday, April 12, 2016

Getting SQL Logic Correct

It has been a while since I have had to run an SQL query against a relational database. Today I worked with some of our developers to try and figure out why some data doesn't make sense. This requires running SQL queries and is something I actually enjoy creating. I saw one query and it just didn't look right. The query ran fine but I don't think it produced the expected results due to negative logic.

Imagine you have a table with the following 3 rows:

     Name
     -----
     Matt
     Rhod
     Felix

Suppose you want to query everyone, you would use the following SQL statement:

SELECT * FROM my_table;

Now suppose you wanted to query everyone except Matt, you would use:

SELECT * FROM my_table 
WHERE Name != 'Matt';

The WHERE clause acts like a filter and the exclamation point means NOT. You could also use:

SELECT * FROM my_table 
WHERE Name = 'Rhod' OR Name = 'Felix';

This eliminates the exclamation point but requires that you know who else is in the table. The query I looked at today combined the OR operator along with NOT. Unfortunately things get backwards and your expected results may not be what you want them to be. Supposed you have no idea what names are in the database table but you know you want to see everyone except Rhod and Felix. You might be tempted to use the following:

SELECT * FROM my_table
WHERE Name != 'Rhod' OR Name != 'Felix';

Unfortunately the query would return all of the rows in the table. Why? Because the database would go to the first row and see that Matt is neither Rhod nor Felix and return that row. It would go to the next row and look to make sure  that only one of the two conditions are met because the OR operator is used. Since the name does contain Rhod, it fails one test but Rhod is not Felix and so Rhod is returned in the query. The same logic holds true for Felix.

The fix is to replace the OR operator with the AND operator. The correct query should be:

SELECT * FROM my_table
WHERE Name != 'Rhod' AND Name != 'Felix';

The only row returned is Matt which is what you want.

Tuesday, April 5, 2016

Video Game Review: Sniper: Ghost Warrior

Several years ago I started playing Sniper: Ghost Warrior from City Interactive. Somebody gave me the game for free and I played it for about an hour. I put it on the shelf and never got around to playing it again until recently. I felt the need to find a short game that I could complete in a few hours and so I picked it up again as it has an average completion time of five or six hours.

I am a fan of first-person shooters and so I had a lot of fun playing the game. One thing about a sniper-type game is that you can take your time and methodically move through it. You don't win points by rushing through the missions although there are times when you do need to hustle. I only have an hour or so in the evenings a couple of days a week and so it took me about two weeks to run through all of the missions. The first ones take a bit more time while the ones towards the end seem to go quickly. It is almost as if they wanted to make a ten-hour game and decided to cut it by four hours just to get it out.

Sniper is not a triple-A title and so I would not pay more than $15 for it. Especially since it released in 2010. Should you find the game to be a lot of fun, there is Sniper 2 and Sniper 3 also available. I have a copy of Sniper 2 that I picked up super cheap but have yet to break the plastic cover on the game.

Sniper is rated Mature (M) for violence and strong language. Some of the kill scenes are rather graphic. Fortunately you have the option to skip watching them in slow-motion. I would not recommend the game for young teenagers or children but think older teenagers and adults might enjoy it. I played it on my PlayStation 3 but the game is available for the X-Box 360 and PC.