tweex[dot]net
My experience using CMake (and a tutorial)

Introduction

For those of you that don’t know CMake is a cross platform build system that allows you to define what you want to build and how, before it goes off and creates the correct build scripts for your particular platform and compiler. It is supposed to help you to simplify your build process when compiling for multiple platforms by just having to maintain a single build script that can generate all other build scripts.

Generally I never had a use for a such a thing since I did all my work on Windows with Visual Studio however when I started doing work I eventually wanted to use on Linux too, I knew I had to look into something. OGRE had started using CMake to generate its build scripts, so I thought I’d look into that. This turned out to be much harder than I expected considering the documentation for CMake seems to range from poor to non-existent and that the examples they link to are either really quick overviews, or really contrived and complicated.

Still I persisted, and with the use of the OGRE CMake files as an example, and with the help of jacmoe and CABAListic I managed to get a CMake file that worked. It was ugly, it was all in one CMakeLists.txt file (which you shouldn’t really do) but at least it managed build two of my libraries on Linux. Of course, I was never able to test if these libraries ran on Linux since I never worked out how to link those libraries against an executable (or even how to recurse into my examples directory so I could attempt to build the examples). After 6 months I figured it was time for me to work out how to use CMake “properly”, I made myself a simple test case that represented what I ultimately needed to do, and then tried to build the CMake script to generate the correct build scripts for it.

Read More

I don’t have a smart phone, I have some shitty old Motorola phone, but if I was going to get a smart phone I’d get one of the Android HTC ones.I’m one of those people who don’t really see what the big deal about the iAnything is.

Also, it really messed up pronouncing the words “customisable” and “aneurysm”. It reminds me of playing Portal Prelude.

senoadiw:

In programming, Yoda’s Condition is defined as:

the act of using if(constant == variable) instead of if(variable == constant), like if(4 == foo). Because it’s like saying “if blue is the sky” or “if tall is the man”.

No matter what people may argue about its benefit in coding practice, still… makes sense it doesn’t.

senoadiw:

In programming, Yoda’s Condition is defined as:

the act of using if(constant == variable) instead of if(variable == constant), like if(4 == foo). Because it’s like saying “if blue is the sky” or “if tall is the man”.

No matter what people may argue about its benefit in coding practice, still… makes sense it doesn’t.

Setting up nForce in Windows 7

I’ve recently installed Windows 7 on my main PC, removing the old Vista install. While doing this I had some issues getting my on-board nVIDIA nForce 6 network drivers working, and from looking around the internet, I am not alone.

The solution that eventually worked for me is as follows:

  1. Shut down your PC and turn it off at the mains for ~20 seconds.
  2. Turn your PC back on and boot into Windows, it should now be able to see and use your nForce network adapters to access the internet, however if you restart Windows you will find that the adapters become disabled again.
  3. To solve this, go to the nVIDIA website and download the correct nForce drivers for your motherboard, and then install them (you will only be able to install the network drivers if Windows is currently able to use the adapters, so if they are disabled, you will need to repeat step 1 before continuing).
  4. Reboot your PC and you should now find that your network adapters are working, and will also continue to work after you restart your PC.
Setting up Redmine on WebFaction

Since this is something I have recently had to do, and found the documentation to be out of date, I though I would share this working solution with you all. This is based on Redmine 0.9.x, and thanks to Sean F from WebFaction support, these instructions are mostly his.

  1. Go to your WebFaction control panel and create a new MySQL database, making a note of the database name and password.
  2. Create a new Rails 2.3.5 application from your control panel, noting the name of the application.
  3. Create a new website to serve the rails application you just created. eg, redmine.domain.com
  4. Login to your server using SSH
  5. Go to your Rails application directory, eg ‘cd ~/webapps/my_redmine_app’ replacing ‘my_redmine_app’ with the name of your actual Rails application.
  6. Run the following commands:
  7. export PATH=$PWD/bin:$PATH
    export GEM_HOME=$PWD/gems
    gem install mysql
    wget http://rubyforge.org/frs/download.php/69449/redmine-0.9.3.tar.gz
    tar zxf redmine-0.9.3.tar.gz
    ln -s redmine-0.9.3 redmine
    cd redmine
    cp config/database.yml.example config/database.yml
  8. Edit the ‘production’ section of ‘config/database.yml’ to configure it to use
    the database you created in step 1. ‘database’ and ‘username’ should be the
    name of the database, and ‘password’ should be the database password.
  9. Execute the following commands, again from your Redmine application directory. eg ‘cd ~/webapps/my_redmine_app/redmine
  10. RAILS_ENV=production rake config/initializers/session_store.rb
    RAILS_ENV=production rake db:migrate
    RAILS_ENV=production rake redmine:load_default_data
    cd ..
  11. Edit ‘nginx/conf/nginx.conf’ to change the text ‘hello_world’ to ‘redmine’.
  12. Restart nginx with the following command:
  13. ./bin/restart

You should now have a working Redmine install at the website you specified in step 3.

One last thing you will probably want to do is get a working email setup so that Redmine can email people. I used SMTP for this, the process is quite simple:

  1. Create a new mailbox to handle your Redmine email, making a note of the username and password.
  2. Go to your Redmine application directory, eg cd ~/webapps/my_redmine_app/redmine’ and execute the following:
  3. cp config/email.yml.example config/email.yml
  4. Edit ‘config/email.yml’ as described here, you will want to edit the ‘production’ entry as follows, replacing the place-holders accordingly:
  5. production:
      delivery_method: :async_smtp
      smtp_settings:
        address: smtp.webfaction.com
        port: 25
        domain: your_domain_name
        authentication: :login
        user_name: "your_mailbox_user"
        password: "your_mailbox_password"
  6. Restart nginx (see step 10 from above).

And that’s that. You should now have email working with your Redmine install.

New Webhost

I have now finished the move of all my websites from Hostgator to WebFaction. I’ve been with Hostgator a while now, and while they have been okay, it wasn’t until I set-up the Insimnax website that I noticed how slowly they actually served content; I let it be for a couple of months before I decided to move.

I considered getting myself a cheap VPS, something I had done before but was left a little unsatisfied with. While I was looking around I came across WebFaction, they essentially manage to provide shared hosting which is very VPS like. While you don’t get full access to the server, you do get SSH access and the ability to install pretty much anything considering the sheer amount of applications they have available.

I had been pretty frustrated when I set-up the Insimnax website that I had to use three different pieces of software (Pixie, MediaWiki, and MyBB) to get all the functionality from the site that I wanted, I would have much rather just used one thing and be done with it. To this end, when I set-up the site again on WebFaction, I just used their one-click installer to create a Ruby on Rails application and installed Redmine. Now not only is the site significantly faster than it was before, but all my content for the Insimnax website is hosted in a single piece of software which makes it easier for me to maintain and manage.

In addition to being able to create a Rails application, you can also do some other nifty things with them. Is your website running slow because it is trying to serve a lot of static content through Apache? No problem, with WebFaction you would just create a nginx application to handle all your websites static content, and then use your Apache application to only handle your dynamic content. What’s more, because you have SSH access to all your applications, you can tweak the configuration files for them to your hearts content just like you could with a full VPS or Dedicated server. This to me actually makes WebFaction better than a VPS, since the actual OS and server installation is handled by them (including updates) which leaves me to just worry about the things that these applications are serving.

My next plan with this new account is to create a Subversion application and migrate my Assembla SVN repository for Insimnax to WebFaction. This will offer me several advantages; firstly it will allow me to integrate my SVN repository into Redmine; secondly it will allow to me to let others view my current trunk, because; thirdly it will allow me to give specific access to just the parts of the SVN repository that I want to be seen by the public. This is something I will be able to do since I will have access to the SVN users configuration file, something that is hidden from me at Assembla, and since Assembla has yet to implement per-directory access rights on their SVN repositories, something I simply cannot do with Assembla hosting.

I will leave you with this piece of information. While I was waiting for my DNS information to propagate, I could traceroute both servers and I found that they were both hosted at the same data centre (The Planet), and both gave me the same ping of ~162ms from my location here in England. However the WebFaction server was the one that gave me the fastest response to my requests, and since the network statistics for both were the same, I can only assume that is because the WebFaction servers are; better configured, have less load, or both.

Like many people, I grew up watching Dragonball Z and it has been brought to my attention that not everyone has seen the Dragonball Z Abridged series by Team Four Star. Those of you that haven’t should be considered shamed and should rectify this immediately by clicking on the link and watching the videos; they are truly hilarious.

Bayonetta

For those of you that are unaware, Bayonetta is a game which is touted as being spiritually related to the Devil May Cry series, mainly due to the fact that the game was designed by Hideki Kamiya, the designer of the original Devil May Cry game.

When the demo came out on XBOX Live I downloaded and played it, then felt very dissatisfied, then played it again and still felt the same. The main problem I have with the game is the controls; I’m not sure why but somehow I can’t correlate the buttons to the actions because to me the actions the buttons perform don’t seem to be deterministic; this ultimately results in random button mashing (and quite often death).

I’ve played through Devil May Cry and I really enjoyed that game, mainly because I got the controls since they always did the same thing. I am told that Bayonetta isn’t so bad if you play the actual game from the beginning, and if that’s the case then I would consider the game demo to be a failure since I’m not going to be buying the game due to not being sure I can play it (given, I could put it on super-easy one button mode but that would just make me feel like an idiot, and no-one wants to feel like an idiot).

New Blog

Well I’ve moved over to tumblr for my blogging needs. This is mainly due to the fact that I don’t really want the hassle of keeping my blog software up-to-date any more; especially now that I have three separate pieces of software to keep up-to-date for the Insimnax SDK website.

As a result of this move, and the fact that tumblr doesn’t have an import option, almost all of my really old posts have gone. It’s somewhat sad to throw away around 2 years of content, but it’s also quite liberating since I have only moved over the most recent content and any older content that I felt was interesting or informative. It was nice to look back over the years of blog posts and see how far I have come to get to where I am today; who knows, maybe this new start will prompt me to update more often :)

I’ll be setting http://blog.tweex.net to point here, although it might take a while for the DNS information to propagate correctly.

If they’re Ninja’s, why can I see them?

AI
Also, why are they dressed in green?

My AI demo was finished and handed in. My extension task was behaviour trees and there is a video of the demo below, all in HD and powered by the Insimnax Framework.

Insimnax Framework
The Insimnax Framework has finally been released. It is cut down from what I had originally planned since I decided to move the integration of things like physics, GUI, audio etc to the games that use it so that developers could be more flexible. You can grab the full source code (licensed under the MIT license) along with the code for the Insimnax Common Framework (ICL) from here.

I’m currently in the early stages of working on a level editor for it.