PDA

View Full Version : What class are Players flying anyway?


moggel
06-21-2012, 08:58 AM
Scripters,

I'm writing a solution that's simulating Fighter Command to some extent (Chain Home, Observer Corps, Filter Rooms and Command). In doing so I'm also trying to implement the concept of Flight Leaders but I'm currently stuck.

I mistakingly believed all Players fly AiAicrafts and that all aicrafts are in AiGroups. This it seems is only true for non-player aicrafts (hence the "Ai" part I guess :rolleyes:) and for players running in single player mode.

My implementation fell apart when I tried it out on a dedicated server last night but Osprey hinted that I should probably look at the "Regiment" property instead as a basis for grouping online players together.

If so, can someone help me get my head around what a "Regiment" is and how it's handled by the sim in the online (and offline) context?

My initial experiment got stuck on the fact that "Regiment" is a property of AiAicraft and when I safe cast the player's AiActor to an AiAircraft i get a null result, which means whatever a Player is riding is not a AiAicraft type.

I tried to find out what type is implementing AiActor for a online Players by simply fetching its type name but the resulting string is just a sequence of seemingly random letters. This is likely a remoting marshaling thingy but I still have no idea what I'm dealing with.

Example:

public override void OnPlaceEnter(AMission mission, Player player, AiActor actor, int placeIndex)
{
var playerAircraft = actor as AiAicraft; // <-- 'playerAircraft' is null
var typeOfPlayerActor = actor.GetType().Name; // <-- type name is gibberish
}


Can someone please shed some light on:


How is "Regiment" being used by the sim?
What type is implementing AiActor for online Players?


Thanks,
Mog

FG28_Kodiak
06-21-2012, 10:33 AM
Online Player also use AiAircrafts.
You get the Aircraft (actor) via Player.Place().
The problem is if you use spawnplaces and a player creates a Aircraft, he also creates a new Airgroup. So he is always the leader of his own Airgroup.

Btw. getType comes from object http://msdn.microsoft.com/en-us/library/system.object.gettype.aspx

moggel
06-21-2012, 10:36 AM
Online Player also use AiAircrafts.
You get the Aircraft (actor) via Player.Place().
The problem is if you use spawnplaces and a player creates a Aircraft, he also creates a new Airgroup. So he is always the leader of his own Airgroup.

So, I assume an online player is always alone in his group then?
Is so, is the concept of a group supported for online play at all? Does the sim recognize I'm in a squad for example? That's what I assumed "Regiment" is for but I have no clue as to how it's supposed to be used.

FG28_Kodiak
06-21-2012, 11:09 AM
A Player can create also a group of planes (if Number of planes is larger than 1 in the spawnplace options) and if an other player select a plane of this created group he is part of this group, but at the moment its more a GUI problem (WPF Not available for example) so an other player cannot select the plane easily. If Icons on you can zoom maximum in and select the Icon, if Icons out you don't see the icon but if you move the cursor you get a focus on a plane you can select it. (Maddox should do some rework on the Multiplayer GUI.)


The regiment is usefull if you like to have more Information from the Airgroup you flying for.
Example:
You select II./StG 3 as Group
(actor as AiAircraft).Regiment().gruppeNumber() gives you 2 as Gruppenummer (II.)
(actor as AiAircraft).Regiment().id() gives you S7 the id of II./StG 3 was "S7"
(actor as AiAircraft).Regiment().name() gives BoB_LW_StG3_II

The only usefull Informations are gruppeNumber() and id() all others you can get from Airgroup also or by parsing the Airgroup name.

The only way to get such a thing like a Airgroup from single created planes is over the AirgroupName i think. The first created Plane has the lowest missionNumber, all others have highers,

Osprey
06-21-2012, 11:26 AM
Just as an option there is also the 'Callsign' property (don't know what Maddox call it in code though) and in the RAF this is the codename on the radio for the Squadron (Regiment). ie. It may be possible/easier to group squadrons by the selected callsign instead.

FG28_Kodiak
06-21-2012, 11:37 AM
You can store the planes in a List and create your own Airgroup

moggel
06-21-2012, 12:11 PM
A Player can create also a group of planes (if Number of planes is larger than 1 in the spawnplace options) and if an other player select a plane of this created group he is part of this group, but at the moment its more a GUI problem (WPF Not available for example) so an other player cannot select the plane easily. If Icons on you can zoom maximum in and select the Icon, if Icons out you don't see the icon but if you move the cursor you get a focus on a plane you can select it. (Maddox should do some rework on the Multiplayer GUI.)


The regiment is usefull if you like to have more Information from the Airgroup you flying for.
Example:
You select II./StG 3 as Group
(actor as AiAircraft).Regiment().gruppeNumber() gives you 2 as Gruppenummer (II.)
(actor as AiAircraft).Regiment().id() gives you S7 the id of II./StG 3 was "S7"
(actor as AiAircraft).Regiment().name() gives BoB_LW_StG3_II

The only usefull Informations are gruppeNumber() and id() all others you can get from Airgroup also or by parsing the Airgroup name.

The only way to get such a thing like a Airgroup from single created planes is over the AirgroupName i think. The first created Plane has the lowest missionNumber, all others have highers,

Hm. It sound like there's no reliable support for "groups" in MP then? In ACG we're prefixing our game names with the squadron name according to a fixed format. Parsing that is probably my best bet at the moment it seems...

Thanks Kodiak, you're a champ!

Osprey
06-21-2012, 05:12 PM
Surely the Regiment.Name() is unique? If so is it not possible to group by this? Internally it does not matter what the string is, only that groups are not confused?

What about the callsign which the pilot has selected?

moggel
06-21-2012, 09:23 PM
Surely the Regiment.Name() is unique? If so is it not possible to group by this? Internally it does not matter what the string is, only that groups are not confused?

What about the callsign which the pilot has selected?

From the little experiments I've conducted on a local dedicated server those properties doesn't seem very unique at all but I think we should try it out over at the ACG server in a more structured way. Let's meet up and spawn in at various points while I examine the logs produced. Maybe we'll see a pattern then?

Osprey
06-22-2012, 06:46 AM
Well whatever is easiest, I was just curious that's all. :)

moggel
06-22-2012, 09:50 AM
Curiosity is the mother of invention my friend... :)

Some more testing has revealed that the regiment is linked to how the spawnpoints (called "birth place" internally) are configured. If I set up a spawnpoint and assign it to the "Fat Cat Squadron" the "Regiment.name()" becomes "BoB_RAF_F_FatCat_Early" but if I spawn in from a spawn point I've configured for the "64th Sqn" the Regiment name is "BoB_RAF_F_64Sqn_Early". Then, if I don't configure the spawn point for a squadron (leave it at "<Any>") the Regiment name is set to "BoB_RAF_F_FatCat_Early". Seems the "Fat Cats" squadron is the default in this sim.

All this tells me that spawnpoints make up groups, not what squadron we belong to. Now, I know very little on how to build missions so please step in and tell me if there is a way to configure them in other ways. For example, I have no idea how to use the last tab - "Aircrafts" - in the spawnpoint property window.

In all my testing the callsign was always "Callsign0" but we'll see how all this looks when more players spawn in.

A related question for Kodiak (or anyone who cares to enlighten us): When I selected to create 3 airplanes the other two became AI's. I assume this is how to create groups, right? But how can players spawn in to that group if the server spawns AI's into those slots?

FG28_Kodiak
06-22-2012, 10:07 AM
For example, I have no idea how to use the last tab - "Aircrafts" - in the spawnpoint property window.

On the left side are the planes available at this spawnpoint, so i first delete all and then add the planes i want at this point.


A related question for Kodiak (or anyone who cares to enlighten us): When I selected to create 3 airplanes the other two became AI's. I assume this is how to create groups, right?
Yes ;)

But how can players spawn in to that group if the server spawns AI's into those slots?
As i mentioned earlier its more a GUI problem. If Icons on you can zoom in and then select one of the created planes. If Icons off you can zoom in and if you move your cursor you will see that it sometimes highlighted, so you are over one of the created planes and you can select it :rolleyes: You could use the List on the right side, if this wpf unavailable bug is fixed and the devs maybe create a filter, so not all planes are listed. If external views are allowed you can select one of the planes and then press ALT+F1.

Osprey
06-25-2012, 03:43 PM
Some more testing has revealed that the regiment is linked to how the spawnpoints (called "birth place" internally) are configured. If I set up a spawnpoint and assign it to the "Fat Cat Squadron" the "Regiment.name()" becomes "BoB_RAF_F_FatCat_Early" but if I spawn in from a spawn point I've configured for the "64th Sqn" the Regiment name is "BoB_RAF_F_64Sqn_Early". Then, if I don't configure the spawn point for a squadron (leave it at "<Any>") the Regiment name is set to "BoB_RAF_F_FatCat_Early". Seems the "Fat Cats" squadron is the default in this sim.

All this tells me that spawnpoints make up groups, not what squadron we belong to.

Interesting. What happens if you have a spawn set to 'Any' and you select 64sqn and spawn in, does it then still group you in "BoB_RAF_F_FatCat_Early"?? If so it's a bug, if not you have a way of grouping by regiment.name (if you choose that method)

FG28_Kodiak
06-25-2012, 06:12 PM
I've tried it by myself -> no problem i select 64Sqn early and get this, so moggel seems to make a mistake ;)

GamePlay.gpLogServer(null, "GroupName: {0}", new object[]{(actor as AiAircraft).AirGroup().Name()});
gives
GroupName: 1:BoB_RAF_F_64Sqn_Early.01

GamePlay.gpLogServer(null, "RegimentName: {0}", new object[] { (actor as AiAircraft).Regiment().name()});

gives
RegimentName: BoB_RAF_F_64Sqn_Early

moggel
06-27-2012, 09:45 AM
I've tried it by myself -> no problem i select 64Sqn early and get this, so moggel seems to make a mistake ;)

GamePlay.gpLogServer(null, "GroupName: {0}", new object[]{(actor as AiAircraft).AirGroup().Name()});
gives
GroupName: 1:BoB_RAF_F_64Sqn_Early.01

GamePlay.gpLogServer(null, "RegimentName: {0}", new object[] { (actor as AiAircraft).Regiment().name()});

gives
RegimentName: BoB_RAF_F_64Sqn_Early

Hehe, well...
I was a bit unclear it seems. What I tried to explain to Osprey (who is my "project manager" and "customer" for the "Fighter Command" project ;) ) is that the spawn point governs the "Regiment". If you configure the spawn point to a certain squadron that's what the regiment will be. If you don't configure it (leave it at "<Any>") you can select a "Regiment" yourself.

This whole discussion came from a desire to have the actual virtual squadron reflected by the "Regiment" property but that, as far as I've seen, cannot be done. Could you confirm I've got this right Kodiak or am I still far out there in the fog? :rolleyes:

FG28_Kodiak
06-27-2012, 10:03 AM
Yes i confirm this. ;).