BF4 Library

May 11, 2013 at 2:18 PM
Once again, I intend to do another .NET library for BF. I haven't done any real planning yet, but here's some random information:

I'll manage it for probably at least as long as I did with this library.
It will be written from scratch. It will probably have a similar look, but don't expect it to turn out that way :D
Though I haven't done any real programming since this library, I have worked some on improving my skills as a programmer (OOD and stuff like dat). This means it should be written better, and others will have a better time modifying it if I ever abandon the library.
I will probably host it here or Team Foundation Service.
Jul 3, 2013 at 5:04 PM
Might I suggest using github for that?

It's much easier to fork and has a huge community to contribute patches.
Jul 9, 2013 at 1:21 AM
I haven't really decided on where I will (probably)-perma-host the project D:

Since MS has begun integrating Git functionality in VS, I think I will actually go with that :D. However, I definitely like TFServer as an ALM because of how well it integrates with VS.

Unfortunately, TFService isn't suitable for open-source projects because those projects are private. It has been said that CodePlex and TFService will eventually integrate with each other in some way, but I don't see that happening soon enough :<. If this integration happens soon enough, I'll stick with CodePlex. If it doesn't, I'll probably use GitHub :D

I have a little code done (been busy), but not enough to make migration a real concern. I'll want to make a decision before the project gets too large, though. I expect this to happen in no more than 2 months, but who knows :D

Ooooor just had an idea on syncing TFService's git with GitHub's. I would only do this if it didn't hurt the open-sourciness of the project, though.
Oct 6, 2013 at 12:21 PM
Edited Oct 27, 2013 at 8:55 AM
Hi Timi,

I have been using your library since 2012 and it has helped me a lot managing my server. For Battlefield 4 I plan to make my websocket based server management utility open to the public. I wish to support your development on the BF4 library as far as I can and would like to offer you a game server to test on as soon as my clan is getting one (upon release).

If you could use any (further?) help please feel free to contact me also by mail on

Oct 27, 2013 at 7:54 PM
Thanks for you interest! I love hearing about those that have used the BF libraries. And thanks for your offer to provide a test server!

Sorry about the late response, though. I tried and failed to have code available before responding. Since the game's release is imminent, I definitely need to respond now!

Development isn't as far along as I would've hoped for two reasons:
Uni work is keeping me incredibly busy; I'm pretty behind atm.
Protocol docs haven't been released yet (to my knowledge).

I expect the same basic protocol to be used, so the BF3 library should work as a temp solution if you need to. The RawRead event and SendRequest should work well enough. However, there's a possibility some exceptions might pop up if existing events are used with a different format, so you might need to remove the event code and rebuild (or I can mayb do that as soon as possible!).

I've just made the new CodePlex project at Since I've just made an empty project, it'll be unpublished for now. Whenever I get the time, I'll just need to fill out some basic stuff and move the project from TFS. This version is looking to be much improved, so I'm sorry that there will be delays :(.

I wanna do a little more to the code before I can upload it, but here's a class diagram of most of the current code:


The stuff like PlayerCollection is elsewhere, and I didn't include it because there's no docs to work off of anyway :D. I also haven't done much into designing the event-driven portion, but that will be part of a separate interface that RconClient implements. I hope this helps you in some way. I'll do my very best to get something releasable up as soon as I can!
Oct 27, 2013 at 8:14 PM
Edited Oct 28, 2013 at 5:01 PM
I would very much appreciate adding a websocket interface properly to your BF4 version (some skeleton code would get me started) and maintainig a seperate project here on codeplex and/or on bitbucket/github with the js app (gpl).

I also hope the base protocol remains the same, however, once I get my hands on some documentation I will share it here or on your new project.

Thanks for your time and your very detailed and interesting answer!
Oct 27, 2013 at 8:47 PM
Since I didn't have a way to verify anything about connections for sure, I don't have any socket/protocol code written atm :<. Fortunately, the design is independent from this, whether or not data is read from a socket or file, no matter what the protocol looks like. The concrete RconClient class currently uses an IRconConnection<Packet>; it'll just be a matter of writing an implementation of that interface. I don't know how you'll specifically be using the library, but maybe you can build against one of the interfaces.

I didn't write event code yet, but, if you are maybe taking events and requests/responses and sending them over WebSockets, you could try coding against the I(Synchronous)RconClient interface.

If you are doing something like proxying every packet sent and received, then you could try coding against IRconConnection<Packet>.

Of course, the lack of documentation makes doing this a bit harder. The behaviors should be obvious due to the names, but I'm sure there are some freaky side-effects I'm not even aware of yet :D. Hope it helps, tho!
Oct 28, 2013 at 10:05 AM
At the moment I have taken part of your library (namely the Packet.cs and part of RconClient.cs) to make a bare protocol stack and connected the receive and send events though a converter to Alchemy Websockets' events. I am handling any abstraction aside from sequence numbers and login in a javascript browser application.
If you are doing something like proxying every packet sent and received, then you could try coding against IRconConnection<Packet>.
Thank you for posting your work you have so far on the BF4 library. It certainly gives me an idea on how to proceed. I think I will go with your class diagram, implement an interface and keep most of my code as it is to make no redundant changes.

I did some testing on the exact restrictions of sequence numbering and while they are designed to be successive (see documentation) it seems they can be random and even repeatedly used. Do you have any experience in that area?

Also the documentation states that every message has to be acknowledged ("OK" packets). Do you acknowledge events?

Thank you for your time, it is very much appreciated!
Oct 30, 2013 at 6:09 PM
Oct 30, 2013 at 7:06 PM
Thanks for the link!

I've just got the license infos added to the project and the source code imported from TFS. With those out of the way, the CodePlex page is now published!

I'm still majorly short on free time, but I'll try getting stuff done today.
Nov 27, 2013 at 2:58 AM
The BF4Rcon project is now able to connect to servers at least, so this marks the beginning of the end for this project D:. In fact, if you're (addressed to all readers) not using any potentially game-specific classes like PlayerCollection, I would recommend moving to the new library. The code is much better and I'll be working on it for a while. Of course, maybe it would be too much work moving over, which is fine.

It'll still be a few weeks before I have enough time to go full-on with the BF4 library, so it'll take a bit to bring it up to the BF3 library's functionality D: