Author Topic: Manual edit of arena tables for offline use  (Read 1516 times)

Offline Ghosth

  • AH Training Corps (retired)
  • Plutonium Member
  • *******
  • Posts: 8497
      • http://332nd.org
Re: Manual edit of arena tables for offline use
« Reply #15 on: June 26, 2010, 09:22:10 PM »
Remember that you have evil con mission planes taking some of those slots in the past.




Offline oneway

  • Silver Member
  • ****
  • Posts: 1385
Re: Manual edit of arena tables for offline use
« Reply #16 on: June 27, 2010, 06:04:58 PM »
Remember that you have evil con mission planes taking some of those slots in the past.





What does that mean?

Offline Lusche

  • Radioactive Member
  • *******
  • Posts: 23876
      • Last.FM Profile
Re: Manual edit of arena tables for offline use
« Reply #17 on: June 27, 2010, 06:05:57 PM »
What does that mean?

The planes flown by the attendees of the AH con in the main arena:
The sharks with friggin lasers mounted on their back... Santa's Sled... the RV-8 with gatlings... and so on.
Steam: DrKalv
E:D Snailman

Offline Ghosth

  • AH Training Corps (retired)
  • Plutonium Member
  • *******
  • Posts: 8497
      • http://332nd.org
Re: Manual edit of arena tables for offline use
« Reply #18 on: June 27, 2010, 06:47:02 PM »
Exactly, each of them at one point had a slot in the plane list.

I don't know if any of those slots have been recycled, or what.
I do know that it isn't easy to try to bring one of those back up again.
Except for the Rv8.

Offline Dawger

  • Silver Member
  • ****
  • Posts: 925
Re: Manual edit of arena tables for offline use
« Reply #19 on: June 28, 2010, 10:01:13 AM »
1) Here is the list of aircraft represented by the zero based index of pln file.

I developed this list by manually disabling all aircraft for all fields in tables then turning on one plane at a time in the CM setup offline, saving the table, closing the game then reading the pln file...and YES...this took time to do...

Planes listed as UNKNOWN are deprecated aircraft that have evolved into the system as HTC developed the game over time...It is interesting to note that this list is chronological...in other words the planes in the list appear in the order they were modeled into the game going back many versions if not to the beginning of the game...

This list was done about 8 months ago and contains only 104 entries (0>103)...I haven't looked at a recent pln file. If as you say there are 110 entries, then 6 additional aircraft have been added to the game since this list was created.

To capture those aircraft simply do some manual checking and editing of the most recently added aircraft to determine their index in this new extended array...using the method described above.

2) Your second question is unclear.

The Y is for yes meaning the plane is available at that field. A N means it is not. There is a corresponding Y or N for every field for the terrain in which the present pln file is associated with. If you use notepad and do a simple find/replace on this file and set all instances of Y to N, all planes and vehicles at all fields will be disabled.

Every terrain also has .fld file. If you open the fld file you will see a zero based index of the fields for the terrain in which your editing. The first character is field ID....the second character is the original owner of the field, and the final character is the current owner of the field...

The country designators are also zero based {0,1,2} = {Bishop, Knight, Rook}. As you can see when they set country order to 3, 1, 2 it is actually being set to 2, 0, 1 (zero based)...

Here is a snippet of the fld file for northsea in its default configuration:

0,0,0
1,1,1
2,2,2
3,0,0
4,0,0
5,0,0
6,0,0
7,0,0
8,0,0
9,0,0
....
132,2,2


Here is the first line of the pln file for northsea:

0,YYYNYYNYNYYYYYYYYYYYYNYYYNYYYYYYYYNYNYYYYYYYNYYYYYYYYYNYYNYNYYYNNYYNYYYNYNNNYYNYYYYNNNYYYNNYYYYNYNYNNYYNYNYYYNYNYYNNYYNNNNNYNNNNNNYYY

This line is the P51D ...each of the Y and N characters correspond to a field of the fld file zero index 0>132 representing fields 1 through 133

Hope this helps...

Oneway



NOTE: Plane refers to any numbered plane or vehicle in the set

Here is what I understand:

 the first number is the plane followed by a comma and then one character for each field in the terrain.

N is no chess piece has the plane at that field, Y is all chess pieces have the plane at that field. 0 (Zero) is Bishops have the plane at that field. 1 is Knights have the plane at that field. 2 is Rooks have the plane at that field.

There are some missing pieces. Three pieces to be exact. What are the numbers for the following combinations ?: Bishops and Knights have the plane at the field, Bishops and Rooks have the plane at that field and Knights and Rooks have the plane at the field.


Offline oneway

  • Silver Member
  • ****
  • Posts: 1385
Re: Manual edit of arena tables for offline use
« Reply #20 on: June 28, 2010, 05:18:42 PM »
NOTE: Plane refers to any numbered plane or vehicle in the set

Here is what I understand:

 the first number is the plane followed by a comma and then one character for each field in the terrain.

N is no chess piece has the plane at that field, Y is all chess pieces have the plane at that field. 0 (Zero) is Bishops have the plane at that field. 1 is Knights have the plane at that field. 2 is Rooks have the plane at that field.

There are some missing pieces. Three pieces to be exact. What are the numbers for the following combinations ?: Bishops and Knights have the plane at the field, Bishops and Rooks have the plane at that field and Knights and Rooks have the plane at the field.


Not quite...what actually is happening from the program perspective is that their is a bitwise enumerated variable that holds a value, and the variable is more than likely defined thusly:

[FLAG ATTRIBUTE]
enum BitwiseFieldFlag
{

Undefined = 0,           //0000
Bishop = 1,               //0010
Knight = 2,               //0100
Rook = 4                  //1000

}

If you look at the following lines for the P51D for field A1 (mindan09.pln) it should become apparent rather rapidly what is going on..

When an aircraft is unrestricted by country, meaning it is either available for all, or disabled for all, the program omits the NUMERIC second character in the csv line and rightfully simply looks at Y or N for each corresponding field in the string. Of course the program reading this file is doing an "Is Numeric Function Call" check on that second character while parsing that text line...

However when an aircraft has a country restrictions, the second character is a numeric character...the program sees this and converts the text to an integer value and assigns the value to the bitwise variable. its a tad more complicated than that but suffice to say that explanation should do for now...

In the case of our example, the integer equivalent values that can be represented by our bitwise flag variable are : 0, 1, 2, 3, 4, 5, 6 and 7

Based on this it is simple to see that

0 = Undefined
1 = Only Bishop Selected
2 = Only Knight Selected
3 = Bishop + Knight Selected ( 1 + 2 )
4 = Only Rook Selected
5 = Bishop + Rook Selected ( 1 + 4 )
6 = Knight + Rook Selected ( 2 + 4 )
7 = Not Used > Falls back to Undefined

So when you set a field for Bishop and Knight, you are telling the program that the bitwise variable would go something like this:

BitWiseFieldFlag myFieldFlag = BitWiseFieldFlag.Bishop AND BitwiseFieldFlag.Knight

The program variable now equals both Bishop and Knight and the program prints a 3 as the second character of the line for that aircraft as a string representation of an integer value (actually its bitwise 0011 ...)

Oneway

EXAMPLE .PLN FILE OUT PUT ALL VARIABLE CHOICES FOR MINDAN09, P51, FIELD A1

P51D Field A1 (index 0) mindan09

Disabled for all countries:

0,NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops (country 1, index 0):

0,1NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Knights (country 2, index 1):

0,2NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Rooks (country 3, index 2):

0,4NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops & Knights:

0,3NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Knights & Rooks:

0,6NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops and Rooks

0,5NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for All Countries:

0,YNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Offline oneway

  • Silver Member
  • ****
  • Posts: 1385
Re: Manual edit of arena tables for offline use
« Reply #21 on: June 28, 2010, 05:27:08 PM »
Exactly, each of them at one point had a slot in the plane list.

I don't know if any of those slots have been recycled, or what.
I do know that it isn't easy to try to bring one of those back up again.
Except for the Rv8.


The deprecated plane slots cannot be edited in game, but they can be turned on via the PLN file.

However nothing happens in the game...

The program has been written to ignore the return result or product when cycling the array through the loop...

My experience is the program doesn't break when you do it, but I strongly recommend against it...

The RV8 has its own dedicated slot like all of the other active aircraft....index 88...and there is a simple bool flag switch set via the command line .showrv. There does not appear to be a reciprocal command .hiderv...so once the flag has been set you are stuck with it unless you do a reset..

Incidentally...it would be my guess that instead of an array of aircraft, we simply have a rather large enumerated variable type. This might explain why the slots are abandoned.

I am sure the plane variables are referenced thousands of time in the code...by using an enumerated variable instead of an array index...the code won't break when changes are made to the definition of the enumerated type...
« Last Edit: June 28, 2010, 06:23:41 PM by oneway »

Offline Dawger

  • Silver Member
  • ****
  • Posts: 925
Re: Manual edit of arena tables for offline use
« Reply #22 on: June 28, 2010, 08:30:20 PM »
Not quite...what actually is happening from the program perspective is that their is a bitwise enumerated variable that holds a value, and the variable is more than likely defined thusly:

[FLAG ATTRIBUTE]
enum BitwiseFieldFlag
{

Undefined = 0,           //0000
Bishop = 1,               //0010
Knight = 2,               //0100
Rook = 4                  //1000

}

If you look at the following lines for the P51D for field A1 (mindan09.pln) it should become apparent rather rapidly what is going on..

When an aircraft is unrestricted by country, meaning it is either available for all, or disabled for all, the program omits the NUMERIC second character in the csv line and rightfully simply looks at Y or N for each corresponding field in the string. Of course the program reading this file is doing an "Is Numeric Function Call" check on that second character while parsing that text line...

However when an aircraft has a country restrictions, the second character is a numeric character...the program sees this and converts the text to an integer value and assigns the value to the bitwise variable. its a tad more complicated than that but suffice to say that explanation should do for now...

In the case of our example, the integer equivalent values that can be represented by our bitwise flag variable are : 0, 1, 2, 3, 4, 5, 6 and 7

Based on this it is simple to see that

0 = Undefined
1 = Only Bishop Selected
2 = Only Knight Selected
3 = Bishop + Knight Selected ( 1 + 2 )
4 = Only Rook Selected
5 = Bishop + Rook Selected ( 1 + 4 )
6 = Knight + Rook Selected ( 2 + 4 )
7 = Not Used > Falls back to Undefined

So when you set a field for Bishop and Knight, you are telling the program that the bitwise variable would go something like this:

BitWiseFieldFlag myFieldFlag = BitWiseFieldFlag.Bishop AND BitwiseFieldFlag.Knight

The program variable now equals both Bishop and Knight and the program prints a 3 as the second character of the line for that aircraft as a string representation of an integer value (actually its bitwise 0011 ...)

Oneway

EXAMPLE .PLN FILE OUT PUT ALL VARIABLE CHOICES FOR MINDAN09, P51, FIELD A1

P51D Field A1 (index 0) mindan09

Disabled for all countries:

0,NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops (country 1, index 0):

0,1NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Knights (country 2, index 1):

0,2NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Rooks (country 3, index 2):

0,4NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops & Knights:

0,3NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Knights & Rooks:

0,6NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for Bishops and Rooks

0,5NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Enabled for All Countries:

0,YNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

That makes a lot more sense now.

Offline oneway

  • Silver Member
  • ****
  • Posts: 1385
Re: Manual edit of arena tables for offline use
« Reply #23 on: June 28, 2010, 08:33:18 PM »
 :aok

Offline oneway

  • Silver Member
  • ****
  • Posts: 1385
Re: Manual edit of arena tables for offline use
« Reply #24 on: June 28, 2010, 08:57:14 PM »
Whoops...

Your response a post up got me thinking...and unfortunately my suspicions were confirmed...

This following line of PLN file represents the enabling of the P51D at the first four fields for Bishop Only...

0,1111NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

What we have here is this:

If condition 0 or 7 are detected...the program simply prints N(=0) or Y(=7)...otherwise it prints the bitwise numeric value..as a string (1,2,3,4,5,6)...depending on which country flags are set for that field and that plane...

In other words...the program is forced to parse the file on a slot by slot basis for each field based on the content of the PLN file...EACH time it starts...

Not optimal by any stretch of the imagination...and as a result adds to the load up time of the game as it parses the file..

But for your understanding and the intended purpose of my response to your post...this is now complete and fully fleshes out the performance and results of the PLN file...

The numeric value is unique and exclusive to each field...as is the Y or N...each field pigeon hole could contain a 1, 2, 4, 3, 5 or 6....as well as the fallback Y and N,,,,that is the flag and that is the designator...for the full spectrum of fields...for each terrain...and for each setting....

Its not only possible but probable that a PLN file for line 1 (P51) might look like this:

0,1NN264NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

And in this case field 1 is enabled for Bish, field 2 and 3 are disabled for all, field 4 is enabled for Knight, field 5 is enabled for Knight and Rook, field 6 is enabled for Rook...all else disabled...

I mistakenly assumed they set the second character in the line as a flag...not the case at all...

Sorry for any confusion but the above premise on the bitwise flags is valid and apples

Out


 :salute

Oneway

Edit: thanks for the question originally posted...I learned a bit more about how the game works and functions.... :aok
« Last Edit: June 28, 2010, 09:24:07 PM by oneway »