[PROGRAM] OpenYS - Open Source YSFlight Server!

Note that alterations to the YSFlight .EXE is forbidden
User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Thu Mar 26, 2015 3:24 pm

Just spent what seems like the last ages restructuring the entire client class of OYS... Now it's all clean and easy to code with and manage. It's broken at the moment but it shouldn't take long to fix.

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.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Thu Mar 26, 2015 11:42 pm

Client restructure complete.

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.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Fri Mar 27, 2015 12:03 am

Old Structure:
Image

New Structure:
Image

Better?
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Neocon
First Class Membership
First Class Membership
Posts: 3850
Joined: Wed Oct 19, 2011 5:01 am
Favorite Aircraft: Baron 58
Location: Tennessee
OS: Win 10
Has thanked: 1620 times
Been thanked: 1732 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Neocon » Fri Mar 27, 2015 12:32 am

I don't know what any of this means! :lol:

Stingx
Veteran
Veteran
Posts: 583
Joined: Tue Dec 04, 2012 4:31 am
Favorite Aircraft: ufo
Has thanked: 2 times
Been thanked: 27 times

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Stingx » Fri Mar 27, 2015 2:05 am

I keep my shit tight, so I know clean when I see it. For a laggy game, this is a plus for OYS.

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Sun Mar 29, 2015 8:23 am

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());
Old Socket Data Receiver Core vs the New One... Didn't know I could force the sockets to wait until a specific ammount of data was received! I haven't tested method two yet but I do believe that will be perfectly stable.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Neocon
First Class Membership
First Class Membership
Posts: 3850
Joined: Wed Oct 19, 2011 5:01 am
Favorite Aircraft: Baron 58
Location: Tennessee
OS: Win 10
Has thanked: 1620 times
Been thanked: 1732 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Neocon » Sun Mar 29, 2015 4:48 pm

That seems a lot shorter than the first one. Are you sure such a short, simple little code will do the same job as that long one above it? ;) Like I know what you're talking about. :lol:

I'm guessing that ought to cut down on file size by a good amount.

User avatar
decaff_42
Staff
Staff
Posts: 3584
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 637 times
Been thanked: 1402 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by decaff_42 » Sun Mar 29, 2015 5:51 pm

OfficerFlake wrote: I haven't tested ...
... but I do believe that will be perfectly stable.
You are a coding wizard if this is the case! :D
Check out my website YSDecaff for all my tutorials and addon releases.
Visit by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Server Flight Log
Addon Database Submit Addon To Database

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Mon Mar 30, 2015 12:35 am

It's doing it's job as much as I have tested.

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.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Tue Mar 31, 2015 11:14 am

Sent Soji Yamakawa an email about this project. I hope to hear back from him regarding potential changes to YSF to better support OYS... I won't give anything away as I don't want to hype up and then disappoint - hopefully I hear back from him.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Thu Apr 02, 2015 4:26 am

Got a reply from soji...
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.
So hopefully some really cool things are coming! :D
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
decaff_42
Staff
Staff
Posts: 3584
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 637 times
Been thanked: 1402 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by decaff_42 » Thu Apr 02, 2015 4:50 am

Epic News! It is awesome that you are able to interface with him on improving the YSF experience!
Check out my website YSDecaff for all my tutorials and addon releases.
Visit by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Server Flight Log
Addon Database Submit Addon To Database

User avatar
Neocon
First Class Membership
First Class Membership
Posts: 3850
Joined: Wed Oct 19, 2011 5:01 am
Favorite Aircraft: Baron 58
Location: Tennessee
OS: Win 10
Has thanked: 1620 times
Been thanked: 1732 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Neocon » Thu Apr 02, 2015 5:02 am

A year from now? Time to practice being patient. :)

User avatar
iqmal_97
Senior Veteran
Senior Veteran
Posts: 1772
Joined: Fri Mar 11, 2011 8:47 am
Favorite Aircraft: Sukhoi Su-30MKM
Location: Somewhere in Asia
OS: Windows 10
Has thanked: 810 times
Been thanked: 192 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by iqmal_97 » Thu Apr 02, 2015 5:20 am

This is friggin' awesome! :o

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*
Image
[N007HA]Nynaiqmal_97 <= My usual online callsign
Mein Imgur gallery. Feel free to use any of my screenshots (Crediting me is optional, but greatly appreciated)

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Thu Apr 02, 2015 6:29 am

it shouldn't take too long for any of the effects as the infrastructure already exists. What will be more determinant is how busy Soji is. Life has priority at all times.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
iqmal_97
Senior Veteran
Senior Veteran
Posts: 1772
Joined: Fri Mar 11, 2011 8:47 am
Favorite Aircraft: Sukhoi Su-30MKM
Location: Somewhere in Asia
OS: Windows 10
Has thanked: 810 times
Been thanked: 192 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by iqmal_97 » Thu Apr 02, 2015 10:29 am

OfficerFlake wrote:Life has priority at all times.
Yeah. You can say that again... :?
Image
[N007HA]Nynaiqmal_97 <= My usual online callsign
Mein Imgur gallery. Feel free to use any of my screenshots (Crediting me is optional, but greatly appreciated)

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Thu Apr 02, 2015 11:17 am

I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Sun Apr 05, 2015 11:53 am

Funny coincidence that the latest YSF test version came out today don't you think?
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Flake
Core Staff
Core Staff
Posts: 4356
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1240 times
Contact:

Re: [PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Flake » Mon Apr 13, 2015 4:08 am

Hi folks - you've been waiting very patiently - Thank you!

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...


/
Last edited by Flake on Tue Sep 01, 2015 1:05 pm, edited 2 times in total.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
Neocon
First Class Membership
First Class Membership
Posts: 3850
Joined: Wed Oct 19, 2011 5:01 am
Favorite Aircraft: Baron 58
Location: Tennessee
OS: Win 10
Has thanked: 1620 times
Been thanked: 1732 times
Contact:

[PROGRAM] OpenYS - Open Source YSFlight Server!

Post by Neocon » Mon Apr 13, 2015 5:05 am

It seems that it will run any map you want, as long as it is Hawaii. :?

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests