Author Topic: Ongoing NetFix work  (Read 2649 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Ongoing NetFix work
« on: March 03, 2020, 08:28:10 PM »
Just wanted to post an update on Github activity.

After moving most of the active projects to the Visual Studio 2019 toolset, Hooman and I started refactoring NetFix Client. The code was written in pre C++11 style. We made decent progress removing some manual memory management and improving code style. There could be a fair amount more refactoring though. The Linux automated builds were improved as well. I did a most of the initial programming with Hooman reviewing the changes.

Hooman is planning to merge NetFixClient and NetFixServer into a single repository. I'm looking forward to this because it will be easier to create, review, and test functionality across the client and server.

There will probably be lots of manual work inovolved in transfering the two issue trackers into the new repository (which I'm happy to assist with). After merging, I'd like to form a static library to push common code between the two projects. Then I'd like to add GoogleTest to NetFix so we can add basic unit tests to the static library project.

Unit Tests will be a nice addition for regression tests on some changes. I think we sorely need a larger test apparatus to make real progress. Something like a test server on Outpost 2 to test against with without breaking what is already present. Anyways, one step at a time.

My own contributions to the project are hampered by lack of win32 programming skills and no real networking experience. The win32 programming has very slowly been improving though. The networking not so much. I suppose nothing prevent the server side code from being written in any number of languages, but since it already works in C++ and the community as a whole is most familiar with it, maybe best just to stick with C++.

Offline TechCor

  • Full Member
  • ***
  • Posts: 141
Re: Ongoing NetFix work
« Reply #1 on: March 04, 2020, 11:12:25 PM »
Networking is pretty standardized across languages, particularly socket programming. It's because everything ultimately boils down to TCP or UDP. You won't get any particular benefits from a different language unless you use some kind of library.

Unix Network Programming is a great book (I still own it!), but I've also found Beej's Guide to Network Programming pretty useful as well for the budget programmer.

I had a great book by Charles Petzold for Win32 programming, but I tossed it under the assumption that win32 was obsolete. Little did I know I'd need it again for modding old games...

Keep up the good work!

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Ongoing NetFix work
« Reply #2 on: March 07, 2020, 07:13:30 AM »
Win32 obsolete... Never!

Thanks for posting the books. I think I'll start with Beej's guide for now. I read through the introduction and it seemed engaging.

Brett

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Ongoing NetFix work
« Reply #3 on: March 29, 2020, 01:10:48 PM »
Just wanted to post a quick update.

The server and client projects have not been merged yet, but a lot of refactoring has continued in NetFixClient. Most of the refactoring has centered around breaking up larger functions into smaller chunks. A couple of the functions were around 270 lines of code with embedded switch statements and further logic statements inside the switch statements. By pulling out code within the switch statements and pushing it into subfunctions, I think it is easier to review what the switch statement is up to.

Several enums have been switched over to the newer enum class (scoped enum), which I think also improves readability.

The logging and debug code has been partially cleaned and fully integrated into op2ext, which will unify netfix's reporting with other modules. There is still work to improve readability of the logged information and possibly remove some of it.

Lastly, the first UI tooltip was added to describe the multiple uses of the ServerAddress combo box. This was probably my first contribution that involved legitimate new win32 code instead of refactoring.

There are several sections I have in mind for similar general refactoring. I was hoping to start working on more tangible improvements, but they may have to wait a while longer.

A lot of the refactoring is just fact of life to start using newer C++ features that didn't exist when NetFix was originally written, such as enum classes, nullptr keyword, std::array, std::vector, static_cast, etc. I'm also trying to favor non Windows specific solutions if there is a standard library solution that is equitable.

-Brett

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Ongoing NetFix work
« Reply #4 on: April 16, 2020, 08:31:39 PM »
The refactoring work is much appreciated. The code base is now in a much better state than it was before. Much more modern now. That should help tremendously with any efforts going forward.