Yes, you should change your MyTag code.
1) Add a private variable, other than simpleValue, to hold the position information. e.g. Vector m_simplePosition;
2) Create corresponding methods to Get/Set position similar to the SimpleVariable
3) Update Serialiaze/Deserialize methods to write/read from the TagBuffer not only the 8-bits of simpleValue but also the X,Y of your position.
4) Update GetSerializedSize method which returns the number of bytes written/read from the buffer. Now it is 1, because you only write 1 byte (8bits). Should be increased to account for all the bytes.
5) Update any other methods e.g. Print to print the values.
For (3)
void MyTag::Serialize (TagBuffer i) const
{
i.WriteU8 (m_simpleValue);
i.WriteDouble (m_simplePosition.x); // this writes the X-coordinate
i.WriteDouble (m_simplePosition.y); // this writes the Y-coordinate
}
void MyTag::Deserialize (TagBuffer i)
{
double tmp_x, tmp_y;
m_simpleValue = i.ReadU8 ();
tmp_x = i.ReadDouble(); // this reads the X-coordinate in a tmp variable
tmp_y = i.ReadDouble(); // this reads the Y-coordinate in a tmp variable
// now we need to use these tmp variables to update the m_simplePosition
m_simplePosition = Vector(tmp_x, tmp_y, 0); // I assumed that you only have x,y so z=0.
}
I do not know how many nodes you want to simulate, but the simpleValue is an 8-bit, which means only 2^8 = 256 different numbers. If you have more nodes, then you need to update it.