PDA

View Full Version : Game Network Library



igmac
01-04-2012, 01:08 AM
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 (http://enet.bespin.org (http://enet.bespin.org/)).

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 https://docs.google.com/document/d/1Pt7sK0LphWCGPzaNfTaQ0uRHWe2xZQ26TWDJy1gIGfY/edit

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.

Regards,

Ian.

-------

Game Network Library
Requirements

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.

Optional

Payload encryption

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

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

Types

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

Streams

Multiple streams

LP
01-04-2012, 01:22 PM
Asphyre Sphinx 2 (http://www.afterwarp.net/products/asphyresphinx2) 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.

igmac
02-04-2012, 12:50 AM
Their implementation is too simple. It's just UDP. Hardly worth calling a library.

WILL
02-04-2012, 01:14 AM
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.

arthurprs
02-04-2012, 03:34 AM
I think ENet is the closest it will get for free, and paid http://www.demonware.net/

igmac
02-04-2012, 01:15 PM
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.

igmac
02-04-2012, 01:18 PM
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.

LP
02-04-2012, 02:05 PM
That project of yours for which you made the above requirements along with 10 mb/sec bandwidth (http://www.pascalgamedevelopment.com/showthread.php?13222-Buffer-Memory-Management)... Is it a MMORPG? :)

User137
02-04-2012, 02:34 PM
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.
Hmm.. did somebody already do that?
http://www.assembla.com/spaces/ENET_PASCAL/trac_subversion_tool
Source: http://subversion.assembla.com/svn/ENET_PASCAL/

igmac
02-04-2012, 03:07 PM
Yes to a degree Lifepower. MMO definitely, but not particularly RPG, though it has persistence. Perhaps thinking of it as an MMO persistent world simulator would be a closer definition.

WILL
02-04-2012, 10:29 PM
MMO definitely

You realize the "faux pas" behind MMO projects by small developers, right? :)

Why does my skin crawl when a new member's first project is a huge MMO or RPG...

Well I'll save the long discussion, because I don't want to take your thread too far off-topic, but here is a link to a very recent discussion (http://www.pascalgamedevelopment.com/showthread.php?13103-Why-not-do-an-MMORPG-as-you-first-project) about this very matter. I hope it helps, even only if to a degree. (Since I don't know what your project is supposed to be exactly in all fairness.)

There is no problem with the MO part, but any hobbyist developer should steer WAY clear away from huge amounts of content/asset requirements. They are project killers.

igmac
03-04-2012, 09:32 AM
Couldn't agree more Will. Content generation is a huge issue, and one I sail as close to the wind as possible to get away with. ie, don't do it if you can remotely do without it. I've done enough 3D design to know that even small content can take a week per item, and 'main objects' can take many weeks.

Fortunately, I have extensive experience in bringing projects from inception to completion, albeit in a different market - business software. Though now I think about it I did write two games to completion many years ago when I first learnt programming. A 'breakout' game (you know, bricks, a paddle and a ball to smash the bricks with) and a pinball game. Both on the old TRS-80 series which I would be most surprised to discover anyone here knows about :-)

Anyway, my focus is on the engine, not the graphics (the time sucker). One day, many years from now, I might tackle the MMORPG scene with a large team, and a large budget, but not today.

For now, I'm satisfied with the blue squares that attack the red squares :-)

Where I have spent some time over the past years is the AI, and that proved quite a tough nut to crack. However, I have that under my belt now, and even though I wrote the game, know the code, know the moves, I find the AI extremely challenging.

What I'm aiming at is probably very much like an online version of Falcon 4 in some ways, maybe a bit of 'Dangerous Waters' in others, and even a little of 'Aces High' in others. It involves a form of aerial combat as it's main focus.

From this you might gather that it's what one might call 'content sparse' when compared to an WoW type project. Which is exactly why I've chosen it :-)

On a slight tangent - is anyone here actually working on a land based (ie, terrain, trees, foliage, plants, rocks) type of project? I did open source a handful of content, including about 5 or so very good to acceptable plants - all low poly. Because if anyone is, I can go scrounge it up from my archives and re-post it somewhere as the location I originally posted it to seems to have gone the way of the Dodo.

I've also got a slightly interesting landscape POC for a BF3 type terrain (ie, single mega pre-calculated terrain mapping) with foliage, mist, trees and octree occlusion culling etc if anyone is working on that sort of thing. I don't have characters, but the POV does hug the terrain. It doesn't have collision detection for trees or rocks though, so you can 'walk' through them as it stands. Anyway, just mentioning because it came to mind as I wrote this :-)

LP
03-04-2012, 12:10 PM
Fortunately, I have extensive experience in bringing projects from inception to completion, albeit in a different market - business software. Though now I think about it I did write two games to completion many years ago when I first learnt programming. A 'breakout' game (you know, bricks, a paddle and a ball to smash the bricks with) and a pinball game.
Please forgive my curiosity, but can you describe some of the business software that you have worked on?

igmac
03-04-2012, 01:28 PM
Rather than hijack this thread - http://www.pascalgamedevelopment.com/showthread.php?13228-Programs-I-ve-worked-on&p=83792

:-)

igmac
03-04-2012, 02:58 PM
Hmm.. did somebody already do that?
http://www.assembla.com/spaces/ENET_PASCAL/trac_subversion_tool
Source: http://subversion.assembla.com/svn/ENET_PASCAL/

That will probably prove useful thanks 137