Monday, May 20, 2013
pretty much done
Now I am pretty much done with the multiplayer final project. I can focus on the game engine then.
Friday, May 17, 2013
serialization with BinaryFormatter
This is very crazy. I thought BinaryFormatter.serialize will do the magic and makes my life easier. Apparently, it is the opposite. The binary formatter does something crazy and I can't predict when it goes crazy. The result is the transfer data is veryy incredibly slowww.. From my experience, you can do serialize object using binaryformatter only for general type like int, byte, float, String, etc (Im not sure about enum)
Now here is the example:
// [Serializable] // I could put here too the result still the same
struct DataPos
{
float posX;
float posY;
float rot;
};
[Serializable]
struct ShipData
{
// this is just enumeration for type
eType type;
// here I was trying only data position
DataPos datapos;
}
The binaryformatter DOES NOT WORK WELL on this structure. I tried to put padding too in the enumeration and same thing. It doesn't say it is illegal. It just slows the transfer data. It takes 3 days to debug this shit.
Here after I change the data into this structure
[Serializable]
struct ShipData
{
// this is just enumeration for type
eType type;
everything goes well. This is really stupidd.. The BinaryFormatter should tell he can't serialize that if he can't. Not just by keep silent and let the programmer debug himself.
Now here is the example:
// [Serializable] // I could put here too the result still the same
struct DataPos
{
float posX;
float posY;
float rot;
};
[Serializable]
struct ShipData
{
// this is just enumeration for type
eType type;
// here I was trying only data position
DataPos datapos;
}
The binaryformatter DOES NOT WORK WELL on this structure. I tried to put padding too in the enumeration and same thing. It doesn't say it is illegal. It just slows the transfer data. It takes 3 days to debug this shit.
Here after I change the data into this structure
[Serializable]
struct ShipData
{
// this is just enumeration for type
eType type;
// not using the struct
float posX;
float posY;
float rot;
}everything goes well. This is really stupidd.. The BinaryFormatter should tell he can't serialize that if he can't. Not just by keep silent and let the programmer debug himself.
Determine which one is client or server
This is the hardest part: determining which one should run in the client or in the server. In theory, the server should do everything in the update section. But in practice, I think that updating the particle can be just done in the client because I don't want the server calculating the large particle and slow him self. This makes my code getting messier because I put every update in the server first and realized it was very slow. I need to refactor a lot of code. However whenever there is something special in that particular particle, server just need to tell to the client. But in this assignment, there is problem about that.
Sunday, May 12, 2013
C# is very easy
I thought it would take a while to learn C#. Apparently, it was very easy migrate from C++ to C#.
bad code from previous programmer
I don't it is whether bad code from previous programmer or C# allows us to put "new" everywhere. There is a code in everyloop calls Player.PlayerInput myInput = new Player.PlayerInput(); without calling delete. I don't know how to call delete anywhere though. I don't like that code.
Saturday, May 4, 2013
messy code
I believe this time my code is really messy.. I just want the networking works. I modified something that doesn't work when I combine everything. But I think its okay because I just want to focus on the networking
network state management
I like this example. I guess I will start from here and put the omega race project into this example.
Friday, May 3, 2013
real network programming
I guess the real programming starts from now. Basically I need to learn the example code. There are 6 examples. I guess I have to understand the whole thing then I can move on to the space war.
Subscribe to:
Posts (Atom)