Home   About   Contact   Log in

Archive for the ‘Programming’ Category

Coding

August 5th, 2008 | No Comments | Filed in Programming, blog365

Spent the day writing code.

XNA Game Studio

July 29th, 2008 | No Comments | Filed in Programming, Projects, blog365

Well they’ve made this a bit easy! I’ve spent the day following the beginner’s tutorial and have a rudimentary spaceship shooting game working. It shouldn’t have taken all day, but the tutorial videos are aimed at someone who’s never used Visual Studio or C# before. I know what an “if” loop is now, at least ;)

MS appear to have made it quite straight forward to get things moving around the screen, which is good.

In other news, my Internet connection is having problems and is currently grinding along at 3MBits after spending the past half-hour having a fit and disconnecting every two minutes.

Another Context Free image

July 15th, 2008 | No Comments | Filed in Programming, Projects, blog365

Here’s the result of some more graphical hacking. I quite accidentally discovered the nice patterns caused by rotating a shape around a midpoint. It’s a bit like those overly complicated spyrograph toys we used to have, only without the pens, cogs and irritating scoring pen line where the cog slipped, sending your pen skating across the paper.

Spyrofern

I’ve registered on the Context Free website, and since the app itself has a handy upload feature, I can put things on it easily :)

More Context Free Art

July 13th, 2008 | No Comments | Filed in Programming, Projects, blog365

I have set up a picture gallery on my photos website, as an easy way to show off the images I’m creating. I can’t include the code there as there’s no way to do that, but one of the things my new main website will have is a section for these pictures and their associated code.

Creating these images is really good fun. Usually programming is a process that has a definite aim - I’m going to create a new website, I’m going to make a program to catalogue my music, etc. From that aim the program is structured and then code written. It’s a well documented process. It’s comparable to traditional art, with the artists creating their own interpretations of real world objects or scenes, or through their imagination creating a scene that could be a real place.

There’s another style of art though which is more abstract. The artist being more interested in experimenting with form, colours or whatever else they can think of. Context Free is the programmer equivalent of that. I can sit down and for half an hour mash out some code that draws something pretty. If I don’t like it, I can modify the rules until it looks better. Often it will accidentally produce something I had no intention of creating.

It’s also fast and immediate. The only code I can write is rule definitions that describe how circles and squares are drawn. There are no loops, no variables and no boilerplate setup code.

Learning LWJGL, Slick and Slickset

May 14th, 2008 | No Comments | Filed in Programming, Projects, blog365

Printed out the example Space Invaders clone, scribbled all over it to make sense of it. Turns out the old method of learning how to program still works pretty well. I guess I’m a visual learner since the simple act of printing the code onto sheets of paper so I could draw on them caused the code to make sense. I sat on my settee and by cross-referencing the code to the Javadocs was able to work out the boilerplate code from the actual game logic.

I also found the possibly dead, but handy Pixen pixel art package for my Mac.

I’m experimenting with some woolly psychobabble ideas too. My PC is in my office and I do work on it. The work is quite interesting and motivating. I also have my Macbook which I could do work on, if I bought the VMWare Fusion key that I need. My Mac has Eclipse installed though, and the SlickSet stuff all set up. It’s turning into a portable devkit quite nicely, and is currently being my “fun” coding environment.

Sure, I could sit at my PC with its twin 19″ monitors, a mouse and a clacky IBM Model M keyboard and run Eclipse. But my Mac lets me sit in my bedroom and code, or do it downstairs in front of the telly. This portability lets me code when I want to, where I want to. Personal coding is supposed to be fun and amusing, rather than something rigid that you’re paid to do. So anything that makes it more fun is going to help with motivation.

I’ll install Eclipse on my PC at some point, just to check the code runs OK in Windows and Linux. I’ll also commandeer Amy’s PPC iBook to see what it’s like on that too :) She doesn’t know this yet though ;)

LWJGL, Slick and Slickset - Java Game Development

May 9th, 2008 | No Comments | Filed in Programming, blog365

Programming other people’s systems is hard. Programming your own apps is easy, you just make them do what you want. The only hard bit is stopping when they’re finished, or continuing when it gets slightly tedious.

I don’t like tedious coding. I’d rather go away and code a code generator, or use Excel and search-and-replace, or anything that’ll solve the problem with the least amount of effort. I’ve got SQL stored procedures that generate C# code from other SQL stored procedures.

I’ve got that urge to write some simple retro-styled games again. I keep getting this idea every so often, but then give up when it comes down to actually writing them. I either can’t decide what to do, or get bored hand crafting yet another sprite library and doing my own implementation of collision detection.

Fortunately them I’ve found three things that’ll make my life easier. LWJGL is the Lightweight Java Gaming Library, which is quite nice. Built on top of this is the Slick 2D game library that removes some of the tedium of moving sprites and handling their collisions. Then, to make it even simpler I found something called SlickSet which is a 2D game engine. It’s got premade collision detection, “actors” and ways of managing lists of things.

It comes with nothing but the Javadoc for documentation, but the examples are fairly simple to follow. I intend on working out my own little sets of documentation, then sticking them up here at some point.

Programming is hard

May 8th, 2008 | No Comments | Filed in Programming, Projects, blog365

Not only do you have to work out how to make the thing, but you need to understand the business process too, and understand what the user really means. It’s not enough to simply join databases to forms and bash out lines of SQL; there’s a requirement to understand what’s going on in the user’s head. Why is it important that their “Sales Order Report” has a “Sales Line Reference” on it? What is a “Sales Order Report” anyway? Who makes them and what are they used for?

Without understanding the way the user works, you can’t write their software.

So beware the next time someone says “can you make me a new stock system” since it’s not just a bunch of databases joined to a form. That’s like saying a human body is simply a bag of goo that moves on its own. Writing software is easy, the problems have all been solved and are hiding in Google somewhere, ready for you to find. The hard part is working out what the users are going on about.

Just how, with rigorously tracked stock levels where everything is accounted for, down to the last widget, do you cope with “well sometimes people just walk in and buy stuff with cash, and we don’t run it through our books because it’s not worth the effort”? Business processes are what happen when groups of people come together and try to gain the upper hand on each other, it’s not a neat well-defined system you can pack into a box and label “selling widgets”.

It’s fun though. There’s comms hardware out there that communicates using port 6666 because I randomly chose it one night.

Designing out the confusion

April 7th, 2008 | No Comments | Filed in Programming, Projects, blog365

Steve, who I used to work for, came over to visit this evening. For the past year I’ve been converting one of his pieces of software from C++/MFC to C#/Winforms. The program is a kind of stock management sytem with a database back end.

Following Steve’s design has been fairly straight-forward. It helps porting an application if you have not only the original source, but the person who wrote it to hand.

One part was being rather confusing, dealing with how items of stock are stored in the database and how they are related to each other. After about an hour of playing with the C++ version and Steve explaining what was going on, I managed to untangle my brain and write some notes that now make much more sense. What I thought was a hideously complex system is now somewhat simpler.

We also went up the road to a nice pub and had some nice food. I had a steak with a piece of roast chicken breast on the top, and a bowl of chips.

So much code!

March 20th, 2008 | No Comments | Filed in Programming, blog365

I woke up 14 hours ago, and except for a few hours thoughout the day for mundane things like eating, having a bath and “watching TV to avoid going insane” I’ve spent the time sat at my PC churning out code as if my compiler had an expiry date. The program I’m working on now has stuff that can be demonstrated to the client, and I’ve not managed to crash it yet, which is good.

There’s a large hole in the software that I can’t quite fill correctly. This project is a rewrite of an older Visual C++  version of the software and initially I simply ported all the code and database across to C#. Now the database has been rearranged and redundant data stripped, big bits need rewriting. Somewhere along the rewrite a database table has either vanished or been folded into another table. I think I’ve found the definition for it in some notes I have, but I’ll need to sit down with a really hot cup of tea to go through things and sort them out.

My brain hurts though so that’s job for tomorrow before my parents come to visit.

More C# Coding

March 19th, 2008 | No Comments | Filed in Programming, blog365

Those code generating stored procedures I wrote the other week work really well. I’ve just had to rearrange a database table, adding more fields to it. It took no time at all to get the new C# code created and running.

Coding database apps becomes that bit more fun when creating new database tables ceases to become an expensive time-consuming operation.