Saturday 31 October 2009

TrackIR now working

TrackIR now works in Combat-Helo. Hooray. The screen-shot below shows the raw output. Other things I added, TADS turret tracking of head position. When we get our working Apache model, the PNVS will be slaved to the pilot head position etc. But I'm glad this is now working, the 'fix' was simple as it happens, I was initialising the DLL before the window was created. The TrackIR wrapper needs a handle to the window.



The region around Herat has some reasonably good SRTM (Shuttle Radar Topography) available. I've imported some of this (again shown in screen above) to get a sense of scale. The boxed area in the image below shows a 40x40km area, one map 'page' of our AO centred on east Herat. The border with Iran is to the west. Kabul is along the narrowing valley that runs east and is the main supply route for the region.




David the robot modeller has been building ZU-23-2s. He felt one wasn't enough. So he built a whole family. All of these are based on actual mounts.


The Toyota mounted ZU-23 close up...


And the real deal...


I bet you have more respect for Toyota trucks now. Speaking of Toyotas...we have a whole family ready for deployment in the region...


As well as a number of Safir, the Iranian clone of the classic Jeep.



Nice one David.

Updates are in-frequent this week and the next. Busy schedule combined with research and documentation, researching audio elements and mechanical systems means little hands-on programming is done.


Wednesday 28 October 2009

Scripting for combat

Struggling to find a suitable introduction for new WO pilots in the region, it has to impart some information, set a scene, give you some clue as to further action. And do that in around a minute.


Assuming you've completed the tutorial flight and done the walkaround, listening to your mentor with the mid-Texan drawl. It's time to spawn your new career pilot in the game world.


"Welcome to the sweat box pilot. We have laundry and air-con now so it’s not as bad as used to be. The NAAFI shop is right over there, your bunk is in there and the en-suite facilities right over there. You can’t miss ‘em. The o-club you can find for yourself but it’s not always open.


Air-power out here is vital, it is a hostile environment.


We get mortared daily. It’s not a matter of if we make contact but when. When we do come under fire, take cover as best you can, make your way to the command tent and await instruction. Our birds are kept ready and so should you. I recommend you get some sleep when you get a chance; it’s the one luxury we can’t fly in.


Get to know your way around the base and I’ll catch you later."




Currently scripting for 5 roles:

  • ATC
  • BETTY
  • FAC
  • PILOT#1
  • PILOT#2
As I was writing for the crewmen, it struck me how similar it sounded to another helicopter game when I released that I helped script that one too. I don't think it counts as plagiarism is you copy from yourself?

I'd love to add more story elements for some scripted missions but I don't think we have the resources to do that. I'm not sure we have the resources for the above. It seems like a huge effort. If we can pull it off, it will sound fantastic.

Tuesday 27 October 2009

Gratuitous screenshot of the day

I kept working on the 3D pitch ladder and I have a version I'm reasonably happy with. But there's something that bugs me about it. It exhibits the same behaviour as it does in Longbow 2, you need to bank at around 45 degrees and slew the view around. Hey, it works.

Work on voice scripting begins this week, more on that in a few days.

Some performance improvements by better management of material options and I'll be paying more attention to hierarchy Groups for improved visibility checking.

Now here are two screenshots for the sake of having something pretty.



And one more as I like it.

Sunday 25 October 2009

IHADSS - pitch ladder fix and a few other things.

Due to differences between the HUD stand-alone test module and how the simulation runs, a few changes were necessary.

  • I fixed a problem with the rate of climb indicator and smoothed it out.
  • Forward airspeed (is displayed in Knots) is incorrect and will be corrected in the next update.
  • The Pitch Ladder is now in a fixed position relative to the front of the aircraft, instead of moving your view around and it always being in shown.

About the pitch ladder. I used an Orthographic projection for the pitch ladder to stop the perspective from bending the horizon lines when partially visible, I felt this feedback was confusing. Ortho projection can look a little odd. So I don't know. I'll change it later if people want.

This is how the Ortho pitch ladder looks. The negative pitch lines (the dashed ones) need the vertical ticks reversed, they should always point in the direction of the horizon.


Terrain Reference Photos

Some reference photos for building terrain....here so we can all see.








Saturday 24 October 2009

IHADSS - opps

I just realised (again), the axis of the helicopter is along the -z axis, the roll indicator and pitch ladder were reversed. Fixed.

HUD module in place

The IHADSS module has been moved into the simulation. Some intergration work is required to fix up all the features, mode selection and so forth. But it went smoothly. Having a working HUD again makes a big difference.



Another gratuitous screen-shot...


And another...


And one more...

Friday 23 October 2009

BMP2 Deployed

A lot of new assets completed today but today I'll highlight the BMP2. A turreted 30mm autocannon and carries 7 troops in the rear compartment. The ATGM launcher fires AT-4 Spigot missiles.








A slight accident. Hope nobody was inside at the time.

Wednesday 21 October 2009

Flight Test Video - with funky 90s tunes

Apache - Second Flight



Second pass on flight controls went well today. I now have FULL control over pitch, roll, anti-torque and getting used to setting this tub of lard down on the deck. Still a lot of little touches to the dynamics to add. This is one area I'm sure will be constantly tweaked. I'm impressed with the sensation of flight at low level.



With sound and new 3D to come it's going to fly like everything I've been hoping for. And when she's ready, the real work begins on bringing the rest of the world to life.

Tuesday 20 October 2009

Apache - First Flight


I had a little experiment with lifting forces, coupled a rudimentary throttle control system to a thurst vector with some torque control. The result isn't pretty, actually it's pretty horrible but she does at least get off the ground. The tail dragging attitude of the Apache means once she lifts off, she tends to travel backwards, all necessary forces and inputs are not yet in place to have any form of satisfactory control.

But she does at least take you for a ride. I added a "blade view", pictured right which is great if you like being dizzy.




Apaches can now be spawned, boarded, seat positions chosen, even an outside view system. And it takes off. Some roll control is available but this is just the first attempt, I didn't expect more that the darn thing to go up and down. Which it does.

Here's a screen-shot from the first flight.

The rotors cast full cockpit shadows (effect akin to MS:FSX with DX10 preview) and from either seat it's quite spectacular with such a high-visibility cockpit. There's no rotor-blur in screen-shots unless we 'fake' it using a motion-blur post effect.



Here are two shots of the Pilot and CP/G positions. The code can accomodate any number of crew positions for any vehicle we want to include.



It's awfully tempting to plug in the HUD module now. That would be way ahead of schedule. There is an odd crash that occurs only in the runtime compile relating to the UnBindPlayer messaging, doesn't happen with the debug compilation. I can get around it using the same code in a different object class but it's most curious.

One last screen-shot from the maiden flight of the Camp Zero Apache. You can see the 8km horizon draw distance, the small town and Camp Zero not very far away. This is our testing area for the game assets before we build the campaign theatres.



Oh, there was one other odd thing. I was pulling my hair out trying to get the camera and crew positions in the right place, everything seemed backwards, I had to rotate the invisible pivot where the crew positions are located by 180 degrees. Turns out, the Apache model is backwards. *sigh*. My original numbers were right at least but I wasted a few hours.

It flies, badly. I love it.

Monday 19 October 2009

Messaging is such a bind

For every THelicopter entity is a little bit of code that accepts messages.



Function MessageReceiveCallback(entity:TEntity, Name:String, extra:Object)
Local heloid:String;
heloid = GetEntityKey(entity, "guid");
DebugLog("   MessageReceiveCallback :" + Name + " heloid:" + heloid + " GetEntityKey returns:" + GetEntityKey(entity, "guid"));
Select Name
Case ACTION_MOUNT BindHelicopterToPlayer(heloid);
End Select

End Function

' CALLED WHEN THELICOPTER MESSAGE IS RECIEVED
Function BindHelicopterToPlayer(linkid:String)
Local helo:THelicopter;

helo = THelicopter(game.Helicopters.ValueForKey(linkid));

If helo Then
game.SetPlayMode(PLAYMODE_HELICOPTER);
game.PlayerVehicle = helo.entity;
game.PlayerVehicleBody = helo.body;
EntityParent(game.PlayerVehicleMount, game.PlayerVehicle);
PositionEntity(game.PlayerVehicleMount, Vec3(0));
AlignToVector(game.PlayerVehicleMount, game.PlayerVehicle.Position, 2, 1, 180);


Local crewpos:TEntity = CreatePivot(game.PlayerVehicleMount);
Local newloc:TVec3 = TFormPoint(PLAYER_SLOT_APACHE[CurrentSlot], game.PlayerVehicleMount, Null);
PositionEntity(crewpos, newloc, 1);
EntityParent(game.scene.cam, crewpos, 1);
PositionEntity(game.scene.cam, Vec3(0));
RotateEntity(game.scene.cam, Vec3(0));

EntityParent(game.scene.cam, game.PlayerVehicleMount, 1);
Else
DebugLog("   BindHelicopterToPlayer :" + linkid + " failed. LinkID not found.");
End If
End Function
End Type


A short explanation, when the game sends a message to a helicopter TEntity object to mount (ACTION_MOUNT is defined as the text literal "mount") the BindHelicopterToPlayer(...) function is called which gets information from the game about that particular helicopter and binds the player and game camera to the current active position within the helicopter.

Using messaging has advantages in that it can be scripted externally by LUA sending the message to the helicopter, this a script can bind a player to any helicopter at the start of a mission, or during some scene, or as a result of multiplayer code.

The player has key commands to Unbind from the helicopter which will be locked off at some point in the future. We don't want players jumping out of helicopters mid-flight do we?

We have some logging in there to check what's going on for debugging. Each vehicle type we want the player to control will have a function like this, the main game code knows which vehicle mode is active and calls appropriate control input and vehicle update functions. Right now we have Apache helicopter and ground pounder.

You may notice that the BindHelicopterToPlayer parameter [linkid] is a string. All objects are identified by a texted based key, Apache Longbows use the base key "LONGBOW00xxx" where xxx is a number assigned automatically at object creation. For human interation, tail numbers can be assigned. Callsigns based on rifles and handgun names will be added later for the benefit of grouping helicopters for mission triggers and voice scripting.

Saturday 17 October 2009

Campaign mode Hearts and Minds - Villages and towns

Years ago I envisioned a campaign system that didn't focus on military objectives. Military actions good and bad, would influence both resources and friction to your continued operation. You are here in a battle against insurgents in a place that is populated by people you will either win over, or have to persecute. But in the campaign, everyone knows everyone else. You're actions against innocents can trigger hatred and uprising elsewhere. Villages are populated by people who are pseudo-randomly linked (as friends, family) to other places and people. Hostile or indiscriminate destruction will effect other regions. And this works both ways in the campaign. Insurgents or other hostile forces can trigger a rise of unpopularity for their cause, or yield information which leads to missions of importance.




As a pilot, you only see these effects in the abstract. Flying over a village may have a sniper taking the occasional shot at you, or an increase in overall AI crew morale and performance, benefits of making a difference in the area. Missions you are tasked with will always be influenced by your performance. Your mission is to combat a rising tide of insurgent activity, some things are just out of your control but the key is not to make them worse.



Does this town contain hostiles? It might, it will most certainly contain friendlies and you must keep it that way. Unlock the ability to direct local ground forces and fly in support.



While it is possible to land and explore villages on foot, it will be unwise to do so in a hostile region without support of peace-keepers. Improvised explosive devices or IEDs could be anywhere on regular patrol routes.



This is just one campaign mode providing a cerebral strategic sub game that will provide players a reason to come back and do better. It will enable players to explore consequences of actions and manage resources. After years of tweaking it will be gratifying to finally see the H&M campaign in action, the way is was meant to be.

BMP2 and M2A3 in profile



A render showing the BMP2 and the M2A3 model in profile.





Iranian cammo, one of three styles seen in public.

Thursday 15 October 2009

Rotors engaged

One of the really cool aspects of working on games is when all the little bits of code are assembled and things start to work, objects come to life.


As much as I really hate the awful stand-in Apache model, I mean look at it, it's a horrible green-brown and has black bits all over it. It's a mutant helicopter from the sewers of Mars, terrible. To show my distaste, here's some grey scale screen shots.

Our game now lets you spawn and board any Apache entity. Once in the cockpit you can spin up the rotors and admire the shadows flicking over your canopy and sun shield. This is an Apache coming to life in our game world. Missing some sound effects though.


For all the test programs and stand-alone programs made over the years to see it come together in such a short amount of time is gratifying.

Still a lot of work to do. Some of the shots have the Depth of Field (DoF) effect turned on while I was experimenting with focus pulling (looking in and out of the cockpit). This is something the user can turn off and I only added it as I thought the effect in Operation Flashpoint DR when you brought a weapon up was cool. I'm not convinced it works for flight simulation.



Out of the pilots left window you can see the new cold-start generator, this actually works, you can walk up to it and turn it on and off. This was an accidental and easy to add feature as a result of how we're building the camps to be interactive. It will be possible to include crew-chief operations if we wanted to go in that direction.


Not sure it makes for a fun or gripping gaming experience, even if it does come complete with trailer hook. Here's one generator under camo netting covering an M1A1 work area.




I'm hoping that one day our helicopter will look as good as this one. The MilViz model.


Instancing - yes it works


29 helicopters with shadows and 1 fps drop. That's quite impressive performance.

Wednesday 14 October 2009

Big code push this week - The TState Class

The bulk of the art assets required for the demo are complete. I'm busy adding code to populate the battlespace with helicopters and tanks. Essentially the Classes (in OOP terms) that upon creation of a new vehicle loads any required models, adds it to the overall TGame class, sets up initial state of the aircraft or vehicle (cold, engine running, where it is etc.).

In code, if a new THelicopter is created, it will magically appear in the 3D world in the state is was created. Now helicopters can be spawned by .SCN scene files, mission files, campaign engine or from the network when the multiplayer code is installed. I'm using a generic fixed sized TState class to record the status of each helicopter, jumping from helo to helo will transfer the state of that helicopter to you, or send it to your co-pilot, the parent Helicopter object contains information on who has authority over the helicopter.

I've fixed it so there are currently light switches and 8 MFD modes and 8 sub modes. Its easy to extend or reduce this as required. For the VCR feature I can store this state every 500 milliseconds in an external track file. Two doors and two wipers...is it really necessary to send wiper information? Possibly not, these things are always subject to change, for now it stays.

The TState Class...

Type TState


Field Landed:Int = True
Field PowerDown:Int = True
Field CurrentMode:Int = MODE_COLD
Field LastMode:Int = MODE_COLD {Hidden}
Field LastModeChangeTime:Long ' Game time mode was changed
Field CurrentPosition:TVec3
Field CurrentRotation:TVec3
Field CurrentVelocity:TVec3
Field HUDmode:Int = 0
Field NightVision:Int = 0 
Field WeaponMode:Int = 0
Field WeaponSubMode:Int = 0 
Field MFDmode:Int[MAX_MFD_SLOTS]
Field MFDsubmode:Int[MAX_MFD_SLOTS]
Field LightStatus:Int[MAX_LIGHT_SLOTS] ' Up to 8 lights can be toggled
Field Door1Open:Int = False
Field Door2Open:Int = False
Field Wipers1:Int = False
Field Wipers2:Int = False


Method New()
  Self.MFDmode = New Int[MAX_MFD_SLOTS]
  Self.MFDsubmode = New Int[MAX_MFD_SLOTS]
  Self.LightStatus = New Int[MAX_LIGHT_SLOTS]
End Method


End Type

The TVehicle class and TVehicleState class have yet to be written but will be simplified versions of the THelicopter classes as we're not interested in those to any high degree of fidelity. What matters is they move when they are ordered to move and try to keep in a reasonable formation when asked using an A* path-finding function.