Thursday 19 April 2012

Notes on starting programming again

  • Trying to configure Apache + PHP + mysql on a heavily locked-down Windows environment is an incredible pain in the arse.
  • Following on from that, it turns out that XAMPP is packaged with no less than three php.ini files. The one that apache uses is in /apache/bin. Obviously.
  • Today's PHP type-un-safe gotcha: it transpires that (FALSE == ""). Crazy.

Thursday 7 April 2011

HS: RTB

The main improvement since my last update is working return-to-base functionality:

As well as a lot of refactoring in the investigations code to show progress better and to allow me to construct the alien occurrences in their own terms and then map them onto investigation puzzle pieces.

(You'll notice the plane is well out of position off its blue line: I suspect it's not following the height of the blue line, I need to investigate but I wrote the graphics code so long ago now I'm a bit nervous of diving in to touch it.)

Monday 21 March 2011

HS: JSON item loader

I've spent most of today fighting with json.net in order to be able to load items out of on-disk json. You might question the wisdom of storing items in scraps of json, but I was considering using XML and remembered that my adventurous editing of Civ4's XML are still throwing a handful of errors because I have presumably failed to line up some closing tags somewhere or other.

JSON looks nice and clean by comparison:

{
"name":"Colt 1911",
"description":"Classic slimline .45ACP with single-stacked 7-round magazine and auto-loading action.",
"available":"1911-01-01 00:00:00",
"obsolete":"2010-01-01 00:00:00",
"matrix": "11-10",
"mass_kg": 1.1,
"image_offset": [64, 0, 64, 64]
}


Unfortunately, actually getting that loaded up was less than simple, in two areas - first, "image offset" is actually an XNA Rectangle in code, but neither C# nor json.net is clever enough to be able to turn a 4-element array into a Rectangle. There isn't even an array-parameterized constructor for Rectangle, which really is rubbish.

The other problem was the "matrix" key, which started life as a multidimensional array. Unfortunately, json.net can't parse multidimensional arrays, infuriatingly. So I've actually made it a cleaner, more compact string-based format that is turned into an array after load.

What really had me stumped for a long time was how to parse only bits of a json object into my C# object. I eventually marked matrix and image_offset as [JsonIgnore], used JsonConvert.PopulateObject to fill almost everything in and then made a JObject of the input string and used that for the few extra bits in a totally non-intuitive way, thus:

int[] r = JsonConvert.DeserializeObject(job["image_offset"].ToString());

See? Anyway, I think I've got the hang of it now.


You can also see that items clone themselves nicely, and shade in the boxes that they occupy in inventory. They're also loaded and saved depending on which person you select. That all sounds like quite a lot of progress, actually!

Sunday 6 March 2011

HS: sidebar

With a bit of probably-naughty finagling, I've got the organization name and title appearing on the sidebar at game start. The idea is that the type of organization you have will shape what options there are to equip your personnel and so on. So it was useful to forge this link because I now have to add a managed dictionary of items to the organization that are available to equip your personnel with at any one time. Initially, you'll have maybe two pistols, and a load of investigation-related stuff like magnifying glasses, chemicals for testing, white chalk...

Tuesday 1 March 2011

HS: sidebar and personnel

Another long hiatus -- Dev Diary has been busy at work and concentrating on other projects. But quite a lot of progress has been made recently. Here's the new screen you're presented with when starting a new game:

As you can see there's a nice translucent sidebar with some buttons on it. Don't worry! None of them really do anything yet. However, clicking on Washington and selecting "Offices" and then pressing the "Personnel" button will give you this:

Yes! It's starting to look something like an XCOM soldier equipping screen, and indeed that's the point. Obviously I still have to add in some items to drag into those boxes. And then I think I should probably start thinking about savegames, since there'll be some meaningful information to save and reload.

I've also got a cheapass investigations screen fully working now, so another area for exploration is how to connect artifacts discovered through investigations to research projects. More soon, I hope.

Tuesday 13 July 2010

HS: investigations

It's been a while - Dev Diary has moved city and changed job. Here's a screenie of where investigations are currently at:



You can see a list of investigators down the LHS, and the main body is currently just a collection of simple buttons with time limits on them. Once one button is completed, one of the next buttons becomes available. After a little refactoring tonight, I'm now in a position to add 'rewards' to buttons so that completing certain phases of the investigation will add alien artifacts to the player's artifact list. I'll need to create a new Neoforce window for managing artifacts, leading inexorably towards some kind of tech tree.

Sunday 7 March 2010

HS: investigations

Dev Diary has been on holiday skiing in Leysin, which was an interesting demonstration of how hopeless it is trying to render bump maps when your diffuse lighting component is too high.

Now that it is possible to assign squads to attend an investigation, the first part of the game that is actually to do with gameplay can be programmed! Each investigation will comprise a number of elements, and "solving" one element will open up other potential elements to investigate. Some elements may result in the retrieval of alien artefacts or, later, switching to tactical combat mode.

The idea is to make investigations feel as much like "simulations" as the tactical combat mode, giving the player lots of realistic choices to take with limited resources.