(good) networking (UDP) libs/code for BMax?

BlitzMax Forums/BlitzMax Programming/(good) networking (UDP) libs/code for BMax?

gameproducer(Posted 2008) [#1]
I see pretty many UDP/network threads in these forums. What's the consensus: what's a good way to handle UDP communication?

Raknet? (is it up-to-date?
Enet? (anyone using?)
Bnet? (what's the status of this?)

I'd be especially interested to hear comments from those who actually use some lib in their networking code...


Bremer(Posted 2008) [#2]
I could use something with a simple setup which is easy to use. Something where you do not need to know a whole lot about networking. Almost plug and play type deal. Does anyone have any input and recommendations on such?


gameproducer(Posted 2008) [#3]
Hmm, zawran, I've done search on these forums and to me it sounds like it's "Big NO".

There's many libs out there but haven't seen a single "established & commonly accepted one that would be updated & have support".

I've personally done networking with Blitz3D, but wanted to know if there was some ready made in Bmax. I suppose I could start coding the lib so that others could use it as well (plug & play -style networking lib for bmax).

Question: what kind of game are you making? and what sort of multiplayer/networking features you'd be after?


smilertoo(Posted 2008) [#4]
I was after a lib as well suitable for realtime arcade type game, upto 4 players. Not much there for bmax.


Arowx(Posted 2008) [#5]
I though GameNet was the default built in network/games library, never used it though!

It looks as though you once you have figured out how to create a set of GNet objects then it's just a case of updating them and reading the changes?


Bremer(Posted 2008) [#6]
what kind of game are you making?


What I was looking for was something that could handle a RPG game in the style of Dungeon & Dragons where players move their party around using a 2D tilebased landscape and enter dungeons to fight monsters. (limited number of players since its just something for myself and a few friends to play with, probably never more than 8 at any given time)

What I wanted was to have all information stored on the server, which would just be a pc I have running online via my broadband connection, and when players have their party in a fight or if they find new treasures, then all that information is calculated on the server and relayed to the players.

Their actions, which would not be realtime, but rather turnbased would be sent to the server, it processes it and returns the result. This way the players would not be able to mess around with scores or items as everything is stored on the server and verified when changes are made.

This would also allow me to continously update the game world with new locations, new treasure items and such without having to update each client as maps and such are downloaded when they log on to play.

I am fairly handy with using blitzmax and have done all sorts of coding except for networking. I did look into gnet at some point but found it difficult to get to where I wanted, or perhaps I just did not get how it works.

So I have been on the lookout for something already made where there were a simple set of function calls that would handle the behind the scenes stuff and where I would not have to learn a lot about networking.

If nothing comes around I will probably be giving gnet another look over once I get somewhere with the game where it would have to start communicating via the internet. At the moment its mostly just a few different pieces of test code and some ideas. But its something I have been wanting to make for a long time now.


gameproducer(Posted 2008) [#7]
So, zawran, your system looks like very general server-client architecture:

- server is authorative and handles all the world updates based on client input

Question: how many objects (locations, items, maps, characters, etc.) do you think your game would have? I mean: how many object info needs to be sent from the server to the clients... Any rought estimations?

I didn't see anything about "input" in gnet, so it might not be a solution for you... but maybe it's just me.


Bremer(Posted 2008) [#8]
hmm. no an easy question. So far I am planning on each playing having a team of 4 characters. Each character has a lot of stats to keep track off, but not all are utilized at all times. So the amount of data to go to and from the server probably will not be that high.

As an example, if a player tells a character to hit a monster, a die roll of a d20 is rolled, so the players client would ask the server to provide a random number between 1 and 20, which is then added to various modifiers and checked against the monsters armor score on the server. If its a hit, the server reports back to the client that a hit is made, and the client asks the server for a damage value based on the stats of the character which is stored on the server. The server calculates the damage and send it back to the client which tells the player what kind of damage was made.

So all in all I do not think that a lot of data needs to be transfered at the same time, probably just a few numbers and instruction codes at a time.

Its a game that I have been thinking about making for a long time, but I just haven't found time to put things in motion, so I have mostly just been looking around for what I might need should I manage to find the time. And lately I have been wanting to allocate time for it, which is why an easy to use network module would be a good push for me to get started on actually doing something about it.


gameproducer(Posted 2008) [#9]
sounds pretty doable... and pretty simple in fact.

I'd say you can plug networking support later... no need to have it right now :)


verfum(Posted 2008) [#10]
The last time I looked at Neworking, especially for RPG style games there is nothing out there exmplaining or giving examples on how to actually do it, just lots of people waffling on about it, it's far from easy to do, the router side of it was complex, all examples I ran never worked and all were just simple packet sending, nothing to do with games, sending messages, I think there is a massive leap between sending messages and moving characters around.


gameproducer(Posted 2008) [#11]
Yeh, at the moment there's not necessarily a good "plug & play" kind of networking lib available. GNet seems pretty simple, but even it has some limitations...


verfum(Posted 2008) [#12]
It's a good thing and a bad thing, it's good to get people trying to work it out for themselves but at the same time it's scaring not so experienced programmers like myself. It would be good if a load of people on here put together a simple example of moving some characters around a basic screen using RakNet or whatever, nothing crazy just like rectangles etc. Just demonstrating positioning.


Mahan(Posted 2008) [#13]
verfum: Searching old posts in the forum i found this quote:


Mark posted one: www.blitzbasic.com/tmp/gnetdemo.zip



I'm at work and haven't tried it out, but I think it's a gnet multiplayer demo (2D). Though it could be useful.


pls(Posted 2008) [#14]
I used gnet on "Su Doku Live" and it was pretty straight forward.

On my new project I am probably going to use Raknet (the cross-platform wrapper is mentioned in the these foruns). My first tests (on the mac) went really well.

PLS


verfum(Posted 2008) [#15]
Mahan: Yeah I did see that, from what I remember it was really basic, but don't quote me.

pls: Excellent! how about a cut down block of code showing it off then :)


verfum(Posted 2008) [#16]
mahan: Just taken a quick peek and I take it back, it's not basic, looks good, might have a play at some point :)


pls(Posted 2008) [#17]
I just hacked the sample test code that comes with the wrapper:

- change the message type from raknet ping to something else (or just type 100 at the message type)
- compile to versions (one has server and another as client); just change the flags at the top of the code
- See it working

Later I also tried changing from sending bytes to sending chars, and tried it as a simple chat program... worked fine, erased the code, decided that I will use it (the wrapper).

PLS


MGE(Posted 2008) [#18]
pls - which wrapper? Please post a link, thanks!


MGE(Posted 2008) [#19]
I want to write 2 player internet pong. How would I do it in Bmax?


Foolish(Posted 2008) [#20]
Does anybody have a "non-chat" example using Raknet?


verfum(Posted 2008) [#21]
I think RakNet is the one which is in despirate need of good examples, only chat examples available, we need some game related examples. I'll have another crack at this soon, I'm working on Physics at the mo.


Mahan(Posted 2008) [#22]
i posted about www.blitzbasic.com/tmp/gnetdemo.zip but unfortunaly it seems this example is outdated and wont even compile with the latest gnet from svn.

It was probably this post that made me look at brl.gnet again and got me started on MaGNet last friday - shameless ad :)

brl.gnet itself should be plenty good for a small multiplayer game (~2-8 players) and using MaGNet on top of that you don't even have to deal with the "slots" of GNet but you can have local objects and just update their native properties and read the native properties of remote objects.

I think this is a pretty neat approach for developers that are not networking experts (I know I am not) to be able to abstract all that networking stuff and just deal with local/remote objects and not have to parse messages and write lots of "plumbing" to move data back and forth between peers.

(I'll try to mobilize some energy to write a MaGNet example.)


Foolish(Posted 2008) [#23]
I did get GNET demo to work at some point. If I can, anybody can, trust me.

I am very appreciative that someone is working on the networking issue. However, I had the impression that GNET will not work for low latency FPS kinds of games. Raknet seems more geared to that. Mahan, I would be happy to try out your library if you think I could do even up to a 4 player "action" game with your modified library.

If so, do you have any test projects you can share?

Networking is the only reason to look at Torque. Of course, getting Torque to do anything else is a major pain in the butt.

I would much rather be using BMax.


Mahan(Posted 2008) [#24]
Foolish: I just updated the lib post with a modified version of the gnet demo. Try it out yourself if you feel like it.

When it comes to latency i think GNet (in theory) should be pretty ok, but from i remember when i briefly checked Raknet is that it includes "smoothing" of movement. What i mean is that if one notifies Raknet of the direction and speed of something it can "estimate" the current location of something on all peers even if this location has not "arrived" yet due to latency (there is probably a very nice word that describes what i just said, I just don't remember it).

This "smoothing" is possible to do "on top of" gnet but gnet itself does not handle these issues.


Foolish(Posted 2008) [#25]
I think the word Raknet uses to describe it is interpolation. The math around that is pretty easy. So provided the message is sent with a timestamp, I ought to be able to figure it out.

Thanks for getting back so quickly. I'll try out your code as soon as I can so I you can get some timely feedback - probably tonight.