public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(1, id_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getNameBytes());
      }
      for (int i = 0; i < units_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(3, units_.get(i));
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeEnumSize(4, race_.getNumber());
      }
      for (int i = 0; i < stances_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(5, stances_.get(i));
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(6, neutral_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(7, startLocation_);
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(8, leftGame_);
      }
      if (((bitField0_ & 0x00000040) == 0x00000040)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(9, minerals_);
      }
      if (((bitField0_ & 0x00000080) == 0x00000080)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(10, gas_);
      }
      if (((bitField0_ & 0x00000100) == 0x00000100)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(11, cumulativeMinerals_);
      }
      if (((bitField0_ & 0x00000200) == 0x00000200)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(12, cumulativeGas_);
      }
      if (((bitField0_ & 0x00000400) == 0x00000400)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(13, supplyTotal_);
      }
      if (((bitField0_ & 0x00000800) == 0x00000800)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(14, supplyUsed_);
      }
      for (int i = 0; i < allUnitCount_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(15, allUnitCount_.get(i));
      }
      for (int i = 0; i < completedUnitCount_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(16, completedUnitCount_.get(i));
      }
      for (int i = 0; i < incompleteUnitCount_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(17, incompleteUnitCount_.get(i));
      }
      for (int i = 0; i < deadUnitCount_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(18, deadUnitCount_.get(i));
      }
      for (int i = 0; i < killedUnitCount_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(19, killedUnitCount_.get(i));
      }
      for (int i = 0; i < upgradeLevels_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(20, upgradeLevels_.get(i));
      }
      for (int i = 0; i < researchedTechs_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(21, researchedTechs_.get(i));
      }
      for (int i = 0; i < researching_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(22, researching_.get(i));
      }
      for (int i = 0; i < upgrading_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(23, upgrading_.get(i));
      }
      if (((bitField0_ & 0x00001000) == 0x00001000)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(24, self_);
      }
      if (((bitField0_ & 0x00002000) == 0x00002000)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(25, victorious_);
      }
      if (((bitField0_ & 0x00004000) == 0x00004000)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(26, defeated_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }