RakNet Wrapper 0.5 Released
Blitz3D Forums/Blitz3D Userlibs/RakNet Wrapper 0.5 Released
| ||
RAKNET WRAPPER 2.483 VERSION RELEASED: Well, The Wrapper is growing good! It Includes: - All Server Functions - All Client Functions - All BitStream Functions - All Statistics Functions Decls file is not commented, because it is generated automatically using Flex for Windows. RakNet Free Wrapper Download: www.lcuriel.arrakis.es/raknetwrapper2483.rar Buy the Source Code of the Wrapper (2.483) from: www.lcuriel.arrakis.es/raknet Price: 20€ If you find useful this library, and you want to donate, please visit: www.lcuriel.arrakis.es History: 0.5 (26-08-05): Initial Release 0.6 (27-08-05): Added Index Player and better test.bb 0.65 (28-08-05): Added Kick player and manual kick in test.bb 0.75 (07-10-05): Updated to the 2.4 official version. 0.76 (5-12-05): Updated to the 2.415 official version. RakNet Official Web: www.rakkarsoft.com The .bb test included is too basic, please someone makes a better one! And the best thing: IT IS FREE! (For commercial you only need permission) Cheers, KuRi. |
| ||
Great!! Nice work KuRiX. And thanks.. /Alienforce |
| ||
I think that Surreal won't update BlitzPlay anymore, and this library offer ALL the functions that BlitzPlay has and much much more!. So let's test it to make it work perfectly! I suggest you to download the free version of Raknet that comes with samples in C++ that are very easily adapted to my wrapper. I am now trying to connect and disconnect players, use passwords, update positions, etc... and is working perfectly! |
| ||
Hi Kurix, Looks like a great looking api, so I'm going to download and check it out. thanks |
| ||
I am going to change my blitzplay network code to this, to see if it is good. This is why i have made the wrapper. But please, if you make good tests, please let me know how it is... (faster, reliability, etc...) EDITED: New 0.6 version Released, including the function RN_PacketGetPlayerIndex to know the index of the Player. Anyway the automatic index of raknet seems not to work perfectly and in the forums say that you must use your own. Link: www.lcuriel.arrakis.es/RakNet0.6.rar Now the help files are included in the rar file too. And the Test.bb file has more msg support for testing! |
| ||
hope you didn't plan this as your next userlibs product :( |
| ||
3cho, i don't understand your post. This is a free wrapper i am doing for personal use but i want to share with all b3d users (future versions too). I want this to be the best udp multiplayer library for b3d. And kode is not an userlib product. I think i don't understand what you mean :( |
| ||
Thanks for the update Kurix. I wish you'd offer a zip too. 8) |
| ||
lol, sorry i mean your [K]ODE product thx for wrapper |
| ||
Thx for the wrapper, it's great! Exactly what I need. Regards - Xaron |
| ||
Hey, i have changed some things in the DLL so now you can use the internal Indexes for the players. So you can get a number from 0 to (MAXIMUMPLAYERS-1) from every packet you receive to know who has sent it!!! Changes in the 0.7 version! Great, huh? xD |
| ||
Thanks, very usefull! |
| ||
Hey, this could be useful... I'm not making any multiplayer stuff now but for future projects this would probably rock! |
| ||
Thanks a lot KuRiX for sharing your work. It seems RakNet is an excellent solution for MP stuff. Maybe you can help me so I don't have to read tons of docs first: Is this architecture using one (the first) player as the game server? And if so, is it possible to hand over the server job to a client (eg. when the hosting player wants to quit without to end the game for the other players)? |
| ||
Well, Raknet is a very very powerful library, and is still in development (so future updates will be possible). You can use a peer to peer functions, or use the in built client server functions (that uses only the peer functions). The problem is that i have not wrapped yet all the peer to peer functions, because i only needed the client server and i needed asap. Anyway there is a new version available (2.4) and i want to update the wrapper, and perhaps i will include some new functions. I must say that i am using it for client sever game and is very fast and stable! Cheers, KuRi! |
| ||
Thanks, I still don't fully understand what you mean by Client/Server vs Peer2peer. When you say you want to replace BlitzPlay then I assume it is using the same structure (one player is the host, the other players are clients). Unfortunatly BlitzPlay doesn't support taking over the server task by an other client. Well, in the old (Freeware) version of BlitzPlay it was supported, but then SurReal rewrote the entire thing from scratch with a new concept and without the mentioned support for server takeover. The reason why I want this feature is the fact that a game may last much longer when the intial host doesn't need to stay connected all the time. |
| ||
Well, in some way, Blitzplay is based on peer2peer connection too. Basically, in UDP, you have peers, that can connect to other peers. If you consider one peer as beeing the server (so it broadcasts all the messages), then it is a client/server (a client/server is always an abstract of peer2peer). So, if you use a peer2peer connection and you decide who is the server, you can of course select other host when one leaves... This is not easy to explain, but i can guarantee that you can do it (if i wrap all the peer functions of course, xD) |
| ||
Due to the incremented interest in the raknet wrapper, the library has been updated to the latest version of raknet, the 2.4 You can download the latest version of the wrapper (the 0.75) in the top of this page! enjoy! |
| ||
Thanks a lot for sharing. VERY useful work. |
| ||
Thanks KuRiX. Excellent work. |
| ||
RakNet is really much better than anything I tried yet. The seperate thread makes things very quick. Even with 3 clients onscreen on localhost it's still pretty fast. And it works pretty well together with ZoneAlarm Firewall. It asks one time (didn't even ask for server rights, surprisingly) per process. I've seen other solutions that required to lower the security level of zonealarm, or libs that used to throw a dozen of firewall alerts to the user (especially DirectPlay stuff). There are a few drawbacks, eg: the RakNet Process will be listed as a nameless process in the task manager. This may be not a problem with the XP task manager that shows the file path, unlike win98/Me that will list the process name only. Looks pretty scary when you see blank processes in the manager (especially when you have no idea what it is). And there have been a few messed up messages, like when I send a chat message and the server says "received data of unrecoginzed type" (or something). So I think it will be a good ideat to work out some acknowledge and error detection system, eg. a packet checksum. And a handshake that will allow the server to send the next packet. Now I have a dumb question (probably I shoulda know, sorry): Is this System using UDP? |
| ||
Well, here are a few answers. First of all, Raknet is only UDP. The second is, due to the first answer xD, that when a message arrives, arrives perfect. So, if you are having troubles sending chat messages i suggest you to send them like BitStreams insted of char *. FarFlame are asking lot of questions to me via email. I think that this is a best place to ask. Perhaps i will post here his emails and my answers. Cheers, KuRi. |
| ||
i'll have to check out raknet with wrapper too.... looks good in any way ;) |
| ||
I am working in a multiplayer raknet game, but i would really appreciate someone making a good raknet demo to include with my wrapper... Cheers! |
| ||
KuRiX: Great stuff! I couldnt find out wheter Rakknet is PC only, or cross-platform...Do you happen to know? If so, a module for BlitzMax could be created. |
| ||
It is multiplatform!!! Tell me how, and i will make a BlitzMax Version! |
| ||
Hi KuRiX, I'm interested to use Raknet in a future project now being conceptualised and documented, a follow-up to a multiplayer game I have been working on in the past. You'll have to write a "mod" for BlitzMax. A simple example can be found here: http://www.blitzbasic.com/Community/posts.php?topic=42128 |
| ||
ps: KuRiX, I read it is also possible to work with a "master server" or some kind. How can it be done with your wrapper? |
| ||
Mmm, interesting, so BMax can directly compile C Code! Wow!. The problem is that i don't have BMax. Anyway i think that including directly RakNet C Files will be very hard, it is programmed in hard C++. Is it possible to make a lib or dll for BMax? And about the master server, the functions are not wrapped at this moment, but should be easy to do! I will look at them for the next wrapper version... |
| ||
Hi KuRiX, If you make a DLL, you are stuck to the Windows platform. For BlitzMax development, IMHO not a wise decision. Looking at the example, they "import" a C file. You can do the same fromout BlitzMax: just import it, you don't need to touch the C files. To be honest, I lack experience on mod writing, perhaps you could ask some more experienced mod writers in the BlitzMax forums. BlitzMax is the way to go for the future. I am waiting for the official 3D module for larger projects, but I love the language and it's worth buying! I'm not investing more time to program under Blitz3D for larger projects. I have a Mac, so if you might decide to write the BlitzMax MOD, I'm happy to bugtest it for you. |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=42290 |
| ||
Well, not having BMax, i don't see like so easy job. I will think of it later... |
| ||
ok cool, I'll use Bnet instead |
| ||
Thanks for your help anyway, very much appreciated! |
| ||
Well, i have created a mini web page to download the latest version of raknet (still 0.75, very very stable). I have received some emails about buying source code for the wrapper, so i have decided to add a button to buy the source code of the Raknet Wrapper, for those interested. (Visual C++ 6.0) This could be of interest if you want to know how to develop a wrapper or if you want to add the rest of the functions to the wrapper by yourself. However the compiled wrapper will always be free. Cheers, KuRiX |
| ||
I would be also VERY INTERESTED in a version of your wrapper for BlitzMax !!!!!! And I am sure it's the case for a LOT of people out there.... |
| ||
Is not possible to use the same dll for blitzmax? I don't have blitzmax... |
| ||
Why do I keep getting a Server feed of "Unknown Message Type (Type = -1)"? I'm trying to use the example to fit my game but it's not working well. Any help? I just want to run an update for client, and a seperate update for server. The functions included that are needed is a simple chat(broadcast), Player positions (x,y,z,"yaw"), and events (ie. explosion, bullets, activated somthing, etc). Any helpers??? |
| ||
Post some basic code so i can help ;) |
| ||
That's the problem I don't know where to start. I want to use seperate Functions IE... Function Host() RakNet Here End Function Function Join() Stuff Here End Function Function UpdateClient() etc End Function Function UpdateServer() etc End Function |
| ||
Well, let's begin: Host: ; Initialize the server. Global Server=RN_GetRakServerInterface() ok=RN_ServerStart(Server,8,0,0,60069) Join: ;Initialize the client ip$ = "localhost" ; CHANGE THIS TO THE SERVER IP Global Client=RN_GetRakClientInterface() RN_ClientConnect(Client,ip$,60069,0,0,0) UpdateClient: ServerUpdate: This is only a sample of what you should do. It uses BitStreams instead of Strings (much much better). And please note that only internal messages are broadcast by server automatically. User messages (50-255) must be broadcasted manually. Post any question you have here. Cheers. |
| ||
Very useful, thanks a lot! Now I only need to use Gnet instead of "localhost". |
| ||
Good stuff! But where do I add the player position codes. |
| ||
Ok, suppose you want to send the x,y,z to the server, and then you want the server to broadcast this position to the rest of the players...;Make a Global BitStream instead of once every time Global BitStreamOut=RN_BitStreamCreate1(0) ID_POSITION_UPDATE = 60 (for example) Function SendPosition(entity) RN_BitStreamReset(BitStreamOut) RN_BitStreamWriteUnsignedChar(BitStreamOut,ID_POSITION_UPDATE) RN_BitStreamWriteFloat(BitStreamOut,entityx(entity)) RN_BitStreamWriteFloat(BitStreamOut,EntityY(Entity)) RN_BitStreamWriteFloat(BitStreamOut,EntityZ(Entity)) Ok=RN_ClientSend2(Client,BitStreamOut,NORMAL_PRIORITY,RELIABLE_ORDERED,0) End Function Now in the receiving loop of the server: ;Make a Global BitStream instead of once every time Global BitStreamIN=RN_BitStreamCreate1(0) ID_POSITION_UPDATE = 60 (for example) while (packet) ; bla bla bla BitStreamIN=RN_BitStreamCreateFromPacket(packet) MessageID=RN_BitStreamReadUnsignedChar(BitStreamIN) Select MessageID Case ID_POSITION_UPDATE X#=RN_BitStreamReadFloat(BitStreamIN) Y#=RN_BitStreamReadFloat(BitStreamIN) Z#=RN_BitStreamReadFloat(BitStreamIN) ;Here you update the local position ;Now BroadCast RN_ServerSend2(Server,RN_BitStreamIn,HIGH_PRIORITY,RELIABLE_ORDERED,0,RN_PacketGetplayerID(packet),1) As you can see i use always bitstreams for the sending and receiving, and it is the way you should do it. There are lot of other ways of doing this, but this is an example. Good Luck, and don't forget to read the documentation in the raknet official site! |
| ||
I got a MAV on the RN_ServerSend2 part |
| ||
- Be sure to have initialized the BitStreamIN Variable with RN_CreateBitStream1. - Be sure that the Server Variable of the sample is the ServerInterface you have declared before! And please, do not copy paste the code to avoid possibly typos in my code... |
| ||
oops. |
| ||
working now? |
| ||
Slowly. Maybe It's cause Im running seperate clients and servers on the same system. |
| ||
I have been running multiple clients and servers on one machine with no problem. Make sure you set the threadpriority to some value greater than zero so the thread is not cpu intensive... 10 could be a good value! ;) P.D: Raknet 2.412 has been released. I will update the wrapper soon! |
| ||
As i promised... Raknet Wrapper is now updated to the 2.415 version. 2.413 and 2.414 were bad updated. So, although this is supposed to be a good update, please make a copy of all your actual projects before updating! Latest Version: www.lcuriel.arrakis.es/RakNetWrapper0.76.rar P.D: for those who bought the source code, if you are interested in the latest version, please email me (i don't send it automatically because i suppose they have changed everything already...) |
| ||
Well, there are problems with Raknet Versions greater than 2.402 so i am going to stop updating the wrapper until a new stable version comes out... If you want to use raknet wrapper get the 0.75 version of the wrapper (corresponding to the raknet version 2.402). It is a very very stable version with all the features in it... I am going to release a commercial project soon and i will be using that version. Newer versions are getting very buggies. I hope Rakkar will take care with the bugs he is inserting due to fast releases... |
| ||
KuRiX: GREAT wrapper, Raknet! Onward to BlitzMax :-) Hint hint :-) |
| ||
Look's good, I've downloaded it and will give it a go tomorrow, Viper from the JV-ODE Physics Thread Recomened raknet. should make a great team. O yes If you need Physics I would be happy to recomend JV-ODE or for the Thread JV-ODE Thread |
| ||
Yes, RakNet is very good, and now is free for NON commercial use (visit www.rakkarsoft.com for commercial licenses)... I have updated the wrapper to the latest version, that is working perfectly (2.484). If you are interested i can release it (if i get permission from rakkar). |
| ||
I have started playing with network stuff. And had a go with it last night. Raknet is pretty good, and this wrapper is quite swell :) Just one thing, as this is my first Userlib. Is there spesific place to put the help files so that when you press F1 twice it opens the docs for the function? |
| ||
The docs i attach with the wrapper are the original docs for raknet. I have not made a help file for every raknet wrapped command... So you just put it wherever you want... because blitz3d will not automatically go to the help file... |
| ||
Release new version if you can, please :) |
| ||
Its always good to have the latest version. |
| ||
Ok ok... here it is. This version is not backward compatible, or at least the file named raknet.bb (the only part not compatible is the packet enumerations). So check if you have correct numbers assigned to user packets. www.lcuriel.arrakis.es/raknetwrapper2483.rar Enjoy! |
| ||
I tried that version (2483) and it crashed blitz with the test.bb's. Freezes and the window goes white, when the server is being initialised. I went back to 075 and it worked fine again. |
| ||
The test.bb file is not updated... but the new version works perfectly. I will try to update it later... |
| ||
Coming back to BlitzMax and Raknet: it would be very nice to use Racknet with BlitzMax, this library seems so good!! I am really not an expert, but I think we could use directly the source code of RackNet into BlitzMax, without the need for the dll (so that everything is cross-platform). In the IDE, in the section "Language", there is a subsection "Advanced topics" which deals with importing C++ code... Do you guys think it will be possible/easy to do that with Racknet?? Reading this BlitzMax help, I see "Methods declared in an extern type must be declared virtual in the C++ class. " It seems it's a big limitation for wrapping RackNet. Any thoughts? |
| ||
well have a go RepeatUntil. The C++ source is avaliable on thier website. |
| ||
I don't have blitzmax, and i have no much time now to investigate, but should be easy, with a little tricks... |
| ||
So after some research, I conclude that it won't be easy to wrap RackNet for BlitzMax. It is possible, but it will require some non negligible work (and, no, I am not candidate ;-) Racknet is written in C++ with objects and BlitzMax is able to import *only* methods which are virtual. Of course, none of the method in RackNet are virtual, so it's impossible to import directly the functions/methods. So one of the solution is to wrap in C the C++ method. In fact in the C function you have to make a call to the method in C++ (see mod/Pub.Mod/freeAudio.Mod for an example of what I mean). So every functions that you want to export, you need a C function that wraps it. And then BlitzMax is able to call directly this function. But this is a lot of work... I am not a wrapper expert at all, so are other confirming what I just said?I would be happy that someone prove me wrong... |
| ||
It is very possible that you are right, repeatuntil. Then, you would need to wrap all c++ functions into a c library, just like my wrapper. Why can't you use the same dll i have made? Can't blitmax use dll's the same as with blitz3d? |
| ||
Yeh, you can use the same DLL in BlitzMax Kuri ;) RepeatUntil was talking about including the C/C++ source directly (as a module) instead of using a DLL, so that it would work cross-platform. Using DLLs in BlitzMax will of course only work on the Win32 platforms. Good luck with the Granada Racer, its release can't be far away now :) |
| ||
Yes, VIP3R said it all: we have to include the c/c++ code so that it's cross-platform. Using your dll will lose this feature, and that's something we don't want to lose in BlitzMax. BUT now I realize that you already did the job for BlitzMax, Kurix!! I guess you wrapped all c++ functions into c functions, getting rid of object. So that's exactly what BlitzMax need to have, and include that directly into BlitzMax (and then just make an extern statement to declare functions). So I think the wrapper for BlitzMax is just around the corner with a little extra work, using the wrapper of Kurix. Kurix, would it be possible that you show us one or two functions (the code in C) you have wrapped, just to make sure your code will work with BlitzMax. I know that the wrapper code is not free, but I would like just to see 2 functions to see if that would fit..... By the way, stupid question: you used visual C++, but of course one could re-use your code using devcpp?? Thanks! |
| ||
Well, wrapping Raknet is an easy job, but you need to make some little tricks, as i commented before, for example to use the UNASSIGNED_PLAYER_ID struct as C. Two samples of the wrapper: and of course don't forget to include all the header files and the raknetstaticlib! |
| ||
Thank you very much, Kurix! So the conclusion is that RackNet could be wrapped in BlitzMax without hundreds of hours of work. And it seems that the wrapper that Kurix already wrote would work perfectly for BlitzMax, with little modification (if Kurix agrees that someone use his wrapper for BlitzMax, after paying the 20$ for the source). RackNet, the best networking solution, would be cross-platform for BlitzMax!! That would be neat!! But now the question: who would like to do the work???? (noooo, I am not candidate by terrible lack of time) |
| ||
But then... in blitzmax, you can import all the raknet source and then, with a wrapper .cpp you can call them? Well, i have no time now, but in two months i could check it ;) |
| ||
But then... in blitzmax, you can import all the raknet source and then, with a wrapper .cpp you can call them? Basically, I see things like this: - import in BlitzMax the wrapper you did, without any modification (I hope!) - In this blitzMax file, add an extern..end extern command where you declare all functions you want to use (The equivalent of the .decls file for BlitzBasic) - That's it! So, it seems to me that this work could be pretty simple, like a couple of hours...... But I am sure a lot of issues will arise, and that won't be so simple... That said, after you could go further, and wrap in BlitzMax the C function to use BlitzMax type to have object orientation!! But that's another level of complexity, and I am not sure it would be useful! This is the example taken from the help file of BlitzMax: //----- file: c_funcs.c ----- int Doubler( int x ){ return x+x; } '----- file: app.bmx ----- Import "c_funcs.c" Extern Function Doubler( x ) End Extern Print Doubler(10) Well, i have no time now, but in two months i could check it ;) But you told us you haven't BlitzMax?! Let's see if someone would be interested to do that, if not, then we all count on you in 2 months!!!!! |
| ||
I guess i will buy it, sooner or later, and two months is a good time to decide! |
| ||
On the site of RackNet, I read this: Use the source or a DLL? RakNet includes the source and a pre-made DLL, along with sample projects to make a DLL, use a DLL, and use the source. You may use either in your game. During development, you will probably want to use the source so you can trace into the code for better control. During release, you will probably want to use a DLL so you don't have to make your game multithreaded, and for easier patching. In BlitzMax, we will use the source of course (from cross-platform). But then I am worried by the fact that including the source means that the game will be multithreaded!! Is it compatible with BlitzMax?? If BlitzMax is not tread-safe, is it not a show-stopper?? Thanks to give opinion on that... |
| ||
Anyway... why not using a dll just like with blitz3d? |
| ||
Because we want to have Racknet on all 3 platforms supported by BlitzMax (Windows, Linux and Mac). A dll is only for windows. If you include the source, since Racknet is already multi-platform, you will have automatically the "auto-platformity". And this is very important for BlitzMax users to use lib which are multiplatform, this is always a plus. So I don't see other solutions, other than including the source. But then I am not sure if the multithread is a problem for BlitzMax.... |
| ||
I opened a new discussion in the BlitzMax forum, to get attention of BlitzMax users (and some opinion): http://www.blitzmax.com/Community/posts.php?topic=59325 |
| ||
Thanks to Farflame i have detected that i had not updated the raknet.bb file in the last wrapper! so it wasn't working at all!!! Now is fixed. Download it and enjoy Raknet! (and remember, free for NON commercial use). |
| ||
Any news about this wrapper ? :) |
| ||
yeah, good question... |
| ||
dead project I believe .... we could do with someone taking the lead on this and rolling us a wrapper for RakNet v3.0. hint hint anyone ? :) Saying that the wrapper is perfectly functionaly (well coped with everything I needed) |
| ||
Here is the wrapper converted for blitzmax, but i get problems with samples ;/ |
| ||
Is Kurix still around here? |
| ||
i just wanted to reanimate this thread... is kurix alive? |
| ||
As said in another thread, I will post a wrapped version of RakNet 3.0 (the latest RakNet version). This will be for BlitzMax, but then somebody can write a decls file (not me). More news later... |
| ||
good to hear!! |