Premake Is The Stuff Dreams Are Made Of

Posted in Articles on April 30th, 2011 by Pyroka

For a while now, I have had a task to create a CMake (or the like) script to generate the files needed to compile LibCT for various different compilers. (This was a task originally scheduled for version 2, and got pushed back to version 2.1 as a ‘nice-to-have’ feature).

The reason for my reluctance with regards to completing this task has been just how complex CMake is, even after a brilliant tutorial by my good friend Jamie. Now, don’t get me wrong, I’m not one to shy away from complex tasks, it’s good to have a nice mini-project to sink a couple of weekends into, and learning CMake probably would have been valuable in the future. It was the un-needed complexity that bothered me, the longer I looked at it the more the feeling grew that There has to be a better way to do this, and as much as I love a challenge, I love efficiency more and the thought of so much (apparently un-needed) work did not appeal.

Also on my ToDo list for a while has been to check out a little project called Premake, after reading about it at that fountain of useful information, #AltDevBlogADay so today I finally got around to checking it out, and everything I learned about it just made it better and better.

After a few hours of reading around the documentation, there was no bad news, it supported everything I wanted to do, and in about half the number of lines it would take to get CMake to do things. It was also really rather fast, generating projects much more speedily that CMake had ever done.

I’ll let their (ample) documentation and sample-code explain the system better, but the up-shot of all this is that after a few hours of faffing around I’ve got a Premake script capable of generating (currently VS2010) projects that can successfully build both the LibCT library and EdCT executable.

Task Complete.

Tags: , ,

Easy To Remember Per-site Passwords

Posted in Articles on April 29th, 2011 by Pyroka

So, one of the good things about the recent Sony break-in is how it has brought security issues to the attention of more people, these days it’s not just about having one good password, because people may still get at it, you cannot trust sites to follow the best practices (which is currently to add a salt to the user submitted password, then hash that and store the hash, websites just storing the hash of your password are probably not doing enough), you really need a per-site password solution, which is difficult, I mean, most of us have probably 20+ different sites that we log-in to on one basis or another, and it’s difficult to come up with, let alone remember that many different passwords.

However, I am going to show a nice easy technique that will give you unique, per-site very strong passwords (as in, ‘would require the resources of a government to break’ kinda strong). Now, this method has been around a while and I can’t take any credit for coming up with it but after talking about it to a few people who didn’t know it I thought I’d share it there so that anyone reading this can make their online self safer.

Come up with a strong ‘base’ password

This should be long, and alpha (upper and lower) numeric and symbols, this is the core of your per-site password so make it as strong as you can, then burn it into your memory (you’ll be typing it a lot, so you’ll remember it eventually) mine is 15 characters. At a minimum I’d suggest 10 (the recent Gawker attack proved the benefit of longer passwords, it turned out that Gawker were only storing the hash of the first 8 chars of your password, so if your password is longer than that, the first 8 chars are useless on any other site).

Append 2 chars for each site

Something easy to remember, so ‘tw’ for twitter, ‘gm’ for Gmail, etc., this will give you a password of ‘<BASE_PASSWORD>tw’ for twitter, for example. Now for each site you only have to remember the two chars, and since they are logical and related to the site, it’s easy to remember (sometimes I forget, but my first guess is pretty much always correct because my mind comes to the same conclusion about what characters I should use as it did when I created the password).

This also adds an extra 2 chars to the length of your password (if you really want to be good, try capitalising one of the characters but not the other).

This will give you a password that is impossible* to crack, and importantly, a different one for each site, so the next time a site you use is compromised, you don’t need to worry about any of your other accounts.

(* Impossible in that it would be much, much cheaper to hire someone to put a gun to your head and make you tell your password)

Now, I understand to some/most people this sounds like overkill, and it probably is, no-one will care that much about any account I own, but for the small amount of effort it takes (ok, it may require some work to change all your existing accounts to this system but it’s an evenings work at most) it is, in my opinion, worth the piece of mind to know that I have done everything I can to protect my accounts, my (on-line)identity and the information about me and my friends that I have access to.

Tags: , ,

OpenML And Textures

Posted in Code on April 26th, 2011 by Pyroka

So a little while ago I announced my plans to write a cross-platform model-loading library in C (named OpenML, I’m really bad with naming things) and things have been progressing quite well thanks to the long-long bank holiday weekends.

I started off with the Wavefront ‘OBJ’ format, and am pleased to report that I can now load in the verts/normals/uvs that make up the models (even coping with the OBJ formats oddities such as negative indexes and the like). Currently the results are shown in a small (Windows only, for the moment) C++/OpenGL program that simply draws the model (I plan on converting this to use wxWidgets in the near future, so it will be cross platform and I can add a nice GUI).

I’m at the point where it would be really good to see some textures on the models, which requires parsing a few .mtl files and loading the actual textures, which is the issue. OpenML is a library for model loading, not image loading, I would ideally like to keep it as small as possible and it would certainly balloon in size if I were to add support for loading the common image formats, secondly, I have no real wish to write yet another image-loading library, there are several very good ones around already, I could, in theory link to one of these but then that breaks the mantra of having no dependencies. There is also an issue with storing the texture data, as the models would have to store the raw unpacked texture (since OpenML is renderer agnostic). Finally, when I first imagined OpenML I basically pictured a command-line tool that would allow you to convert a model from one format into another with a single command, and well, loading textures gets in the way of this (as far as I know, all the major model formats store images externally and reference them by path) so the time spend loading the data would be wasted.

With these thoughts my decision  seems obvious, OpenML will not load textures, only tell you which ones need to be loaded, then it’s up-to you to take care of the actual loading and rendering.

I have always liked the UNIX philosophy of lots of small programs that do one thing, but do it very well, combine that with some scripting magic and you can do amazing things, it is my hope that eventually OpenML will be used in part of larger tool-chains and do it’s ‘one-thing’ very well.

Tags:

New Laptop

Posted in Uncategorized on April 25th, 2011 by Pyroka

I’ve had my current laptop for about 3 years now, when I got it it was pretty good (graphics card was a little weak but otherwise nice) and it has served me well these past few years. But it’s had a tough life ~10 hours a day of use every-day, mostly compiling things, the keyboard broke, the hard-drive broke, there’s a chip in the screen and the case is scratched to hell.

All in all, it’s time for a new laptop.

I decided to check out PCSpecialist, on the recommendation of Jamie, it’s a site which, (like Dell) allows you to customise your computer, but unlike Dell, PCSpecialist is more geared towards people that have some idea what they’re actually doing (although there is a section for people with no clue about hardware, but I’ve not looked there to see what it has to offer). PCSpecialist seems to be pretty good price-wise and everyone raves about their support.

I originally had a budget of about £800 for this laptop (currently saving money for a house so couldn’t spend too much) but since this month I got paid extra by picking up some teaching hours, I decided to go all out (in the hope that in ~3 years time when I’m buying my next laptop money isn’t an issue).

I started with the Optimus II as a base laptop, since my current laptop is 17” wide-screen I really can’t see myself coping with anything smaller and the next laptop up from that started at ~£1,000, making it slightly out of range.

To that base I added the following components:

  • Intel i7 Quad-core (2.30GHz, 8MB cache) processor
  • 8GB (2x4GB) Kingston 1600MHz DDR3 RAM
  • nVidia GeForce GT 540M (1GB/DDR3/DirectX11) graphics card
  • 750GB WD Scorpio Black (7200rpm) HDD

This makes a really rather nice laptop (yes, it can run Crysis(2)) and the price for this beast: £1094. Too much to spend on a laptop? I think not, considering the use I’ll get out of it.

Paying for said laptop was an issue, I attempted to pay with my card and it was so much money that it tripped the fraud-check and my card got locked down, thankfully PCSpecialist accept numerous methods of payment, so a quick bank-transfer and I was good to go.

Now please excuse me while I go compulsively refresh the order tracking screen.

Tags: ,

Backup Your Damn Data (For The Price Of A Sandwich)

Posted in Articles on April 25th, 2011 by Pyroka

We all know we should backup our data, ideally the backup solution we use should be ‘set-and-forget’ because, honestly, who remembers to backup? The guy who’s just lost his data, that’s who, 3 months from then? Maybe, possible, occasionally, on that external that’s kicking around somewhere.

I got seriously into backing-up up my data in the final year of uni when both my PCs died in the same week (lucky for me I had enough time to bring one back up before the other died, so I could carry on my work).

Now, thankfully at the time I was backing up to an external drive pretty regular (I had a batch-file to take care of it) so I didn’t loose too much, but the experience convinced me that I wouldn’t mind paying for the piece of mind to know that I have a proper backup solution in place.

It was shortly after this, I realised how shockingly cheap on-line backup is.

My current backlup host is CrashPlan, chosen from a long, long list of competitors for the following features:

  • Unlimited backup space
  • Cross platform (Windows/Linux/OSX)
  • Nice, easy to use client
  • Encrypted backups
  • Backup to a folder/external drive for free
  • Backup to a friends/other computer for free
  • Continuous backup (every-time I’m not doing anything, my pc is backing up)
  • Adopt a computer (prevent a fresh full-backup if you format your pc (I’d get this for this reason alone))
  • Cancel any-time and get any remaining contract time refunded
  • E-mail/Twitter notifications, either a backup report showing success, or a warning if a backup hasn’t succeeded for a while

An impressive feature set, I think you’ll agree, and I currently get all this for £2.50 a month. ($4.17, so it depends on the exchange rate)

Yup, for the price of a sandwich you too can get all this, that price is based on a yearly contract (pretty much risk-free if you can afford the up-front cost, as you can cancel at any-time) you can get it even cheaper if you go for a multi-year contract.

Now, the issue with on-line backup is the time it takes for that first backup, the CrashPlan client is pretty fast, and it only took 3/4 days to send over the 25+ gig of data I backup (which isn’t too bad, but you may get better) which is why the ability to ‘adopt’ a computer is invaluable. I’ve just bought a new laptop (more on that later) and when it get’s delivered it will be my new main computer, so I’ll move my CrashPlan onto that, if not for the adopt feature, I’d have to re-do that initial upload (my original backup provider, Mozy (whom I don’t recommend) didn’t have this feature, and it was a pain to have to re-upload that much data). Now I’ll just have to click a button saying ‘yup, that data now belongs to this computer’ and all is well.

So, don’t wait till something bad happens to get serious about backing up your data, for this price, you really can’t afford not to.

Tags: ,

LibCT 2.1

Posted in Code, Portfolio on April 24th, 2011 by Pyroka

Work has begun on LibCT version 2.1, after a while considering what improvements I wanted to make to LibCT I think I’ve come up with a decent enough list to warrant a new (minor) version of both the editor and the library, the current plans are:

EdCT

  • Add the ability to double-click on the labels to bring up and edit dialogue
  • Add a ‘delete’ button to the labels
  • Add ‘Insert Variable’ button to Choice and Phase text entry

LibCT

  • Re-factor connections
  • Implement ConversationInstance to make using conversations easier

As they stand at the moment, all nodes have two connections, but only the Decision nodes actually use two (Conversation and Choice nodes have 1, and Phase nodes do not have any), the plan is to create a template-class which will take an integer parameter specifying how many connections there should be with functions to access and set the connections, then the nodes will inherit from that class. This will prevent the current waste of memory that is incurred by all nodes having an array of two connections.

At the moment, it if fairly easy to keep track of conversations (as the sample code shows) however, the implementation of a simple helper class ‘ConversationInstance’ can easily hide the remaining complications helping to reduce bugs and speed up implementations, it also reinforces the idea that conversations can be used in parallel.

 

I’ve no doubt that in the process of making these improvements I will come up with even more to throw in, you can keep track of my progress on the LibCT Roadmap.

Tags: ,

So I Decided To Write Some C

Posted in Code on April 16th, 2011 by Pyroka

For a good while now, I’ve had it in my head that I want to develop a small, cross-platform library for loading/saving various model formats, kind of a DevIL for model formats.

The urge to create this library stems from many things: My frustration at having to write model loaders for different file formats on projects I do, the annoyance of free models that come in a different file-format to the one you want (it’s difficult to get blender to convert them) the hassle of getting a model into OpenGL. Also, I like playing around with low-level file/memory code, I get a strange feeling of satisfaction from being so close to the hardware.

So as I said, this desire has been building for a while now, but, after reading some #AltDevBlogADay posts, I have decided to create this library in C (C90 to be precise), in the ‘no-dependencies’ style of John Ratcliff and Sean Barrett

There are a few reasons for this; C libraries are easy to use from other languages, which will open the library up to more people and generally allow cooler things, secondly, I really want to learn C (Knowing C++ means that I know how to code in rudimentary C, but I’d like to have some experience doing a project in pure C to up my code-fu), finally, I like the idea of doing everything my self, having no dependencies on external code, which is a situation you don’t usually get into in professional life (where you really need to have a damn good reason to shun tried-and-tested code).

So, I’m not sure how far this project will go, if it gets far enough the source etc. will be released (under a permissive licence, probably MIT). I think the first file-format that I’ll aim to support is the Wavefront ‘OBJ’ format since it looks simple-ish and is well defined. Then I may move onto the DirectX ‘.X’ format, since it’s fairly widely used.

Tags: ,

New Game Editor

Posted in Articles on April 7th, 2011 by Pyroka

This post is a continuation of the How I get things done, for a while I was stuck on my most recent project (an XNA game). Despite having a large number of tasks set out, in a priority order, my next task (na) was causing me issues:

‘New Game Editor’

This, as a task, sucks.

It sucks even worse than a task of ‘Make game now’, because at-least that one is obviously bad.

It seriously took me about a week of being stuck on this task before I realised that it was way too big and too vague, especially given the complexity of the map editor (as it intends to be user-facing), I didn’t know where to start with it.

So one night I decided to do what I should have done in the first place, break that task down into a number of different tasks (about 15) which encompassed the next few parts that will eventually make up the ‘New Game Editor’.

The next week, I stormed through these more manageable tasks, causing the editor to improve greatly (it’s kinda getting somewhat close to being complete… Ish)

If you ever find yourself staring at your ‘na’ task, wondering where to start it’s too big take that task and break it down further until it’s obvious how you should proceed.

Tags: