[PROGRAM] OpenYS - Open Source YSFlight Server!
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
The good news is with the restructure comes more powerful ways of managing clients which should speed up production as well.
Next steps are getting the clients working again (won't be too long I'm sure).
Than moving away from dummy flightdata/entity joined packets to create on demand and a full fledged vehicle class.
Almost where I wanted OYS to be now. It's been a tough month.
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
Now I need to make the vehicle core more compatible (won't take much), and update the packet handlers to reflect that change. Once done, I'll release an interim OYS update just to test all is well, then it'll be back to regular updates.
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
New Structure:
Better?
- Neocon
- First Class Membership
- Posts: 3955
- Joined: Wed Oct 19, 2011 5:01 am
- Favorite Aircraft: Baron 58
- Location: Tennessee
- OS: Win 10
- Has thanked: 1770 times
- Been thanked: 1810 times
- Contact:
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
Code: Select all
#region Get The Size
ReceivedData = 0;
InputReceived = 0;
InputBuffer = new byte[4];
while (ReceivedData < 4 && Socket.Connected)
{
InputReceived = Socket.Receive(InputBuffer, (4 - ReceivedData), 0);
InputBuffer = InputBuffer.Take(InputReceived).ToArray();
System.Buffer.BlockCopy(InputBuffer, 0, SizeBuffer, ReceivedData, InputReceived);
ReceivedData += InputReceived;
InputBuffer = new byte[4 - ReceivedData];
if (InputReceived == 0)
{
//Console.WriteLine(ConsoleColor.Yellow, "DC SIZE 0");
Parent.Parent.Disconnect();
return null;
}
#region Broken Packet!
#if DEBUG
if (ReceivedData < 4)
{
Console.Write(String.Format("\rSize\tReceived: {0}\t Expected {1}\t (Not Enough Data Received.)", ReceivedData, SizeBuffer.Length));
error++;
}
#endif
#endregion
}
if (!(Socket.Connected)) { return null; }
#region Broken Packet!
#if DEBUG
if (error > 0) Console.WriteLine(String.Format("\rSize\tReceived: {0}\t Expected {1}\t", ReceivedData, SizeBuffer.Length));
#endif
#endregion
DataLength = BitConverter.ToUInt32(SizeBuffer, 0);
if (DataLength == 0) return null;
if (DataLength > 8192) return null;
#endregion
#region Get The Type
ReceivedData = 0;
InputReceived = 0;
InputBuffer = new byte[4];
while (ReceivedData < 4 && Socket.Connected)
{
InputReceived = Socket.Receive(InputBuffer, (4 - ReceivedData), 0);
InputBuffer = InputBuffer.Take(InputReceived).ToArray();
System.Buffer.BlockCopy(InputBuffer, 0, TypeBuffer, ReceivedData, InputReceived);
ReceivedData += InputReceived;
InputBuffer = new byte[4 - ReceivedData];
if (InputReceived == 0)
{
//Console.WriteLine(ConsoleColor.Yellow, "DC TYPE 0");
Parent.Parent.Disconnect();
return null;
}
#region Broken Packet!
#if DEBUG
if (ReceivedData < 4)
{
Console.Write(String.Format("\rType\tReceived: {0}\t Expected {1}\t (Not Enough Data Received.)", ReceivedData, TypeBuffer.Length));
error++;
}
#endif
#endregion
}
if (!(Socket.Connected)) { return null; }
#region Broken Packet!
#if DEBUG
if (error > 0) Console.WriteLine(String.Format("\rType\tReceived: {0}\t Expected {1}\t", ReceivedData, TypeBuffer.Length));
#endif
#endregion
DataType = BitConverter.ToUInt32(TypeBuffer, 0);
if (DataType == 0) return null;
if (DataType >= 128) return null;
#endregion
#region Get The Body
BodyBuffer = new byte[DataLength - 4];
ReceivedData = 0;
InputReceived = 0;
InputBuffer = new byte[DataLength - 4];
while (ReceivedData < (DataLength - 4) && Socket.Connected)
{
InputReceived = Socket.Receive(InputBuffer, ((int)(DataLength - 4) - ReceivedData), 0);
InputBuffer = InputBuffer.Take(InputReceived).ToArray();
System.Buffer.BlockCopy(InputBuffer, 0, BodyBuffer, ReceivedData, InputReceived);
InputBuffer = new byte[DataLength - 4 - ReceivedData];
ReceivedData += InputReceived;
if (InputReceived == 0)
{
//Console.WriteLine(ConsoleColor.Yellow, "DC DATA 0");
Parent.Parent.Disconnect();
return null;
}
#region Broken Packet!
#if DEBUG
if (ReceivedData < (DataLength - 4))
{
Console.Write(String.Format("\rData\tReceived: {0}\t Expected {1}\t (Not Enough Data Received.)", ReceivedData, BodyBuffer.Length));
error++;
}
#endif
#endregion
}
if (!(Socket.Connected)) { return null; }
#region Broken Packet!
#if DEBUG
if (error > 0) Console.WriteLine(String.Format("\rData\tReceived: {0}\t Expected {1}\t", ReceivedData, BodyBuffer.Length));
#endif
#endregion
DataBody = BodyBuffer;
#endregion
#region Broken Packet Verification!
#if DEBUG
if (error > 0) Console.WriteLine(String.Format("Size: {0}, Type: {1}, DataLength: {2}", DataLength, DataType, DataBody.Length));
#endif
#endregion
#region Make and return a new packet
#region Data Integrity Checks
Packets.GenericPacket outpacket = new Packets.GenericPacket(SizeBuffer.Concat(TypeBuffer).Concat(BodyBuffer).ToArray());
//Validate Packet Size.
bool DoDataRedundancyChecks = false; //<< Change this to TRUE if you want the program to do data redunancy checks! (Not required any more...)
if (DoDataRedundancyChecks)
{
if (outpacket.Size != DataLength)
{
#if DEBUG
Console.WriteLine(String.Format("The Packet Size is incorrect! Received:{0}/Calculated:{1}", DataLength, outpacket.Size));
#endif
return null;
}
if (outpacket.Type != DataType)
{
#if DEBUG
Console.WriteLine(String.Format("The Packet Type is incorrect! Received:{0}/Calculated:{1}", DataType, outpacket.Type));
#endif
return null;
}
if (outpacket.Type <= 0 || outpacket.Type > 128)
{
#if DEBUG
Console.WriteLine(String.Format("The Packet Type is out of range! Received:{0}/Calculated:{1}", DataType, outpacket.Type));
#endif
return null;
}
else if (outpacket.Data.Length != DataBody.Length)
{
#if DEBUG
Console.WriteLine(String.Format("The Packet Data is incorrect! Received:{0}/Calculated:{1}", DataType, outpacket.Type));
#endif
return null;
}
}
#endregion
return outpacket;
#endregion
Code: Select all
byte[] Size = new byte[4];
Socket.Receive(Size, 4, SocketFlags.None);
byte[] Data = new byte[BitConverter.ToUInt32(Size, 0)];
Socket.Receive(Data, (int)BitConverter.ToUInt32(Size, 0), SocketFlags.None);
return new Packets.GenericPacket(Size.Concat(Data).ToArray());
- Neocon
- First Class Membership
- Posts: 3955
- Joined: Wed Oct 19, 2011 5:01 am
- Favorite Aircraft: Baron 58
- Location: Tennessee
- OS: Win 10
- Has thanked: 1770 times
- Been thanked: 1810 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
I'm guessing that ought to cut down on file size by a good amount.
- decaff_42
- Staff
- Posts: 3838
- Joined: Sat Oct 29, 2011 7:23 pm
- Favorite Aircraft: SR-71 Blackbird
- Location: Eastern United States
- OS: Mac OSX
- Has thanked: 844 times
- Been thanked: 1727 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
You are a coding wizard if this is the case!OfficerFlake wrote: I haven't tested ...
... but I do believe that will be perfectly stable.
Visit my GitHub page for Python codes: https://github.com/decaff42?tab=repositories
YSFlight Addon Database - Find links to nearly every addon made for YSFlight!
Submit Addon To Database
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
Client and Server now working in full again - no apparent issues at this time.
Changed the way flight data is handled a little: Now there is the preparation stage (validates the flight data packet), pre-send event (Change the flight data packet parameters before sending eg smoke disabled), sending stage (actually sends the flight data to other clients) and then the final post-send event (non-flight data modifications - example aerial refueling.) Moving some of the events AFTER sending flight data will reduce lag and latency.
~Aerial refueling will now refuel all the way to 100%, and won't stop just shy (99.7%, 95%, etc...)
~Flight data sending is now threaded - this may or may not offer improvements... I hope it will.
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
So hopefully some really cool things are coming!Soji wrote:
As for the fog, sky, and ground colors, I can try. I'll add the following commands.
FSNETCMD_FOGCOLOR, // 48
FSNETCMD_SKYCOLOR, // 49
FSNETCMD_GNDCOLOR, // 50
Fading sunsets, some interesting fog novelty effects...
... Currently, the sequence for the client to join needs to be initiated from the client. What I can do it to add a command:
FSNETCMD_SERVER_FORCE_JOIN // 47
In short, I can't force the clients to join flight if they haven't sent a request to do so yet... (ejection from aircraft and fly a parachute is the plan)
which will mimic J-key in the client. Then the client will issue a join-request...
Reserving packet 64 is not a big deal. I can open 10 numbers, 64 to 73, for you. I've just modified my code so that I won't forget...
Asked if reserving packet 64 was a problem for Soji - no problem. Infact I got more than I even needed...
Mach number 2-digit below decimal is not a big deal. I'll do it...
Old request from TF58 that I think YSF needed too, so I supported and asked.
Right now client does not tell if the player is using autopilot or not.
Wanted to be able to detect if clients are using auto pilot of not - options for server owners if so...
By the way, not in the coming version, but in the next one (hopefully late 2015, but probably 2016 version), I'm thinking to make damage tolerance a floating point. I haven't decided how I am going to transmit over the network, but probably I will add one byte for below decimal. It is one of relatively high-priority things in my to-do list.
- decaff_42
- Staff
- Posts: 3838
- Joined: Sat Oct 29, 2011 7:23 pm
- Favorite Aircraft: SR-71 Blackbird
- Location: Eastern United States
- OS: Mac OSX
- Has thanked: 844 times
- Been thanked: 1727 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
Visit my GitHub page for Python codes: https://github.com/decaff42?tab=repositories
YSFlight Addon Database - Find links to nearly every addon made for YSFlight!
Submit Addon To Database
- Neocon
- First Class Membership
- Posts: 3955
- Joined: Wed Oct 19, 2011 5:01 am
- Favorite Aircraft: Baron 58
- Location: Tennessee
- OS: Win 10
- Has thanked: 1770 times
- Been thanked: 1810 times
- Contact:
- iqmal_97
- Senior Veteran
- Posts: 1778
- Joined: Fri Mar 11, 2011 8:47 am
- Favorite Aircraft: Sukhoi Su-30MKM
- Location: Somewhere in Asia
- OS: Windows 10
- Has thanked: 856 times
- Been thanked: 194 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
I'm a total sucker for effects and I just can't wait to see (if one day) the fog one get implemented!
*fingers crossed*
Mein Imgur gallery. Feel free to use any of my screenshots (Crediting me is optional, but greatly appreciated)
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
- iqmal_97
- Senior Veteran
- Posts: 1778
- Joined: Fri Mar 11, 2011 8:47 am
- Favorite Aircraft: Sukhoi Su-30MKM
- Location: Somewhere in Asia
- OS: Windows 10
- Has thanked: 856 times
- Been thanked: 194 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
Yeah. You can say that again...OfficerFlake wrote:Life has priority at all times.
Mein Imgur gallery. Feel free to use any of my screenshots (Crediting me is optional, but greatly appreciated)
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
- Flake
- VFA-49
- Posts: 4375
- Joined: Thu Feb 10, 2011 8:47 pm
- Favorite Aircraft: Boeing F/A-18A
- Location: Australia
- OS: Windows 10 (x64)
- Has thanked: 861 times
- Been thanked: 1279 times
- Contact:
Re: [PROGRAM] OpenYS - Open Source YSFlight Server!
Been working my arse off working out how to get the program to load DLL's from a Libraries folder - I don't want them in the root folder (It's MESSY!)
That's finally done (and it was a learning process!). I also just briefly tested the debugging and it appears to still work.
The entire project has been almost entirely rebuilt from the ground up - I'm hoping some components are more stable and other components are faster than before. Definitely the program is much easier to build with!
Here's an interim test for now. Hopefully no problems!
NOT AN OFFICIAL RELEASE YET. I still have more work to do! But for now, the program is working and it's something to look at.
Slight file size increase since there is now a lot more metadata for each project component...
Download Interim Test...
/
- Neocon
- First Class Membership
- Posts: 3955
- Joined: Wed Oct 19, 2011 5:01 am
- Favorite Aircraft: Baron 58
- Location: Tennessee
- OS: Win 10
- Has thanked: 1770 times
- Been thanked: 1810 times
- Contact:
[PROGRAM] OpenYS - Open Source YSFlight Server!
I changed the map name in the .dat file. I even used the /map command and then did the /restartnow command. It started back with Hawaii.
Who is online
Users browsing this forum: No registered users and 0 guests