Saturday 11 June 2011

A near-usable tool!

I got some really productive coding sessions in over the last few nights. Yes, there were the usual bouts of frustration mixed with raw expletives and sprinkled with a topping of "wtf?", but on the whole, I got loads done.

First up, the viewpoint movement routine. I tried various methods of achieving this, but it turned out that the most effective was one of the simplest. Move the selector rod to a tile, hit "C", and the camera then centres on that tile. Simples. I had to code an assist routine, because when the camera makes the jump, if the tiles aren't yet textured (and they're not because I haven't wrote a texturing routine yet) it's easy to become disorientated and lose track of which tile you centred on. To aid here, I have made a translucent cube appear on the centred tile, and slowly sink down through the matrix. This instantly shows which tile the camera was focused on...


Next up, the Save and Load routines. Admittedly, these do need more work, but the basics are there and I can actually export matrix data, then re-import it. Sort of. What you have to remember is that there is no "Save Matrix" command available. (Or "Load Matrix" for that matter). Both of these routines have had to be built from scratch, and I've probably gone right around the houses to get them where they are, but it's a learning curve.

So on to the issues. Firstly, the Save isn't 100% reliable. That's not a great start. I'm still trying to nail the problem down, but when it does save - which is 9 times out of 10 - it actually saves data. It's just that now and then it completely refuses to export anything at all, and I'm not sure why yet. By the way, these Load/Save tools aren't like your standard Windows dialogue boxes or anything fancy like that, they are pretty much "Press S to save then type in a filename" or "Press L to load then type in a filename" affairs, but I'm a beginner at this so I have to start at the beginning. Or something.

Anyway, on to the Load routine. Yes, it loads the data I saved earlier. Unfortunately, it doesn't pick up on any texture data, and I can't work out why - yet. So I get the Matrix shape loaded, but it's completely wireframe. I know I haven't wrote a texturing routine yet, but all the tiles are textured by default, and it's not picking those values up for some reason. But I'll get there.

So the following pictures show what is currently happening when you export a matrix, then shut down the program, then open it again and import that saved matrix. As you can see, the correct shape is there but that's all. Having said that, getting this far was no walk in the park.


 

Finally, I've started work on the texturing routine. This is a standalone program at the moment because I want to figure it all out before I embed it into EasyMatrix. Basically, the program takes a bitmap which contains all the textures needed for the level, cuts it up into 48 small pictures, makes 48 sprites from these pictures and lets you manually select which one you want to work with. The "active sprite" as I call it, is shown at the top of the swatch as a full-size (128 x 128) texture tile, ready for application to the Matrix. But I haven't got that far yet.


As you can see, the mini-swatch rotates slightly, to give you a quick indication of where abouts in the texture pallet you are.

So that's about it so far, it's a near-usable tool but not quite there. I would say another couple of weeks if gaming doesn't get in the way. Which reminds me, I re-installed Call of Duty 4 and completed it again this last week. I forgot how much better than Modern Warfare 2 it is. Now I'm getting hooked on the Multiplayer again. So I managed to do that, and get a fair bit done on EasyMatrix. It's been a good week, coding-wise. 


No comments:

Post a Comment

Please leave a comment...