PDA

View Full Version : AirGroup Selection Problem



No.401_Wolverine
Apr-16-2014, 03:36
Having an absolute devil of a time with this...:

I'm trying to get this RDF system to work for both sides and I have EVERYTHING WORKING except for one small thing that I can't figure out!

Take a look at this line of code:

Dictionary<AiAirGroup, int> planePulks = getPulks(GamePlay.gpAirGroups((player.Army() != 1) ? 1 : 2), 1600.0);

See that part where it says "(player.Army() != 1) ? 1 : 2"

?

Well, for some reason, this ONLY works for RED. You see, what it should do is, if the player's on the RED side, it will select AirGroups that are BLUE to populate the RADAR report. So read out loud, that line basically is saying:

If the player's army is ANYTHING OTHER THAN RED, return an integer of 1 for this GamePlay.gpAirGroups selection (ie, select RED aircraft for the RDF), but if the player's army IS RED, then go with 2 for the selection (ie, select BLUE aircraft for the FREYA system).

But here's the thing. It only works for RED. Jump in as BLUE, and the Radar system just reports no contacts all the time except in one very strange circumstance which is as follows:

If I spawn into a RED aircraft and then immediately switch to the BLUE side, until the despawn script kicks in and destroys the RED aircraft I just vacated, I can use the radar script without issue. It will report the enemy RED contacts! As soon as the despawn script kicks in and destroys the aircraft I left behind on the RED side, the radar script no longer will report RED contacts. Just a big fat nuthin'. This happens if I spawn in as BLUE first then go RED and back to BLUE, or as RED first and go over to BLUE. It's easily repeatable. It's like the game needs me to be RED or recently have been RED in order to allow the function to work. But there's nothing else in the script that I can find that would account for this behaviour. This is literally the only part of the script that defines which air groups are selected for the radar report. I've been beating my brains out on this. No errors when compiled in Visual C# 2010 Express either.

If you'd like to see the rest of the script to troubleshoot it, let me know and I can email it to you (the full script is pretty big now).

This is the LAST piece of the puzzle before a working FREYA system for BLUE that I will happily donate to the upcoming ATAG campaign.

SoW Reddog
Apr-16-2014, 05:54
Wolverine,

Perverse I know, but have you tried de-negativing it. to see what happens?



Dictionary<AiAirGroup, int> planePulks = getPulks(GamePlay.gpAirGroups((player.Army() == 1) ? 2 : 1), 1600.0);


What happens if you remove the 2 totally, say substitute it for 1:1. Do both sides now report Red?

Lastly, could you not do



if(player.Army()==1) {
Dictionary<AiAirGroup, int> planePulks = getPulks(GamePlay.gpAirGroups(2, 1600.0);
}
else
{
Dictionary<AiAirGroup, int> planePulks = getPulks(GamePlay.gpAirGroups(1, 1600.0);
}


Might throw an exception to being declared twice, but sure you could work around it.

Just off the top of my head.

9./JG52 Hans Gruber
Apr-16-2014, 09:07
Wolverine, I'm very happy to see you working on this. Does this problem not sound very similar to the issue I reported to you some time ago where Chain Home would only report a contact if there was more than one group? I don't know your testing criteria but I assume you have a red AI flight buzzing around that you want detected. Radar does not see it until you spawned another red a/c and now the AI flight is seen.

No.401_Wolverine
Apr-16-2014, 10:35
Reddog:

Yes, I've tried the first method you mention. That is in fact the default, original setup. There's no real difference between those two methods, though. Or shouldn't be.

Also, an if/else statement is pretty much identical to the ?: operator. I haven't tried splitting it out like that yet, though, so perhaps the gods know more than me and it will work where the other doesn't. I'll give it a go tonight. As you can see from the time of my post, I was up until 4:00 am wrestling with this incredibly annoying thing.

I tried just setting the call up as a static INT value. RED was working and picking up red or blue aircraft. Blue was not...unless I'd abandoned the Spitfire on the other team and it hadn't despawned.

Gruber:

Yes, plenty of aircraft around. Multiple blues, multiple reds. The thing is that the RED side's radar functions perfectly. Always picks up the contacts its supposed to, no matter what you've done switching sides, etc. But the BLUE side is as described. It's very odd. I'm not saying that the issue you're referring back to is unrelated, but the way it's showing up is inconsistent. I'll check again tonight since I wasn't actively investigating this aspect. I'll throw a high flying blenny in somewhere into the default mission to make sure there's at least one other red AI aircraft buzzing about. If this is the problem, then I'll try and resolve it by reviewing the GetPulks function as defined in the script.

Like I said, this is the last piece of the puzzle. I have separate customized menu systems for Red and Blue now. I've added conversions so that the reports for RED are imperial and the BLUE are metric. Blue also gets the weather conditions report if they want it. I've set up the radar towers for blue. I've programmed the sectors. Everything is there. And when it works (with the aforementioned bizarre requirement for it to work) it works great. "5+ INDIANER IN SECTOR BB,23, 21 KILOMETERS NORTHEAST FROM CAP GRIS NEZ AT 3,000 METERS!"

It just doesn't want to play.

Disclaimer: I'm simply editing Kodiak's wonderful script here, trying to manipulate it to my own nefarious causes. It's too bad he's not about to respond :(

9./JG52 Hans Gruber
Apr-16-2014, 11:06
A few troubleshooting questions:

Does it work if you removed or commented out all the Chain Home pieces?

Does it work with a human player on each team?

No.401_Wolverine
Apr-16-2014, 11:12
1. You can't do that with the way it's set up. I've optimized the code as best I can to avoid redundancy. The fact that it 'works' when it works shows that it's set up correctly in that regard. Commenting out the CH RDF stuff would also disable the FREYA code. It's all the same code. It basically works by restricting the towers you can connect to. RED players only have access to RDF stations and BLUE players only have access to FREYA ones. I've added code to each Observer Station that identifies it as either RED or BLUE. The code then, when you select towers, only populates your menus with towers that are 'on your frequency' so to speak.

2. Squiz and I were testing it last night to see if that was the case, but no. With me flying around and him using the FREYA, he couldn't pick me up.

Like I said, I'll try the extra RED Ai aircraft tonight to make sure that's not the issue. I have randomized ai red flights that are supposed to spawn, thus making it so that there would have been multiple flights, but it's possible they didn't spawn due to the randomization (though I tested it enough times that this should have made itself apparent). Anyway, I'll be able to see about it tonight and I'll let you know.

No.401_Wolverine
Apr-16-2014, 18:07
Gruber:

Hit the nail on the head with it. It's the 'more than one airgroup' bug. I'll dive into that one in depth, but for now it works as long as there are two enemy air groups in play (and that could just be two players, with one of them sitting on the deck).

FREYA system functional.

Thanks for the help.

SoW Reddog
Apr-17-2014, 04:15
Be interested to see how/why this occurs then, because I've not come across it. However I have pretty bastardised the code now so I'm not what was original and what's mine now.

No601_Swallow
Apr-17-2014, 08:10
Heroic stuff, Wolverine!

No.401_Wolverine
Apr-17-2014, 09:54
Be interested to see how/why this occurs then, because I've not come across it. However I have pretty bastardised the code now so I'm not what was original and what's mine now.

Unless you've made changes to the 'GetPulks' section of the radar you used, then the issue is there. Like with my situation, you don't realize it's there unless you're attempting to test / use the radar in a situation with only the one enemy airgroup on the map. In a multiplayer environment, unless there is only one player and no ai or one ai group and no players, you won't see the issue.

Side note, I've completed my 'mapping' of the channel map for FREYA coverage and I'll be implimenting the system soon on the 401 server. The FREYA system will be slightly different to the RDF one. The 'shape' of the wotan detection will be different to the RDF one, so destroying them will impact the system in different ways. RDF, being the more mature system, will have more redundancies to cover lost sectors.

I'm still researching in land coverage to represent tracking targets over land. I don't know much about the Luftwaffe's organization at this level. Was the Observer Corps of the British side more 'advanced' in its coverage and reporting? Maybe I'll make a post to request info.

Come to think of it, I believe I could fairly easily add an option to the RADAR menus that would allow you to 'request location of friendlies' and it would tell you where other aircraft from your side are, in the same manner as the enemy reports. Would that be something people want?

SoW Reddog
Apr-17-2014, 10:48
Ah, airgroups.Length>1 I'm guessing?

No.401_Wolverine
Apr-17-2014, 10:55
Ah, airgroups.Length>1 I'm guessing?

Quite likely the issue. Is that from the script (I'm at work so can't check). If so, there may be a valid reason he did it that way to avoid another issue. Lesser of two evils kind of solution. If so, nothing for it but to modify to >= and see what happens. If BAD then revert, ELSE keep. :P