Results 1 to 10 of 15

Thread: Game Network Library

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Mar 2012
    London, UK

    Game Network Library

    Hi everyone.

    I've not posted here before so let me introduce myself. My name is Ian Macintosh and I've been programming in Pascal on and off for some 25 odd years on various applications, mostly business and mostly SQL based. I have recently started using FPC, specifically via Lazarus and it's rather nice IDE.

    The reason for this post is that I need a game network library for my personal use. Having browsed over the various available libraries I don't find anything that quite fits the bill. Some are just plain too much, some are non free, many seem to have fallen into various states of disrepair, etc. The one that seems to almost fit the bill is ENet (

    I am not averse to writing it myself, and having searched quite thoroughly now, see that it is the most likely outcome. With that in mind, I've written up a requirements spec as a broad swipe at the problem. I am hoping that in reading the requirements, the list members may be able to possibly suggest an existing suitable library, or suggest additions, deletions or corrections to the requirements spec, or even display an interest in participating in the library. Any participation, even limited to purely constructive critisism would be appreciated.

    Herewith the document itself which will obviously loose some formatting in the process. If you are not averse to seeing it in it's Google Docs form, the direct link to the source document is

    Please feel free to mail me directly with your comments, flames or critique, or here if you feel that the subject material suits the forum purpose.




    Game Network Library

    • Low level library

    Allows other more complex functions to be built on top. Also allows others to choose to use only this part of the library if the higher functions are not suitable for their application.

    • Low latency

    • LGPL - Free Open Source Software without limitations. In particular, the ability to link it into any program, even a commercial one.

    • Session based

    Support session validation via callback and receive/transmit login or authentication details. Allocate a session ID to established connections, but allocate decreasingly minimal resources to unauthenticated new connections.

    • Inquiry (without a session)

    Support non-session data enquiry such as for example querying for a list of servers from a master list server.

    • Unreliable data transfer

    Not all data requires reliable transfer. For example voice data, if it arrives out of sequence or late or never, makes no difference.

    • Reliable data transfer

    Some data must be delivered. Support both reliable sequenced and unsequenced data packets.

    • Bandwidth limiting per interface

    To maintain low latency for all connections, do not exceed the interface bandwidth capabilities. Queueing is the enemy of low latency.

    • Bandwidth limiting per session

    A major factor in multi-user environments is bandwidth costs. In addition, individual bandwidth limits ensure that single sessions do not impact the experience of other connections.

    • Single Port UDP only

    Multiple ports are unnecessary. An extremely trivial overhead of a single byte will allow as many concurrent streams of data as are necessary.

    • Non blocking when within bandwidth and queue limits. If bandwidth limits are exceeded, make the caller(s) queue, not the traffic. Not a major issue if the caller is multi-threaded. However when used correctly (ie, enquire remaining bandwidth details before creating additional packets) will not block. However, if used incorrectly the library will block the caller.

    • Apply QOS to all data-grams - default time-critical but allow library user to set another default if required.


    • Payload encryption

    Provide some protection against simple man-in-the-middle traffic manipulation.
    Per session details


    • Optional limits
    • Statistics
      • Total bandwidth
      • Current moving average

    • Query available bandwidth

    Round-trip time

    • Cumulative average
    • Current moving average

    Packet loss

    • Cumulative total
    • Current moving average


    • Standard unreliable data-grams (i.e. - UDP default)
    • Reliable unsequenced data-grams
    • Reliable sequence data-grams


    • Multiple streams

  2. #2
    Asphyre Sphinx 2 has networking component TNetCom based on UDP protocol that should cover many of your points. However, high-level stuff such as session control and reliable delivery you will have to implement yourself as an additional layer on top of it. Previously it supported reliable packets, but it was dropped since this support should be part of application layer and not TNetCom itself.

  3. #3
    Junior Member
    Join Date
    Mar 2012
    London, UK
    Their implementation is too simple. It's just UDP. Hardly worth calling a library.

  4. #4
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Blog Entries
    You may be hard pressed to find exactly what you are looking for. You do ask for quite a bit in your post. If your needs are so specific and you are not satisfied to work with what is available, you may be stuck with writing your own.

    Usually there are game libraries that have a few features or a couple of big libraries with a ton of features. Even working in C, I doubt you'll find exactly what you are looking for without a little bit of leg work. I'd recommend working with a library that has the basics and build up to what your game project(s) require.
    Jason McMillen
    Pascal Game Development

  5. #5
    I think ENet is the closest it will get for free, and paid
    From brazil (:

    Pascal pownz!

  6. #6
    Junior Member
    Join Date
    Mar 2012
    London, UK
    Agreed. ENet is very close to the requirements. It's drawback is that it's in C, will require either conversion or wrapping in Pascal, and hasn't been worked on for a good while.

    Demonware isn't a goer unless you have some serious capital to sink into the project.

  7. #7
    Junior Member
    Join Date
    Mar 2012
    London, UK
    Yes Will, the needs are specific, but unfortunately I can't really see any way of ignoring any of them unless I were to layer it into an even simpler form. For example, UDP, then Reliable UDP, then Seq. Reliable UDP, then bandwidth, sessions, etc... Ultimately I can't see any other than the simplest of games (2 or so players) needing less than what I've given there.

    The layers I've mentioned are the way to write it anyway.

  8. #8
    That project of yours for which you made the above requirements along with 10 mb/sec bandwidth... Is it a MMORPG?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Comodo SSL