Tuesday, September 17, 2013

Progress Update 1

In a previous post I wrote down some goals I had for the rest of the year and I think this is a good point to report on the status on how things have gone so far.
    Work with C++ again.
This is still ongoing. I've been doing some small programs here and there but nothing substantial yet.
    Learn Qt.
Priorities have changed and this is no longer a goal for the near-term.  However, I believe I got a solid foundation of Qt if I ever want to develop a multiplatform GUI application.
    Learn OpenGL.
This is on hold at the moment.  The reason is that I found a really cool game framework called Monogame.  Since Monogame is designed to be used in conjuction with C#, I started getting really into .NET.
    Review algorithms
No progress on this.
    Code at least one game by December 31, 2013.
Ok, this is the goal where I have made the most progress, and the one where I had the highest expectations.  XNA/Monogame are really good.  I'm slowly making progress with a PONG clone.

With that in mind, here are the revised goals:
  1. Finish one or more games by December 31, 2013 - I'm confident I can make more than one game by years end.
  2. Continue working with C# - thanks to Monogame, I am now interested in learning more about the whole .NET ecosystem.  Next thing on the list is to understand MVVM for WPF, for a lot of the same reasons I wanted to work with Qt.
  3. Review Algorithms
  4. Learn more about computer graphics - OpenGL and mathematics needed in the field.
  5. Continue working with C++ and Python
  6. Take a few MOOC courses, especially in the areas that relate to the above items.

Wednesday, September 4, 2013

Favorite game developers

There is a thread on NeoGAF with discussion about ranking your favorite video games developers.  Here is the post I made on the thread.

  1. Valve - Half-Life 2 is my favorite game of all time. Everything Valve touches is great, and I really admire the way Gaben runs the company.
  2. CD Projekt Red - I actually consider these guys to be the European arm of Valve. The Witcher remains my favorite cRPG.
  3. FROM Software - Dark Souls was a revelation to me. It simply perfects everything that a game is supposed to be. It communicates story and its world through gameplay like no other game before it.
  4. GSC World - If these guys had polished S.T.A.L.K.E.R. and delivered their vision in its entirety, their FPS would have been a monumental achievement. There are parts of S.T.A.L.K.E.R. that surpass all other FPS I've ever played. Truly a flawed masterpiece.
  5. 4A Games - The successor to GSC World. Metro 2033 was a thinking's man shooter that unfortunately suffered from too much of that European jank. It looked amazing, and its sequel Last Light is the best looking game currently available on any platform.
  6. Bethesda - These guys are on my list because of Fallout 3 and because they allowed Obsidian to make New Vegas. I don't really care much for their Elder Scrolls series.
  7. Irrational - IMO nobody does atmospheric western shooters like these guys. I'm glad that their shooters are ambitious even if sometimes they don't deliver on the goals that they set out to explore
  8. Firaxis - They are the drug dealers of the gaming world.
  9. Everyone else

Monday, September 2, 2013

PAX 2013

I'm a huge video game fan.  I love playing games, I love talking about them, and being part of the culture that has developed around them.  It is truly one of my greatest loves.  Ask anyone who is into video games if they know about E3.  I think pretty much everyone who is into video games had at some point dreams of attending the convention.

Back in the late 90's and early 2000's, E3 was the most important event for video games.  Announcements were made about all the biggest games, new consoles were unveiled, people got the opportunity to play demos of unreleased titles, and have the chance to meet the biggest names in the industry.  Unfortunately the people behind E3 made the decision to shrink E3 and severely restrict who could attend.  The dreams of thousands of gamers like me were destroyed.

But then PAX happened.  In 2004 a couple of guys behind the Penny Arcade webcomic decided to have a little convention of their own for gamers by gamers.  It started as small gathering of people who loved webcomics, video games, board games, and nerd culture could feel free to share their love for all those things.  Every year since then, the numbers have increased exponentially to the point where the entire game industry just simply cannot afford to ignore PAX.

Last year, I had the opportunity to attend PAX Prime in Seattle for the first time.  I kind of had an idea what to expect, but my mind was blown - everything was better than I had ever imagined!  This was E3, only better.  It was 70+ thousand people who were just like me and share that love of video games.

That thing I said about the gaming industry not being able to ignore PAX, well game companies, now are announcing projects at PAX.  The biggest names in the industry go to PAX to meet and talk to fans.  I shaked hands with people that work at Double Fine, Valve, EA, Telltale, and many others.

Attending PAX was a blast.  A dream come true for me.  I liked it so much that when the tickets for PAX East 2013 went on sale, I didn't even hesitate.  I booked the hotel and flight to Boston on the same day.

It's been a year exactly that I was leaving Seattle to fly back home.  For Prime 2013, I sadly didn't see the update quickly enough and was not able to buy the tickets.  What I'm trying to say is that if you love video games, then you simply have to go to PAX at some point.

Monday, July 29, 2013

XNA/Monogame - First thoughts

XNA is awesome!  It is truly a shame that Microsoft decided to stop supporting it.  After many failed attempts throughout the years at getting started with game programming, it looks like I finally found something will allow me to finish a 2D and possibly a 3D game.

To be clear, all my "XNA" learning so far has been with Monogame, which is open-sourced XNA.  In the short time that I spent, I now know how to display textures and even do basic animations.  At this point I feel confident enough to make pong.

The stuff  I liked so far is that there are plenty of resources to learn XNA/Monogame i.e. books, online tutorials, youtube lessons.  Since XNA is now "dead" some XNA books on Amazon.com can be had for really cheap.  I was able to snag "Learning XNA 4.0" for  $16!  More than 95% of what I've read from the book applies directly to Monogame.

There are only very few things I don't like about XNA/Monogame.  Everything that a game in XNA uses and it's not code is referred to as content i.e. images, sounds, etc.  The tool that compiles the content into a format that XNA/Monogame can use, has not been ported to Monogame as of this writing.  This forces you to use XNA Studio or the Windows Phone SDK.  Also, the Visual Studio templates for Monogame have some weird bugs that still need to be ironed out.  However, given that I'm only a beginner some of these issues might no be issues at all, and I'll probably run into more major things the more I use the framework.

Overall, my initial reaction from XNA and Monogame have been very positive.  The multiplatform version of Bastion, Terraria, Fez use Monogame.  If you go by those examples, it is clear the framework has a bright future since it can only get better.

Would I recommend others to learn XNA/Monogame?  Absolutely!

Tuesday, July 23, 2013

My travels in graphics programming

DirectX

Early this year I started reading a book about DirectX but quit shortly after.  I wanted to use VS2012, but couldn't get my environment configured properly.  All the issues stem from the fact that VS2012 now comes with DirectX built-in, but this version only works for Metro applications.  If you want to develop for the desktop, you have to install the "June 2010 SDK" for DirectX which is a pain for me as a beginner.  One solution to this problem is to go back to Windows 7 and use Visual Studio 2010, which is something I don't want to do.

OpenGL

About two months ago I strongly considered forgetting DirectX and instead learning OpenGL.  I have to admit that not being able to set up my machine properly has been one of the biggest reasons for the switch.  At the moment, I'm waiting for the latest version of the "OpenGL SuperBible" to be released at the beginning of next month.  This book was highly recommended by a friend who is a graphics programmer, so I have high hopes for it.

Monogame/XNA

In the last couple of weeks I gave DirectX another shot and again and I'm not seeing the progress I expected.  To calm my frustration with DX, I went and researched other alternatives and discovered Monogame which is an open-source port of XNA.  Now, XNA is dead and will no longer be supported by Microsoft, but I found Monogame very promising.  For the type of games I want to code as a beginner I believe is more than capable and satisfies all my requirements.

Yesterday I said what the hell and decided to give it a shot.  Right off the bat, I'm finding it a pain to use VS2012 in my environment again.  To get Monogame to run on Win7 with VS2012 I had to go through a labyrinth of steps:
  1. Install Visual Studio 2010
  2. Install XNA Game Studio
  3. Install Monogame
  4. Create OpenGL Monogame project and have it fail to run.
  5. Fix SDL.dll issue with the way the Monogame VS template works.
  6. Install OpenAl because Monogame didn't install this driver for some reason.
  7. Finally run basic project.
The whole process took me a couple of hours, which isn't too bad.  But I find steps 1 and 2 to be non-ideal.  Why do I need to install VS2010 to code something in VS2012?  The reason is one key part of XNA has not been ported to Monogame, the content creation pipeline.  One way to avoid having VS2010 and XNA installed is by using Windows 8 Phone SDK.  The only problem with that approach is that you can only do that on Windows 8.


Upgrading to latest Qt 5.1 broke my 5.0.2 project

So it appears that installing the newest release of Qt can potentially break your existing projects.  This, as far as I can tell, occurs when you install the wrong version of the installer, which now comes in two flavors for x64 windows.  One is for DirectX and the other for OpenGL.

So to keep your existing projects compiling properly install the OpenGL version.  However, this is just a minor issue, and I actually think installing the DirectX version on windows might be a better choice.

Tuesday, June 18, 2013

Getting the Qt Creator debugger to work on Windows

Installing the default Qt package for Windows installs the Qt Creator IDE, and everything else you need to write GUI apps, but once you try to debug your first program you get an unexpected surprise.  Unless you have installed the appropriate Windows SDK, the debugger functionality in Creator won't work.  You will get an error message saying the debugger is not configured.

The following is what I had to do to get the debugger to run on Windows 8 x64 with Qt 5:

  1. Download the Windows SDK for Windows 8.  If you have Visual Studio 2012 and selected the appropriate option during that installation, you won't have to run this.
  2. Run the installer for the SDK, and when prompted select the debuggers checkbox.  This is the only thing you really need.  If you want the full SDK select the other checkboxes.
  3. Open the Qt Creator IDE. Go to Tools -> Options -> Build & Run -> Kits.  In the Auto-detected field you should see an entry for your version of Qt.  Selecting it you should see the debugger has been configured for CDB Engine.  If you see < None > for the debugger, you will have to manually navigate to the CDB executable.  The path on my computer is:

        C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\cdb.exe

Thursday, June 13, 2013

Adding a custom slot in Qt Designer and Visual Studio 2012

I was going through the "Getting started" section for Qt using VS2012 as my IDE, and I got stuck when I had to add a slot to a button.  Apparently there is a bug when using the Visual Studio add-in, that the submenu Go to slot doesn't show up in a context menu in Qt Designer (see bug).  Needless to say, I spent more than two hours trying to figure out how to get around this problem.  The following is what I found:

Let's say you have a class called Notepad that has a quit button and you want to handle when the button is clicked.  First create a private slot in the class definition in the header file - Notepad.h in this example.

class Notepad : public QMainWindow
{
...

private slots:
    public void on_quitButton_clicked();

...
}

On the Notepad.cpp add the following:

void Notepad::on_quitButton_clicked();
{
}

Note: from what I read it's good idea to follow the convention on_name_signal() for all your custom slots.

Now open your *.ui file with Qt Designer.  At this point I tried using the Signal/Slot editor to add the slot to the button on the GUI.  The "custom" slot we wrote above however doesn't show up when you click the slot dropdown.


After scouring stackoverflow and the Qt forums I found a couple of ways to get the custom slot to show in the dropdown.

  1. Go to Signal/Slots mode by pressing F4 on your keyboard.
  2. Click on the button so that it changes color.
  3. Left-click and drag it to the top of the main window.

    4.  This brings up the Configure Connection window
    5.  On the left pane select the Signal clicked()
    6.  On the right pane select Edit
    7.  This brings yet another window, select the + button.
    8.  Enter the name of the custom slot, on_quitButton_clicked() in this case.
    9.  Click Ok and now you should be able to see the slot in the dropdown in Signal/Slot editor.



Pretty tedious, but if you want to use Visual Studio as the IDE, this is what you will have to go through until someone fixes the bug, or you decide to use Qt Creator.  If I keep finding issues like this by using Visual Studio I think I'll have to do to the latter.

Sunday, June 9, 2013

Goals for the rest of 2013

Since late last year I had some plans about what I wanted to accomplish this year in terms of technical knowledge and programming.  The ideas have been floating in my head, and I have already accomplished several, but I think it will be nice to write them here and see how I much I get done by year's end.

  1. Work with C++ again.  -  C++ was actually my first "real" programming language that I learned to the point I could build some non-trivial applications.  During my time in university, I focused on Java and C, and my C++ knowledge accumulated a fair amount of rust.  This year I plan to get back to working with C++ to the point that it becomes the go-to language when solving computational problems.
  2. Learn Qt.  -  One of the reasons for going back to C++ is that I want to do some GUI applications that can run in both Windows and Linux.
  3. Learn OpenGL.  -  I bought a book about DirectX last year and read a few chapters, but decided that OpenGL would be a better choice since I eventually want to program a game for Android, which only uses OpenGL.
  4. Review algorithms  -  It is my personal belief that I should know everything covered in a standard college algorithms course by heart, and can be able to apply the knowledge at any time.
  5. Code at least one game by December 31, 2013.  -  I've been trying to code a game since I was in high school.  It is the reason I studied Computer Engineering in school.  Too many things have gotten in the way in the past.  It is time.

Thursday, May 30, 2013

Redirecting files to standard input in Visual C++ 2012

Back in my university days when I use to code on Linux, I used pipping quite a bit to pass files to my programs.  What is pipping? You can think of it as redirecting the input inside a file to the standard input of your program.

Think of it as an easy way to avoid having to type stuff over and over again.  For example, you might be writing a program and you have a "fixed" input that you want to keep using as you modify and debug your program further.  If you are working from the console, you will have to type this input many times "by hand."  A better approach is to place this fixed input inside a text file and "pipe" it to your program.

One way to do this is to add the input text file in question to the directory where your executable resides and use the < character like the following:

C:\MyProject1\MyProgram.exe < input.txt

This is fine if you intend to debug by using lots of cout calls.  I tend to dislike this approach since I want to use Visual Studio and all its great debugging features.

In order to accomplish the same task and pipe the file to Visual Studio, you can redirect the file by going to  (Visual Studio 2012 Pro):

Project -> Properties -> Debugging -> Command Arguments

Add the following to your Command Arguments

< input.txt

In order for this to work without specifying the full path to your file, make sure to place the file in the same location where VS creates source files.  Now when you debug from within VS you don't have to type the input again and again!