Showing posts with label ArmA. Show all posts
Showing posts with label ArmA. Show all posts

Sunday, March 21, 2010

Adventures in GUI programming

So, I've been dabbling with a little Qt programming.

I wanted to develop a program that would let me do an easy search & replace for objects in ArmA2 map files. Naturally, while I could potentially write a CLI program, it would be much easier for me (& others who might use it) to have a GUI interface. As I thought writing a windows app would be in the too hard basket, I decided to try out the Qt GUI toolkit.

Not only that, but I installed the NetBeans IDE to do the programming in. The old DevCPP that I've been using for years is still very good (and I've written quite a few CLI C/C++ programs with it), but NetBeans promised to make Qt programming a lot easier.

Shame it didn't make installing all the required software & packages easier... I was rather disappointed, upon downloading the tools I needed, to see that I was promised an almost single-click installation experience - except on Windows.

This is a problem, because ArmA2 is a Windows-only game, so naturally I wanted to do the development in Windows. Not that it really matters all that much where I edit the map files from, but being able to fire up some of the official Windows-only editing tools to check stuff is pretty important.

Needless to say, I did eventually get everything working. I even got the proverbial "Hello World" application to compile & run.

Then I upgraded Qt from version 4.5 to 4.6, and broke everything again. :-(

Took me several hours to fix that problem, which probably says more about my lack of computing knowledge than anything else!

So, I started to code up my app. Quickly figured out how to use the Qt Creator to lay out the application window, with various buttons, checkboxes, and the like. Even figured out how to assign signals & slots to those things that needed them.

I had a moment of feeling pretty chuffed when I got the "exit" button to close the application. :-D

Now I've got the file dialogs working. You can select the input file, and the output file name. It'll even pay attention to those little "read only" & "allow overwrite" checkboxes I put in there.

Then it was time to do the hard part - actually read in the map file.

Well, with the Qt Reference Guide open on the second monitor, it wasn't all that hard. Except for the bit where I couldn't get it to read a float - it kept giving me doubles... turns out that was a compound problem. I was using the reference docs for Qt 4.5, not 4.6, and there's a change between those versions that means a QDataStream defaults to reading double-precision floats, not single.

Fixed that, and had another moment of feeling rather chuffed when I read in the file header (containing 7 or 8 different variables of five different types), wrote it out again to the output file, and compared the two in a hex-editor and found they were byte-for-byte identical for the header. :-)

As I said to the missus earlier - that's 72 bytes down, only 90 million to go! :-D

Monday, September 22, 2008

Some more ArmA stuff...

So, one of the guys said, "Hey, we've got these wind turbine things to stick on the map, it'd be great if they were turning, can someone have a look at that?"

I couldn't let a challenge like that slip by...




Unfortunately, while they work if I place them via the Mapfact 3DE map editing tool, they most definitely don't work if I place them via the usual Visitor3 map editing tool, or compile the modified versions into an existing map.

Bugger bugger bugger bugger bugger.

Oh, well. At least I know my animation code is nearly right...

Sunday, April 27, 2008

Sunday has been busy...

Started with a bike ride this morning - Daisy Hill State Forest, with Mike. Didn't crash on any logs today, although I think I'd like to get a new bike with disc brakes & front shocks - the old one is a bit heavy, and hard on the hands on the rough ground.

After that, we stopped at Mike's place for pancakes - yum! Tanya is well-practiced, and knows how to make 'em good!

A gaelic footy game at 2pm - was pretty good, and I took many hundreds of photos as usual - will post some up here eventually.

Afternoon & evening saw me working on the Opera House:




Making some progress! Have the basic geometry all done, just gotta re-structure those shells to be solid objects, rather than 2D surfaces. And fix a few minor bugs... and split the whole thing into two, as it exceeds the size limit for models in the game.

Getting there, though!

Friday, April 11, 2008

Some more ArmA thoughts

Ok, remember how I mentioned I figured out how to apply surface properties to roadways in ArmA?

Well, that's actually in the Oxygen2 modelling package that the game developers have released. But anyway, I mentioned there that "dirt" was the default surface property. That was because when I walked/drove on the bridge, it behaved like dirt (crunching underfoot, dust clouds from the vehicle wheels, etc). Turns out that's because I drove/walked on some dirt before I got on to the bridge approach ramp in my test mission.

The default action is to continue applying the last surface properties used. If you move from dirt onto an undefined surface, you get dirt properties. If you move from metal decking to undefined, you get metal properties. The obvious solution is to apply properties to all your roadway LOD sections. And now I know how to do that, all is good on the surface properties front.

Shame I can't get ladders & lights to work... :-(

Wednesday, April 9, 2008

VF-1S for ArmA

Obviously a few Robotech fans play ArmA these days... :D

Tuesday, April 8, 2008

The bridge again!

Here's something I was playing around with earlier...



Sunday, April 6, 2008

You learn something every day...

In my case, today I have learned how to apply surface properties in Armed Assault. Specifically, how to apply surface properties to roadways on objects (such as, for example, a certain bridge from several posts ago).

"Roadway", in ArmA, doesn't mean a road, per se, but rather a 2-dimensional surface upon which you can walk or drive in-game. This includes floors in buildings, stairs, and, of course, roadways as normal people would think of them.

So, the Roadway LOD (Level Of Detail - essentially a "layer" of the model) normally only affects where you can walk on an object. Turns out that you can apply a texture to it. And attach a configuration file, that says "where texture X is applied, use these surface properties". Very nice little trick to have discovered!

Now my metal decking sounds like metal decking when you walk over it, rather than dirt (the default surface sound). Just gotta figure out what the roadway textures are that I need for the rest of my bits 'n' pieces.

Still, as I said above - today I learned something. And it was good to learn.

Friday, April 4, 2008

What I get up to in my spare time...



Yup, it's that bridge.

Modelled in Armed Assault, one of the games I play, by yours truly.

Only half scale, but that's big enough! Literally ten times the size of the bridges normally found in-game...

So, I'm an engineer. What you gonna do about it? :-P