Tuesday, November 3, 2009

Dimetric Land Rendering

So I got started on my game, I'm calling it BMAC (Build me a city). I've been playing around with the dimetric rendering (sort of like isometric, except instead of all 3 angles between the axes being the same, 2 are the same, and the third is different). I've got it to the point where with a grid of tiles, each with an elevation, it's drawing a fairly nice landscape. Without further ado I present to you my test picture.

As you can see, it's not quite perfect, some of those little moundy things should really merge with their neighbours, and at the top of the hill in the bottom two lines stick out a bit which is odd, but I plan on doing them soon.

That was quite a bit of effort, and quite a bit of drawing pictures to see how it should look. I plan on making it so it can draw from 4 directions looking down at it, but have only down one of these so far, the rest will come.

That's around 500 lines of code or so, which is less than I thought it'd be, but I suppose once I get all the special cases and directions and things that'll increase significantly. I'm quite chuffed though, I thought that would take much longer.

Monday, September 21, 2009

Yous

This is a word I find myself saying more and more. In current usage, the word you does not technically have a plural, but yous (and also you all) are becoming popular for that. I find myself saying it without thinking, and when I try not to say it, it sounds wrong. It's funny the way languages change.

I'm still not sure whether I want to try and stick with the more "correct" usage, or go with this new plural form. Generally I try and use proper grammar as much as possible, but there really isn't all that much point in casual usage. Words come in and out, meanings change, but sometimes it can be fun to go against that change. I still enjoy asking people, "Contemporary with what?" when they use the term contemporary to mean recent, because that's not its actual meaning. Most people don't even understand what I'm on about, sad as it may be. Ah well, I shouldn't spend too much time bemoaning this change, as I said, languages do change, and will keep changing.

Saturday, September 19, 2009

Welcome To The Masquerade

I bought Thousand Foot Krutch's new album on Monday, and it's awesome! Wasn't even all that long I had to wait to be able to get it here after the US release, less than a week which is much better than the about 2 weeks I had to wait for The Flame In All Of Us (TFIAOS). I had really been looking forward to this, the promotion TFK did for it, the teasers and all really had me hooked, though it's much better hearing it as the entire album than the few songs they had released.

The album just works so nicely as an album, the songs fit together, the sound is fairly consistent without being all the same. And it's heavier, much heavier than TFIAOS, which I like. I'm not sure whether in ranks above Phenomenon as my favourite TFK album (and favourite album of any band), but if it doesn't it comes close.

My favourite song on it (at least for the moment) is E for Extinction. It has a great quiet - loud - quiet sound which is always good, and a good message to go along with it. I particularly like the lyric When we move we camouflage ourselves. We stand in the shadows waiting. Which really hit me. I also like the song The Part That Hurts The Most (Is Me). Which also sounds great and has some good, hard hitting lyrics which I think is a must. I can never get too into a song with poor lyrics.

So well done TFK, you did a great job making an excellent album! Now come back to NZ.

Thursday, September 3, 2009

Laplace's Equation in 3D, polar coordinates

The title basically says it all. For a mere three marks (out of 50) in our take home test, we've been asked to Laplace's Equation in spherical coordinates. As you can see from that post it's a mission. I basically gave up around half an hour ago. It seems that I made a mistake when I was inverting the Jacobian (2 pages of working), which is a slightly different way from the linked article, but that's how we've been asked to do it. Tomorrow I suppose I'll go through it and find my error, which will be tedious. I did get maple to do it for me, so I know what I should get, and I was pretty close, but it appears I messed up one column.

The frustrating part is that even when I've inverted the matrix, I still need to do the ridiculous substitutions you see near the bottom of that page. I won't do them all at once like that, I'll be a bit smarter, but still, it's going to be tedious.

The thing that's really annoying is not that this is particularly hard - it isn't, it's just tedious and a huge amount of work. I won't be surprised if this question goes to 4+ pages. And it's not the kind of work you have to do by hand any. That's why people developed computer algebra systems, why we rely on the work of people who have gone before us, so we don't have to sit there doing tedious calculations. However, I do understand the point, so I'll strive to do it well, plus I want a good mark in this paper, and the test is worth 20% so it is fairly important. Maths Away!

Wednesday, August 26, 2009

Playing with Qt Jambi

Over the last couple of days I've been playing around with Qt Jambi, the Qt bindings for Java, which are pretty cool. I haven't used them that much so far, but they seem really nice. I'd been starting to write this little car game thing, which is more a proof of concept at the moment, which I've now ported to be able to use Qt.

Try it as an applet here (note this is using ordinary Java swing, not Qt as I'm not sure if you can embed a Qt widget in an Applet (or in any AWT or swing element). Then there'd be the trouble of having to download Jambi which is fairly big.

Use your arrow keys to drive around, Ctrl+R resets (in hindsight, not a good choice as it coincides with firefox's and epiphany's reload page shortcut (possibly other browsers too)). The physics is terrible, but I find it fun just driving around, making pretty patterns. You might need to click the applet to give it focus.

Or you can download it here. That includes the source. To run it using qt, it will need to find the Jambi jar file, and it looks in the current directory and "/usr/share/java/qtjambi.jar" (the latter is the default location in Ubuntu (and possibly other distros), so you just need to install the jambi package). You can download Qt Jambi here. Then you need to pass the command line option '--qt'. By default I try and use opengl (which is faster), if it doesn't seem to work, try '--qt --no-gl' to use the regular qt rendering engine.

The number in the top right corner is how many milliseconds it's taking to draw each frame (averaged over the last 100 frames I think). I found Qt with no opengl to be about the same speed as Java swing at 640x480, which I found surprising, I thought Qt would be significantly faster, though at full screen swing slows right down, while Qt only takes a little bit longer, and with opengl it's about 25% faster. YMMV.

I had to be a bit sneaky when writing this so that the swing version would run fine even without the Qt libraries. My first (which I thought was nicer) implementation didn't work, as there were references to the Qt classes in the classes that were being run, even though they weren't used. So when I redid it I had to split everything up, a swing version and a Qt version, so that when swing was being used there would be no references to the Qt classes. I wasn't sure that that would work, but it did, which is pretty cool. Enjoy.

Edit: It appears it's pretty hard for this thing to regain focus, I should probably look into that, enjoy it if you can get it to work, otherwise download the jar, that's more likely to work correctly.

Tuesday, August 25, 2009

Windows Network Grrr...

I've come to be incredibly frustrated with how networks work under Windows (XP) over the past year or so. I'll explain my set up a little first, I have a laptop which runs Ubuntu, I connect to the Internet via another computer (running Windows XP) which connects directly to our cable modem. I thought I'd have issues with this seeing as how I wasn't using Windows, but on my side it has been a breeze (much easier than in Vista on the same laptop).

The thing that irritates me is that every time the driver, firewall etc. is updated, or just at random other times, the computer stops me from connecting. I haven't changed anything on my laptop, I just can't connect to the network. So far we've managed to fix the problem by changing some option somewhere on the XP computer, in some nested dialog box, or whathaveyou after trying various things for around an hour. As I said earlier, it's incredibly frustrating. A thing like that should just work, which it does in Ubuntu, but not in XP (though I haven't tried the other way around). Rant over.

Thursday, August 6, 2009

The magic that's coming to your browser

I was reading on slashdot an article (actually it's more a blog) about some of the cool things that people can now do with javascript and HTML5 and the like in newer browsers. (Sorry if you're using IE, there may be new versions, but they don't support a lot of this stuff.

Have a look for yourself at some of these:

All of these are pretty cool, and note that they don't need any browser plugins to run (though some of them use external scripts, which is kind of like a plugin). I'll draw your attention to the last one in particular, notice that it doesn't use HTML, but the main page is an svg. People have been talking about how this could be the future of the web (though IE doesn't support svg at all yet AFAIK, so if it will be, it'll be a long time away). You may know of svg as a vector graphics format, wikipedia uses it quite a lot for graphs and things nowadays, where it is inherently better than standard images with pixels and all that, but it is a whole lot more than just a vector graphics format, which is why most browsers haven't fully implemented it yet (it's a whole pile of trickiness).

This could also potentially displace flash, which I'm a bit ambivalent about. At the moment I see some places where flash is used well, but all too many where it is used poorly, and the same could be done with these kind of technologies. Also, flash is a whole lot more mature that this, so it can do a whole lot more at the moment (you may have noticed the above could be quite CPU intensive), but there is good competition in the browser space so these should improve rapidly.

I hope you enjoyed my plagiarism of a slashdot article, and a bit of inane ramble.