RakNet wrapper for Blitz (open source project)

Community Forums/Showcase/RakNet wrapper for Blitz (open source project)

RepeatUntil(Posted 2007) [#1]
Hi,

The wrapper of RakNet version 3 is now out for BlitzMax!!
RakNet is a VERY powerful network library, with a lot of possibilities (see here).

This wrapper works for all versions of Blitz (BlitzMax, Blitz3D, BlitzPlus). Note that this is windows only unfortunately.

The wrapper is open source and any improvement is very welcome. If you modify the wrapper, please send me the updated file. Of course, the wrapper is free.

The wrapper could also be extended, since only a fraction of RakNet has been wrapped. I have almost no time to program now, so do not count on me!

You can download it here: http://repeatuntil.online.fr


Filax(Posted 2007) [#2]
Good job repeat :) clear code :)


Stu_ovine(Posted 2007) [#3]
Fantastic stuff !


chi(Posted 2007) [#4]
great work... would be nice to see this for blitz3d ;)


Brucey(Posted 2007) [#5]
Note that this is windows only.


Isn't it a cross-platform network library??


ImaginaryHuman(Posted 2007) [#6]
I guess the wrapping part of it is windows only?


RepeatUntil(Posted 2007) [#7]
It is cross platform. So in my initial try, my goal was to include directly the source in BlitzMax. But unfortunately, it was not possible because RakNet is threaded, and BlitzMax was crashing due to the threading in RakNet.
In the end, in front of this big difficulty, I had no choice but use a dll, hence windows only. I was the first disappointed!!

Please test this wrapper, as I am not sure everything works correctly...


Apprauuuu(Posted 2007) [#8]
It looks great but I have a question...
It should support a p2p network.
What I have to change in the example to make such a network?? All players have to connect to each other like the client to the server does or how I have to deal with that??


RepeatUntil(Posted 2007) [#9]
Yes, RakNet supports both client-server and peer to peer architecture.
I am not at all an expert of RakNet, but I think you should do basically like in the example I give, but set the maximum number of connection to 1 for everyone.
I am sure this question was asked on the RakNet forum, or is maybe in the manual: please have a look there: RakNet site.


RepeatUntil(Posted 2007) [#10]
Did some people here try to test the wrapper? Is this working as expected? Do you plan to include it in one of your project? Or even to improve the wrapper??


North(Posted 2007) [#11]
I tried the examples you provided which work beautifully.
No in-depth testing yet but this ranks high on my personal list of BMX network libraries taken into consideration :)


Stu_ovine(Posted 2007) [#12]
Same here - initial tests are working -I had to add the stream calls (as I extensively use those).

More to follow as Im planning another multiplayer game over the coming months.


RepeatUntil(Posted 2007) [#13]
Hi,

just to let you know that one user of the wrapper (Andy) did some change to the wrapper.


I have made a slight alteration to the Raknet.bmx file so it can compile in SuperStrict mode in BlitzMax. Nothing else has been altered.
Andy



Thanks very much to Andy! The updated files can be downloaded from my sig.


_33(Posted 2007) [#14]
Blitz3D version: http://www.blitzbasic.com/Community/posts.php?topic=50546


RepeatUntil(Posted 2007) [#15]
Yes, but this is with an older version of RakNet (2.xx). That would be nice if someone (who needs it) could write the decls file to adapt the wrapper. This is an easy task (I won't do it since I have unfortunately no time for programming now).


Retimer(Posted 2008) [#16]
Sorry to bring up a 2 month old topic; but has anyone managed to get raknet working with BM on other operating systems yet?

Not asking for a public release of it; just a response on whether it has been done.


RepeatUntil(Posted 2008) [#17]

Sorry to bring up a 2 month old topic; but has anyone managed to get raknet working with BM on other operating systems yet?



No, nobody is working on that. As I said in a previous message in this thread, I did an attempt, but failed miserably because BlitzMax doesn't work well with a threaded library...

By the way, RakNet is now available for Blitz3D/Plus. See another message in the same forum (sorry for the double post!).


Trader3564(Posted 2008) [#18]
How do i install RackNet for BlitzMax?


RepeatUntil(Posted 2008) [#19]
That's simple:
- put the RakNet dll file in a folder
- put the RakNet.bmx file in the same folder
- put the example file in the same folder (or your program)
- that's it!

Hope it helps...


Amon(Posted 2008) [#20]
Will this work for Truevision3D?

What I want to do is use BlitzMax with Gabriels TV3D wrapper and have network capabilities with Raknet?

Possible? I'm new to all this network stuff.

Ta for this by the way! :)


Retimer(Posted 2008) [#21]
I doubt this is a bug, but it seems the packet delimiter for each udp packet is chr(0). Is this default in raknet? Is there any way to change that without altering the source?

It doesn't seem possible to use stream-styled packets with this in the way.


Gabriel(Posted 2008) [#22]
Amon: I haven't looked at RakNet, but I don't see any reason why not. TV doesn't have any Net stuff at the moment ( and when it does, it will be a separate dll ) so there should be nothing in place which would conflict.


RepeatUntil(Posted 2008) [#23]
Yes, RakNet would work with TrueVision3D, it will just be simply another call to the RakNet dll, no problem with that.

For the chr(0) in the udp packet, I don't know. What I know is that you can send message in 2 ways: either conventionnal one, either bitstreams. Maybe bitstreams is what you want?? Please refer to the RakNet web site for details (http://www.jenkinssoftware.com/) as unfortunately I am not at all an expert.


Retimer(Posted 2008) [#24]
Thanks repeat. I wish I did that before playing around with the conventional method for several hours :'(.

Bitstreams are amazing! Thanks for this wrapper.

Bitstream functions for anyone who needs them:

In RakNet.bmx (RepeatUntil's)
Replace
' BitStreams are wrapped. If you need them, add the functions here!


With




Trader3564(Posted 2008) [#25]
Retimer, what are you working on? online game?


Retimer(Posted 2008) [#26]
A few seperate projects linking to the same thing. A developers network engine.

Basically an engine that will allow people to create games/applications for my company Lobby (sorta like Steam:halflife engine, but currently only supporting 2d sidescroll/isometric games & applications) with easy tools that will allow multiple people to work on projects at the same time;Multiplayer map editing, game data [database] creations, etc. The end goal is to create an engine that people can easily 'ship and go' applications&games within the lobby, update at anytime (or even real-time), and charge subscriptions+create revenue from it through the company.

It's completely experimental. Sorry for going off-topic repeat. I wish I could just use Private Messages.


ImaginaryHuman(Posted 2008) [#27]
Sounds like what I'm working on too :-D


ImaginaryHuman(Posted 2008) [#28]
What is a bit stream, like a regular byte stream but you can access any number of bits?


Retimer(Posted 2008) [#29]
Yes. Booleans can actually be sent as a single bit, rather than 8 bits (1 byte).

I don't completely understand its architecture yet, but it also can uses some form of compression by including the number of 1's/0's in order. Lets you send chr(0)'s (as to optimize by using stream methods of writeByte,WriteShort,etc).

I've discovered though, that it's very important to create the streamsize to exactly what you are going to use. I also have had some trouble sending a single letter with bitstreamread/bitstreamwrite, but the work around is to tell it that the length is 2, or simply send a single char.

I have provided a bitstream example below (A redo of the conventional method provided by repeat, in bitstream). However since it was my first hour of playing with bitstreams (ever), i'm sure there are some things that can be fixed. It should at least give an idea though. I have commented my beliefs on how a lot of it works.
I also added a couple extra things to make it more like a real chat program. You can enter your screenname if you are a client. It also shows you bits and bytes sent.

Make sure you have added the bitstream commands to RakNet.bmx. I have showed how to add them in my above post.




The raknet site claims bitstreams are much easier to cause issues, but I tested this example on a host 1000 miles away and tested sending probobly a hundred messages, all which arrived correctly. I believe they just meant that it's prone to make human error mistakes as it's more complicated to use, which can easily be worked around once you throw together a few functions to help yourself out.

Also, if anyone would like to improve or work on a new example using more of raknets features (There's so many!), i'de love to take part.

Cheers.


RepeatUntil(Posted 2008) [#30]
Retimer: Many thanks for your contribution! I will add the bitstreams to the wrapper, so that anybody can have it automatically. If you don't mind, I will also add your example in the package...

That's true that there is a lot of functions which were wrapped, but not put in the RakNet.bmx file or in the decls file, thanks for noticing this! You can find all the functions wrapped in the development version available on my website, in the file RakNet.cpp. For the curious people, here is this file:



Retimer(Posted 2008) [#31]

Retimer: Many thanks for your contribution! I will add the bitstreams to the wrapper, so that anybody can have it automatically. If you don't mind, I will also add your example in the package...



Not a problem, and please do. I'll probobly be improving that example (I think there's better methods) or coming out with new ones as I progress with RakNet..it's a learning experience. I'm also working on a new type structure for making work with most RakNet functions easier than working with blitzmax' socket streams. I'll throw it in a codebox once i'm done.

I really do appreciate your contribution of this wrapper though. TCP has been boring me for a while now =P.


RepeatUntil(Posted 2008) [#32]

I really do appreciate your contribution of this wrapper though.


Happy to see it is useful! Note that 90% of the work was done by Kurix, who wrapped a previous version of RakNet. I just adapted his wrapper to the new version of RakNet (v3) (although that was not so easy due to a lot of changes).

This wrapper is in the community domain (I have no time now to program anymore - and I even don't use the wrapper myself!), and it's not at all my property. Any contribution is more than welcome. Even the wrapper could be extended if needed. For example, you have a voice communication plugin with RakNet, I don't know if this is possible to wrap, but that would be really cool!!
Anyway, I will try to maintain an up-to-date version of the wrapper on my web page. So thanks for these improvements!


Retimer(Posted 2008) [#33]
-edited.

Will post a better version later.


smilertoo(Posted 2008) [#34]
I'm getting an error :(

Compile Error
Identifier 'CompressedPackets' not found


Retimer(Posted 2008) [#35]
. (removed)


Retimer(Posted 2008) [#36]
Repeat, can you please check something.

I don't believe RN_GetSystemAddressFromIndex is working properly. I have tried many routes trying to send data to specific players (non-broadcast) and have never got it to work properly. When broadcasting everything works flawlessly, but to specific players I either get nothing, or a message every once and a while (using different methods other than the one below)

Could you check it out?

Example: (uses maxgui)




Run 1 server, and 2-3 clients. As the server, select a client from the player list to send a message to. I'm getting nothing =(

ps. you need to click send to send the message, enter doesn't work.


RepeatUntil(Posted 2008) [#37]
OK, I have added the functions added by Retimer for the bitstreams. I have also added his example about bitstreams.
Also, Paco gave me an example for the Blitz3D version.
Thanks to these 2 contributors!

Download again (see my sig) to get the updated version.

Retimer: you deleted some nice package from your previous posts. When you feel they are good enough, don't hesitate to send it to me so that I can add it also in the package...

Retimer (bis): for your question -> I can not test your example because I have not maxGUI. Anyway, I tried to modify something in the wrapper (I am always confusing & and * in C++, what a shame!). I do not promise it will work, but please give it a try... The dll is updated with this "fix", please download it again...


Retimer(Posted 2008) [#38]
Thanks!

I temporarily removed the framework because of this bug (If it is infact a bug).Unfortunately I don't think the issue was fixed in this update. I really wish I could help, but it's probobly beyond me.

RN_GetSystemAddressFromIndex still seems to be returning the same address, no matter which client I am trying to send data to. I'll try to come up with a simple non-maxgui example with comments to show you within the next day.

A bit of extra info:

RN_GetSystemAddressFromIndex(peer,RN_PacketGetplayerIndex(Packet))
RN_PacketGetSystemAddress(packet)

both seem to return different values, but those values never change no matter which client is sending data to the server, so it seems impossible to determine the address of specific clients.


Retimer(Posted 2008) [#39]
Function ServerConnectionCount%()
	Local count = 0
	For Local i = 0 To nbPlayerMax
	If RN_GetSystemAddressFromIndex(peer, i) <> -1  count = count + 1
	Next
	Return count
End Function


in fact, that's always returning as positive in the new dll.


Retimer(Posted 2008) [#40]
Example showing that packets recieved from different clients returns the same address:




I'm pretty certain that the only issue right now is with getting the proper address from clients. Everything else has worked out great when I applied raknet to my main project.

By the way, when sending data to a specific client using RN_GetSystemAddressFromIndex, it seems to always send only to the last player that connected. Hopefully that helps.

Time


Edit: noticed this as well in RakNet.cpp

return &packet->systemAddress;



return &rakPeerInterface


The '&' sign in those have any significance? Or is that what you had just changed in the last update?

Sorry if i'm pushing your patience with this.


RepeatUntil(Posted 2008) [#41]
OK, thank you for the example. I am not a C++ expert, and I am always confused about addressing (&, *, ...). Yes, I added a &rakPeerInterface in the wrapper, but apparently that didn't help. Any C++ expert out there to give me a clue? (the file RakNet.cpp is given in one of my post in the above).
Anyway, I will try to see what I can do for this bug. Unfortunately, that could be only in a few days that I could look at this problem, sorry about that.
Stay tune for news or pray that a C++ expert read this thread and be kind enough to look at the problem!


Retimer(Posted 2008) [#42]
I've gone through the source code of almost all of raknet. I have manipulated the raknet.cpp source in several ways and still could not find the problem (hairloss).

I think I may have found a solution by having a rakpeerinterface for each client connecting to the server though, much like tcp arrayed socket streams. I'll test it further and get back to you when/if I have a working example. Should be soon as I really want to get this working. (Master Server Method).


Retimer(Posted 2008) [#43]
Woohoo.

Works fine. I'm not sure if it's the best way for handling specific connections, but it works! Unfortunately, I dont have a non-maxgui example of this, since graphic ui takes up a hell of a lot more code and time.

It's not heavily commented but most of it is straight forward, and i'll be continuing my raknet framework to make things easier.

Hopefully Repeat will have more luck in finding the fix (if there is one..we don't know)

Example: (using maxgui)


A master server is created, which created on port <x> up to port <x+PlayerCount>. When you connect to the master server, it tells you an available port to connect to.

Advantages: It works.

Disadvantages:
-You may need to open a lot of ports manually if your configuration control panel sucks.
-High player count = longer initial loadtime.
-May not be as efficient, but this may actually be the only possible way, we don't know yet. I have not tried running it in a live environment yet, but there's no reason it can't.
-Some clients may need to allow a long list of ports to open, but that shouldn't be the case.

Also, the example does NOT handle disconnections / reconnections at all.

Cheers


RepeatUntil(Posted 2008) [#44]
OK, great you have a workaround. I will still try to debug the problem myself with the wrapper. The problem is that I am really busy with other non programmatic stuff, so go ahead with your method for now...


Loktar(Posted 2008) [#45]
Can you use the voice streaming with this? I know Raknet supports it just wondering if all the stuff is defined in the decls and everything. Im a userlib n00b...

Actually this is a question meant for the Blitz3d one... got the threads mixed up.


Retimer(Posted 2008) [#46]
Edit:
I believe the necessary files need to be added to the source, and probobly altered a bit. Until then, no rakvoice commands will work with the wrapper.

Repeat has included the source, so i'm sure if more people throw some time into this we could get a fully operational RakNet wrapper going.


RepeatUntil(Posted 2008) [#47]
Implementing the voice into the wrapper would be great!! I don't know if it is possible or not, one should try. I let this to other people as I don't program much now...


Stu_ovine(Posted 2008) [#48]
Hmmmm I remember a similar problem with playerIndex/IDs in Kurix incantation of the wrapper.

The workaround for that was to grab the clients ID when they first connected and just use that (rather than on each packet they send) This is not the case now.

Looking at the current wrapper, Im thinking its because SystemAddress is not being passed correctly (as it contains both the Address and the port ? )

I would have a play but when I compile using DEv C++ v4 theres all sorts of compiler errors .... :S


squareiris(Posted 2008) [#49]
Windows only = game over :/


Kev(Posted 2008) [#50]
fixed version of the .dll can be downloaded here, the fix handel's SystemAddress correct.

http://www.whitegatesoftware.com/RakNet.zip


Stu_ovine(Posted 2008) [#51]
Nice one Kev !!!

Can you send the updated source to RepeatUntil - nice to keep it upto date.


t3K|Mac(Posted 2008) [#52]
thats great. i am near the point where i add UDP-network stuff to my game using this lib.

thats a community!


Stu_ovine(Posted 2008) [#53]
Another couple of little changes. Passing strings to and from the wrapper are currently 'borked' as the string passing has to be specified with $z not :string.

To send strings via the stream I always use
RN_BitStreamWriteUnsignedChar(), this elimiates the need to send individual chars from your string one at a time.

example:-
RN_BitStreamWriteUnsignedChar(OUTStream,Len(oString))
RN_BitStreamWrite(OUTStream, oString ,Len(YourName))


Heres an updated Raknet.bmx

'------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------
'- Raknet wrapper for BlitzMax. This wrapper was originally developped by Kurix for       -
'- Blitz3D, adapted to RakNet 3 and BlitzMax by RepeatUntil.                              -
'- This wrapper is open source, and could be modified by anyone who would like to         -
'- improve it. This is a project who should benefit the whole Blitz community, so please  -
'- send all improvements to repeatuntil@... (to upload on a web site).                -
'------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------


Global lib:Int = LoadLibraryA("RakNet.dll")

Global RN_GetRakPeerInterface%()"Win32" = GetProcAddress(lib, "RN_GetRakPeerInterface@0")
Global RN_DestroyRakPeerInterface%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_DestroyRakPeerInterface@4")

Global RN_Startup%(rakPeerInterface%,maxConnections%, _threadSleepTimer%, localPort%)"Win32" = GetProcAddress(lib, "RN_Startup@16")
Global RN_IsActive%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_IsActive@4")
Global RN_GetMaximumNumberOfPeers%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_GetMaximumNumberOfPeers@4")
Global RN_SetMaximumIncomingConnections(rakPeerInterface%,numberAllowed%)"Win32" = GetProcAddress(lib, "RN_SetMaximumIncomingConnections@8")
Global RN_GetMaximumIncomingConnections%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_GetMaximumIncomingConnections@4")
Global RN_Connect%(rakPeerInterface%,host$z,serverport%,passwordData$z,passwordDataLength%)"Win32" = GetProcAddress(lib, "RN_Connect@20")
Global RN_Shutdown(rakPeerInterface%,blockDuration%)"Win32" = GetProcAddress(lib, "RN_Shutdown@8")
Global RN_CloseConnection(rakPeerInterface%,target%,sendDisconnectionNotification%)"Win32" = GetProcAddress(lib, "RN_CloseConnection@16")
Global RN_GetConnectionList%(rakPeerInterface%,remoteSystems%,numberOfSystems%)"Win32" = GetProcAddress(lib, "RN_GetConnectionList@12") 
Global RN_Send%(rakPeerInterface%,data$z,length%,priority%,reliability%,orderingStream%,systemAddress%,broadcast%)"Win32" = GetProcAddress(lib, "RN_Send@32")
Global RN_SendBitStream%(rakPeerInterface%,bitStream%,priority%,reliability%,orderingChannel%,systemAddress%,broadcast%)"Win32" = GetProcAddress(lib, "RN_SendBitStream@28")
Global RN_Receive%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_Receive@4")
Global RN_DeallocatePacket%(rakPeerInterface%,packet%)"Win32" = GetProcAddress(lib, "RN_DeallocatePacket@8")

Global RN_GetInternalID%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_GetInternalID@4") 
Global RN_GetExternalID%(rakPeerInterface%,target%)"Win32" = GetProcAddress(lib, "RN_GetExternalID@12") 
Global RN_PingPlayer(rakPeerInterface:Int,systemAddress:Int)"Win32" = GetProcAddress(lib, "RN_PingPlayer@8")
Global RN_PingHost(rakPeerInterface:Int,host$z,remotePort:Int,onlyReplyOnAcceptingConnections:Int)"Win32" = GetProcAddress(lib, "RN_PingHost@16")
Global RN_GetAveragePing%(rakPeerInterface:Int,systemAddress:Int)"Win32" = GetProcAddress(lib, "RN_GetAveragePing@8")
Global RN_GetLastPing%(rakPeerInterface:Int,systemAddress:Int)"Win32" = GetProcAddress(lib, "RN_GetLastPing@8")
Global RN_GetLowestPing%(rakPeerInterface:Int,systemAddress:Int)"Win32" = GetProcAddress(lib, "RN_GetLowestPing@8")
Global RN_SetOccasionalPing(rakPeerInterface:Int,doPing:Int)"Win32" = GetProcAddress(lib, "RN_SetOccasionalPing@8")
Global RN_SetOfflinePingResponse(rakPeerInterface:Int,data$z,length:Int)"Win32" = GetProcAddress(lib, "RN_SetOfflinePingResponse@12")
Global RN_GetNumberOfAddresses%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_GetNumberOfAddresses@4")
Global RN_GetLocalIP$z(rakPeerInterface:Int,index:Int)"Win32" = GetProcAddress(lib, "RN_GetLocalIP@8")
Global RN_GetIndexFromSystemAddress%(rakPeerInterface:Int,systemAddress:Int)"Win32" = GetProcAddress(lib, "RN_GetIndexFromSystemAddress@8")
Global RN_GetSystemAddressFromIndex%(rakPeerInterface:Int,index:Int)"Win32" = GetProcAddress(lib, "RN_GetSystemAddressFromIndex@8")

Global RN_GetUNASSIGNED_SYSTEM_ADDRESS%()"Win32" = GetProcAddress(lib, "RN_GetUNASSIGNED_SYSTEM_ADDRESS@0")
Global RN_GetUNASSIGNED_NETWORK_ID%()"Win32" = GetProcAddress(lib, "RN_GetUNASSIGNED_NETWORK_ID@0")
Global RN_GetTime%()"Win32" = GetProcAddress(lib, "RN_GetTime@0")


Global RN_PacketGetData$z(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetData@4")
Global RN_PacketGetBitSize%(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetBitSize@4")
Global RN_PacketGetplayerIndex%(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetplayerIndex@4")  ' Server only according to RakNetTypes.h
Global RN_PacketGetSystemAddress%(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetSystemAddress@4")
Global RN_PacketGetBinaryAddress(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetBinaryAddress@4")
Global RN_PacketGetPort(packet%)"Win32" = GetProcAddress(lib, "RN_PacketGetPort@4")
Global RN_SystemAddressGetBinaryAddress%(systemAddress%)"Win32" = GetProcAddress(lib, "RN_SystemAddressGetBinaryAddress@4")
Global RN_SystemAddressGetPort%(systemAddress%)"Win32" = GetProcAddress(lib, "RN_SystemAddressGetPort@4")


Global RN_InitializeSecurity(rakPeerInterface%, pubKeyE$z, pubKeyN$z, privKeyP$z, privKeyQ$z)"Win32" =  GetProcAddress(lib, "RN_InitializeSecurity@20")
Global RN_DisableSecurity(rakPeerInterface%)"Win32" =  GetProcAddress(lib, "RN_DisableSecurity@4")
Global RN_SetIncomingPassword(rakPeerInterface%, passwordData$z, passwordDataLength%)"Win32" = GetProcAddress(lib, "RN_SetIncomingPassword@12")
Global RN_GetIncomingPassword(rakPeerInterface%, passwordData$z, passwordDataLength%)"Win32" = GetProcAddress(lib, "RN_GetIncomingPassword@12")

Global RN_ApplyNetworkSimulator(rakPeerInterface%,maxSendBPS%,minExtraPing%,extraPingVariance%)"Win32" = GetProcAddress(lib, "RN_ApplyNetworkSimulator@16")
Global RN_IsNetworkSimulatorActive%(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_IsNetworkSimulatorActive@4")


Global RN_AddToBanList(rakPeerInterface%,ip$z,milliseconds%)"Win32" = GetProcAddress(lib, "RN_AddToBanList@12")
Global RN_RemoveFromBanList(rakPeerInterface%,ip$z)"Win32" = GetProcAddress(lib, "RN_RemoveFromBanList@8")
Global RN_ClearBanList(rakPeerInterface%)"Win32" = GetProcAddress(lib, "RN_ClearBanList@4")
Global RN_IsBanned%(rakPeerInterface%,ip$z)"Win32" = GetProcAddress(lib, "RN_IsBanned@8")


Global RN_AdvertiseSystem(rakPeerInterface%,host$z,remotePort%, data$z,dataLength%)"Win32" = GetProcAddress(lib, "RN_AdvertiseSystem@20")

' Statistics. More functions are wrapped (you can add them here if needed!)
Global RN_ServerGetStatistics(rakPeerInterface%,systemAddress%)"Win32" = GetProcAddress(lib, "RN_ServerGetStatistics@8")
Global RN_StatisticsGetMessagesSent(stat%,queue%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetmessagesSent@8")
Global RN_StatisticsGetMessageDataBitsSent(stat%,queue%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetmessageDataBitsSent@8")
Global RN_StatisticsGetMessageTotalBitsSent(stat%,queue%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetmessageTotalBitsSent@8")
Global RN_StatisticsGetTotalBitsSent(stat%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetTotalBitsSent@4")
Global RN_StatisticsGetBitsReceived(stat%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetBitsReceived@4")
Global RN_StatisticsGetPacketsSent(stat%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetPacketsSent@4")
Global RN_StatisticsGetPacketsReceived(stat%)"Win32" = GetProcAddress(lib, "RN_StatisticsGetPacketsReceived@4")

' BitStreams
Global RN_BitStreamCreate1:Int(initialBytesToAllocate:Int) "Win32" = GetProcAddress(lib, "RN_BitStreamCreate1@4") 
Global RN_BitStreamCreate2:Int(data$z,length:Int,copydata:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamCreate2@12")
Global RN_BitStreamReset(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReset@4")
Global RN_BitStreamDestroy(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamDestroy@4")
Global RN_BitStreamCreateFromPacket:Int(packet:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamCreateFromPacket@4")
Global RN_BitStreamWriteBool (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteBool@8")
Global RN_BitStreamWriteUnsignedChar (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteUnsignedChar@8")
Global RN_BitStreamWriteChar (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteChar@8")
Global RN_BitStreamWriteUnsignedShort (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteUnsignedShort@8")
Global RN_BitStreamWriteShort (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteShort@8")
Global RN_BitStreamWriteUnsignedInt (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteUnsignedInt@8")
Global RN_BitStreamWriteInt (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteInt@8")
Global RN_BitStreamWriteUnsignedLong (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteUnsignedLong@8")
Global RN_BitStreamWriteLong (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteLong@8")
Global RN_BitStreamWriteFloat (bitstream:Int,Inp:Float)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteFloat@8")
Global RN_BitStreamWriteDouble (bitstream:Int,Inp:Float)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteDouble@8")
Global RN_BitStreamWrite (bitstream:Int,Inp$z,numberOfBytes:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWrite@12")
Global RN_BitStreamWriteCompressedUnsignedChar(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedUnsignedChar@8")
Global RN_BitStreamWriteCompressedChar(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedChar@8")
Global RN_BitStreamWriteCompressedUnsignedShort(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedUnsignedShort@8")
Global RN_BitStreamWriteCompressedShort(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedShort@8")
Global RN_BitStreamWriteCompressedUnsignedInt(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedUnsignedInt@8")
Global RN_BitStreamWriteCompressedInt(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedInt@8")
Global RN_BitStreamWriteCompressedUnsignedLong (bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedUnsignedLong@8")
Global RN_BitStreamWriteCompressedLong(bitstream:Int,Inp:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedLong@8")
Global RN_BitStreamWriteCompressedFloat(bitstream:Int,Inp:Float)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedFloat@8")
Global RN_BitStreamWriteCompressedDouble(bitstream:Int,Inp:Float)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteCompressedDouble@8")
Global RN_BitStreamReadBool:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadBool@4")
Global RN_BitStreamReadUnsignedChar:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadUnsignedChar@4")
Global RN_BitStreamReadChar:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadChar@4")
Global RN_BitStreamReadUnsignedShort:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadUnsignedShort@4")
Global RN_BitStreamReadShort:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadShort@4")
Global RN_BitStreamReadUnsignedInt:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadUnsignedInt@4")
Global RN_BitStreamReadInt:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadInt@4")
Global RN_BitStreamReadUnsignedLong:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadUnsignedLong@4")
Global RN_BitStreamReadLong:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadLong@4")
Global RN_BitStreamReadFloat:Float(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadFloat@4")
Global RN_BitStreamReadDouble:Float(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadDouble@4")
Global RN_BitStreamRead$z(bitstream:Int,numberOfBytes:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamRead@8")
Global RN_BitStreamReadCompressedUnsignedChar:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedUnsignedChar@4")
Global RN_BitStreamReadCompressedChar:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedChar@4")
Global RN_BitStreamReadCompressedUnsignedShort:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedUnsignedShort@4")
Global RN_BitStreamReadCompressedShort:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedShort@4")
Global RN_BitStreamReadCompressedUnsignedInt:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedUnsignedInt@4")
Global RN_BitStreamReadCompressedInt:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedInt@4")
Global RN_BitStreamReadCompressedUnsignedLong:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedUnsignedLong@4")
Global RN_BitStreamReadCompressedLong:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedLong@4")
Global RN_BitStreamReadCompressedFloat:Float(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedFloat@4")
Global RN_BitStreamReadCompressedDouble:Float(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadCompressedDouble@4")
Global RN_BitStreamResetReadPointer(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamResetReadPointer@4")
Global RN_BitStreamAssertStreamEmpty(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamAssertStreamEmpty@4")
Global RN_BitStreamPrintBits(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamPrintBits@4")
Global RN_BitStreamIgnoreBits(bitstream:Int,numberOfBits:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamIgnoreBits@8")
Global RN_BitStreamSetWriteOffset(bitstream:Int,offset:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamSetWriteOffset@8")
Global RN_BitStreamGetNumberOfBitsUsed:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetNumberOfBitsUsed@4")
Global RN_BitStreamGetNumberOfBytesUsed:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetNumberOfBytesUsed@4")
Global RN_BitStreamGetReadOffset:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetReadOffset@4")
Global RN_BitStreamGetNumberOfUnreadBits:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetNumberOfUnreadBits@4")
Global RN_BitStreamSetData(bitstream:Int,data$z,numberOfBits:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamSetData@12")
Global RN_BitStreamGetData$z(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetData@4")
Global RN_BitStreamGetDataPointer:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamGetDataPointer@4")
Global RN_BitStreamWriteBits(bitstream:Int,Inp$z,numberOfBitsToWrite:Int,rightAlignedBits:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteBits@16")
Global RN_BitStreamWriteAlignedBytes(bitstream:Int,Inpt$z,numberOfBytesToWrite:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWriteAlignedBytes@12")
Global RN_BitStreamReadAlignedBytes$z(bitstream:Int,numberOfBytesToRead:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadAlignedBytes@8")
Global RN_BitStreamAlignWriteToByteBoundary(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamAlignWriteToByteBoundary@4")
Global RN_BitStreamAlignReadToByteBoundary(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamAlignReadToByteBoundary@4")
Global RN_BitStreamReadBits$z(bitstream:Int,numberOfBitsToRead:Int,alignBitsToRight:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadBits@12")
Global RN_BitStreamWrite0(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWrite0@4")
Global RN_BitStreamWrite1(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamWrite1@4")
Global RN_BitStreamReadBit:Int(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamReadBit@4")
Global RN_BitStreamAssertCopyData(bitstream:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamAssertCopyData@4")
Global RN_BitStreamSetNumberOfBitsAllocated(bitstream:Int,lengthInBits:Int)"Win32"= GetProcAddress(lib,"RN_BitStreamSetNumberOfBitsAllocated@8")




'-------------------------'
'MESSAGE TYPES
'-------------------------'


	'//
	'// RESERVED TYPES - DO Not CHANGE THESE
	'// All types from RakPeer
	'//
	'/// These types are never returned To the user.
	'/// Ping from a connected system.  Update timestamps (internal use only)
	Const ID_INTERNAL_PING:Int = 0  
	'/// Ping from an unconnected system.  Reply but do Not update timestamps. (internal use only)
	Const ID_PING:Int = 1
	'/// Ping from an unconnected system.  Only reply If we have open connections. Do Not update timestamps. (internal use only)
	Const ID_PING_OPEN_CONNECTIONS:Int = 2
	'/// Pong from a connected system.  Update timestamps (internal use only)
	Const ID_CONNECTED_PONG:Int = 3
	'/// Asking For a New connection (internal use only)
	Const ID_CONNECTION_REQUEST:Int = 4
	'/// Connecting To a secured server/peer (internal use only)
	Const ID_SECURED_CONNECTION_RESPONSE:Int = 5
	'/// Connecting To a secured server/peer (internal use only)
	Const ID_SECURED_CONNECTION_CONFIRMATION:Int = 6
	'/// Packet that tells us the packet contains an integer ID To name mapping For the remote system (internal use only)
	Const ID_RPC_MAPPING:Int = 7
	'/// A reliable packet To detect lost connections (internal use only)
	Const ID_DETECT_LOST_CONNECTIONS:Int = 8
	'/// Offline message so we know when To reset And start a New connection (internal use only)
	Const ID_OPEN_CONNECTION_REQUEST:Int = 9
	'/// Offline message response so we know when To reset And start a New connection (internal use only)
	Const ID_OPEN_CONNECTION_REPLY:Int = 10
	'/// Remote procedure call (internal use only)
	Const ID_RPC:Int = 11
	'/// Remote procedure call reply =  For RPCs that Return data (internal use only)
	Const ID_RPC_REPLY:Int = 12

	'//
	'// USER TYPES - DO Not CHANGE THESE
	'//

	'/// RakPeer - In a client/server environment =  our connection request To the server has been accepted.
	Const ID_CONNECTION_REQUEST_ACCEPTED:Int = 13
	'/// RakPeer - Sent To the player when a connection request cannot be completed due To inability To connect.
	Const ID_CONNECTION_ATTEMPT_FAILED:Int = 14
	'/// RakPeer - Sent a connect request To a system we are currently connected to.
	Const ID_ALREADY_CONNECTED:Int = 15
	'/// RakPeer - A remote system has successfully connected.
	Const ID_NEW_INCOMING_CONNECTION:Int = 16
	'/// RakPeer - The system we attempted To connect To is Not accepting New connections.
	Const ID_NO_FREE_INCOMING_CONNECTIONS:Int = 17
	'/// RakPeer - The system specified in Packet::systemAddress has disconnected from us.  For the client =  this would mean the server has shutdown.
	Const ID_DISCONNECTION_NOTIFICATION:Int = 18
	'/// RakPeer - Reliable packets cannot be delivered To the system specified in Packet::systemAddress.  The connection To that system has been closed.
	Const ID_CONNECTION_LOST:Int = 19
	'/// RakPeer - We preset an RSA Public key which does Not match what the system we connected To is using.
	Const ID_RSA_PUBLIC_KEY_MISMATCH:Int = 20
	'/// RakPeer - We are banned from the system we attempted To connect to.
	Const ID_CONNECTION_BANNED:Int = 21
	'/// RakPeer - The remote system is using a password And has refused our connection because we did Not set the correct password.
	Const ID_INVALID_PASSWORD:Int = 22
	'/// RakPeer - A packet has been tampered with in transit.  The sender is contained in Packet::systemAddress.
	Const ID_MODIFIED_PACKET:Int = 23
	'/// RakPeer - The four bytes following this Byte represent an unsigned Int which is automatically modified by the difference in system times between the sender And the recipient. Requires that you call SetOccasionalPing.
	Const ID_TIMESTAMP:Int = 24
    '/// RakPeer - Pong from an unconnected system.  First Byte is const ID_PONG =  second SizeOf(RakNetTime) bytes is the ping =  following bytes is system specific enumeration data.
	Const ID_PONG:Int = 25
	'/// RakPeer - Inform a remote system of our IP/Port =  plus some offline data
	Const ID_ADVERTISE_SYSTEM:Int = 26
	'/// ConnectionGraph plugin - In a client/server environment =  a client other than ourselves has disconnected gracefully.  Packet::systemAddress is modified To reflect the systemAddress of this client.
	Const ID_REMOTE_DISCONNECTION_NOTIFICATION:Int = 27
	'/// ConnectionGraph plugin - In a client/server environment =  a client other than ourselves has been forcefully dropped. Packet::systemAddress is modified To reflect the systemAddress of this client.
	Const ID_REMOTE_CONNECTION_LOST:Int = 28
	'/// ConnectionGraph plugin - In a client/server environment =  a client other than ourselves has connected.  Packet::systemAddress is modified To reflect the systemAddress of this client.
	Const ID_REMOTE_NEW_INCOMING_CONNECTION:Int = 29
	'// RakPeer - Downloading a large message. Format is Const ID_DOWNLOAD_PROGRESS (MessageID) =  partCount (unsigned Int) =  partTotal (unsigned Int) =  partLength (unsigned Int) =  first part data (length <= MAX_MTU_SIZE)
	Const ID_DOWNLOAD_PROGRESS:Int = 30

	'/// FileListTransfer plugin - Setup data
	Const ID_FILE_LIST_TRANSFER_HEADER:Int = 31
	'/// FileListTransfer plugin - A file
	Const ID_FILE_LIST_TRANSFER_FILE:Int = 32

	'/// DirectoryDeltaTransfer plugin - Request from a remote system For a download of a directory
	Const ID_DDT_DOWNLOAD_REQUEST:Int = 33
	
	'/// RakNetTransport plugin - Transport provider message =  used For remote console
	Const ID_TRANSPORT_STRING:Int = 34

	'/// ReplicaManager plugin - Create an Object
	Const ID_REPLICA_MANAGER_CONSTRUCTION:Int = 35
	'/// ReplicaManager plugin - Destroy an Object
	Const ID_REPLICA_MANAGER_DESTRUCTION:Int = 36
	'/// ReplicaManager plugin - Changed scope of an Object
	Const ID_REPLICA_MANAGER_SCOPE_CHANGE:Int = 37
	'/// ReplicaManager plugin - Serialized data of an Object
	Const ID_REPLICA_MANAGER_SERIALIZE:Int = 38
	'/// ReplicaManager plugin - Finished downloading all serialized objects
	Const ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE:Int = 39

	'/// ConnectionGraph plugin - Request the connection graph from another system
	Const ID_CONNECTION_GRAPH_REQUEST:Int = 40
	'/// ConnectionGraph plugin - Reply To a connection graph download request
	Const ID_CONNECTION_GRAPH_REPLY:Int = 41
	'/// ConnectionGraph plugin - Update edges / nodes For a system with a connection graph
	Const ID_CONNECTION_GRAPH_UPDATE:Int = 42
	'/// ConnectionGraph plugin - Add a New connection To a connection graph
	Const ID_CONNECTION_GRAPH_NEW_CONNECTION:Int = 43
	'/// ConnectionGraph plugin - Remove a connection from a connection graph - connection was abruptly lost
	Const ID_CONNECTION_GRAPH_CONNECTION_LOST:Int = 44
	'/// ConnectionGraph plugin - Remove a connection from a connection graph - connection was gracefully lost
	Const ID_CONNECTION_GRAPH_DISCONNECTION_NOTIFICATION:Int = 45

	'/// Router plugin - route a message through another system
	Const ID_ROUTE_AND_MULTICAST:Int = 46

	'/// RakVoice plugin - Open a communication channel
	Const ID_RAKVOICE_OPEN_CHANNEL_REQUEST:Int = 47
	'/// RakVoice plugin - Communication channel accepted
	Const ID_RAKVOICE_OPEN_CHANNEL_REPLY:Int = 48
	'/// RakVoice plugin - Close a communication channel
	Const ID_RAKVOICE_CLOSE_CHANNEL:Int = 49
	'/// RakVoice plugin - Voice data
	Const ID_RAKVOICE_DATA:Int = 50

	'/// Autopatcher plugin - Get a list of files that have changed since a certain date
	Const ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE:Int = 51
	'/// Autopatcher plugin - A list of files To create
	Const ID_AUTOPATCHER_CREATION_LIST:Int = 52
	'/// Autopatcher plugin - A list of files To Delete
	Const ID_AUTOPATCHER_DELETION_LIST:Int = 53
	'/// Autopatcher plugin - A list of files To get patches For
	Const ID_AUTOPATCHER_GET_PATCH:Int = 54
	'/// Autopatcher plugin - A list of patches For a list of files
	Const ID_AUTOPATCHER_PATCH_LIST:Int = 55
	'/// Autopatcher plugin - Returned To the user: An error from the database repository For the autopatcher.
	Const ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR:Int = 56
	'/// Autopatcher plugin - Finished getting all files from the autopatcher
	Const ID_AUTOPATCHER_FINISHED_INTERNAL:Int = 57
	Const ID_AUTOPATCHER_FINISHED:Int = 58
	'/// Autopatcher plugin - Returned To the user: You must restart the application To finish patching.
	Const ID_AUTOPATCHER_RESTART_APPLICATION:Int = 59

	'/// NATPunchthrough plugin - Intermediary got a request To help punch through a nat
	Const ID_NAT_PUNCHTHROUGH_REQUEST:Int = 60
	'/// NATPunchthrough plugin - Intermediary cannot complete the request because the target system is Not connected
	Const ID_NAT_TARGET_NOT_CONNECTED:Int = 61
	'/// NATPunchthrough plugin - While attempting To connect =  we lost the connection To the target system
	Const ID_NAT_TARGET_CONNECTION_LOST:Int = 62
	'/// NATPunchthrough plugin - Internal message To connect at a certain time
	Const ID_NAT_CONNECT_AT_TIME:Int = 63
	'/// NATPunchthrough plugin - Internal message To send a message (To punch through the nat) at a certain time
	Const ID_NAT_SEND_OFFLINE_MESSAGE_AT_TIME:Int = 64

	'/// LightweightDatabase plugin - Query
	Const ID_DATABASE_QUERY_REQUEST:Int = 65
	'/// LightweightDatabase plugin - Update
	Const ID_DATABASE_UPDATE_ROW:Int = 66
	'/// LightweightDatabase plugin - Remove
	Const ID_DATABASE_REMOVE_ROW:Int = 67
	'/// LightweightDatabase plugin - A serialized table.  Bytes 1+ contain the table.  Pass To TableSerializer::DeserializeTable
	Const ID_DATABASE_QUERY_REPLY:Int = 68
	'/// LightweightDatabase plugin - Specified table Not found
	Const ID_DATABASE_UNKNOWN_TABLE:Int = 69
	'/// LightweightDatabase plugin - Incorrect password
	Const ID_DATABASE_INCORRECT_PASSWORD:Int = 70
	
	'// For the user To use.  Start your first enumeration at this value.
	Const ID_USER_PACKET_ENUM:Int = 71



'-------------------------'
'MESSAGE PRIORITIES
'-------------------------'
Const	HIGH_PRIORITY:Int = 1
Const	MEDIUM_PRIORITY:Int = 2
Const	LOW_PRIORITY:Int = 3

'-------------------------'
'MESSAGE RELIABILITY
'-------------------------'
Const UNRELIABLE:Int = 0
Const UNRELIABLE_SEQUENCED:Int = 1
Const RELIABLE:Int = 2
Const RELIABLE_ORDERED:Int = 3
Const RELIABLE_SEQUENCED:Int = 4

'-------------------------'
'UNASSIGNED PLAYER ID
'-------------------------'
Global UNASSIGNED_SYSTEM_ADDRESS:Int = RN_GetUNASSIGNED_SYSTEM_ADDRESS()
Global UNASSIGNED_NETWORK_ID:Int = RN_GetUNASSIGNED_NETWORK_ID()

Function RN_GetPacketIdentifier%(packet%)
	Local msg$ = RN_PacketGetData(packet)
	Return Asc(msg[0..1])
End Function





RepeatUntil(Posted 2008) [#54]
Great, great, great!! Effectively, that's really a nice community! I will add all these improvements in the RakNet wrapper to have one single improved version. I will post here when done (could take several days...).

Ovine, I will check with which version I am compiling (I am at work now...)

My programming time is reaching 0 now, so this wrapper should be considered developped by the community. I will still centralize the RakNet code, and reply to threads or emails.


Kev(Posted 2008) [#55]
RepeatUntil, i will email you the fixed source for the posted .dll for inclusion sometime today


RepeatUntil(Posted 2008) [#56]
I just uploaded new version of the RakNet wrapper (Blitz3D/Max)!! The new stuff:
- fixes by Ovine in RakNet.bmx
- fixes by Kev in the wrapper itself. Should fix a very important bug, ie the code to identify clients!
- And, as everyone was courageous but me, I decided to update the wrapper to the very latest version of RakNet (v3.2)! RakNet.bb/.bmx and the dll were modified.

You can download all this fun from my signature.
By the way, I have added the wrapper in the toolbox for posterity: http://www.blitzmax.com/toolbox/toolbox.php?tool=215

However, it seems that the function RN_GetSystemAddressFromIndex() is not working properly. I commented out the use of this function in the examples. Kev (or others), could you check that it is working or not?


I would have a play but when I compile using DEv C++ v4 theres all sorts of compiler errors .... :S


I use dev-C++ v4.9.9.2. I have now put a file HELPRakNetWrapper.txt in the dev version. Follow it step by step, and you should be able to first compile RakNet alone (if it is not working at this point, this is because your settings are incorrect), and then the wrapper itself.


Kev(Posted 2008) [#57]
I will take a look the RN_GetSystemAddressFromIndex() call in the next couple of days.

Kev


Stu_ovine(Posted 2008) [#58]
Any news on the fix yet ? Looking at the code it is evident why its now broken....


Kev(Posted 2008) [#59]
ok having taken a look over the source and testing using the provided example. IT DOES SEEM TO WORK!

take the following...

i replace the original example code server keyhit 'enter' section with the code below. then i create a server(key s) then i create 3 clients(key c)

here we send the message only to client who's index is '1'
		If KeyHit(28)
			Print "sending message from server"
			chatMsg$=" Hello world!!! server here"
			chatMsg$ = Chr(ID_CHAT) + chatMsg
			; and now broadcast it
			ok = RN_Send(peer, chatMsg$, Len(chatMsg$) + 1, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RN_GetSystemAddressFromIndex(peer, 1), False)
		EndIf



now say we want to send the message to all clients BUT NOT client 1 we change the broadcast flag to 'true' so...

		If KeyHit(28)
			Print "sending message from server"
			chatMsg$=" Hello world!!! server here"
			chatMsg$ = Chr(ID_CHAT) + chatMsg
			; and now broadcast it
			ok = RN_Send(peer, chatMsg$, Len(chatMsg$) + 1, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RN_GetSystemAddressFromIndex(peer, 1), True)
		EndIf



ive not tested using RN_SendBitStream() but it should work.


RepeatUntil(Posted 2008) [#60]
Then I am really confused!!!
Because I have added one simple line in the code (the example):
DrawText(RN_GetSystemAddressFromIndex(peer, 0) 
+ " / " + RN_GetSystemAddressFromIndex(peer, 1) 
+ " / " + RN_GetSystemAddressFromIndex(peer, 2), 20, GraphicsHeight()*0.7)


I have connected the server with 2 clients on one machine. Then you see that the 3 RN_GetSystemAddressFromIndex printed on screen are completely identical, whereas I expect them to be different for the server and the 2 clients, no?
By the way, it is different from the system address returned in the string "Packet from" in the wrapper example. So, I am really confused!!!!

Could you try to add this debugging line and tell me what you have and if you understand it?


*(Posted 2008) [#61]
Take into account that the licence fee for RackNet is $100 for a indy project that sells. Its free for non-commercial applications tho.


Kev(Posted 2008) [#62]
hold on i think i understand, in the raknet.cpp heres what we have for RN_GetSystemAddressFromIndex() to function correct.

we first make 'SystemAddress addr;' have global scope. devc++ did not like returning the address of a temporary variable. now each time RN_GetSystemAddressFromIndex() is called the addr struct is populated and its address returned.

so were returning the same address thats populated with new SystemAddress details each call.

i could be wrong though, i will look into it.

kev


Stu_ovine(Posted 2008) [#63]
Thanks for your work on this so far Kev.

As soon as I plugged in the new DLL my working program stopped.

It does seem to be RN_GetSystemAddressFromIndex thats at fault.

RN_SendBitStream(Server, BitStreamOUT, HIGH_PRIORITY, RELIABLE_ORDERED, 2, RN_GetSystemAddressFromIndex(Server, playerindex), False) 


Also where has the extra 200k come from in the new build of the wrapper- not that lightweight anymore is it :)


Kev(Posted 2008) [#64]
ok seems like this now works, download below

http://www.whitegatesoftware.com/RakNet_update.rar

please post your results.

kev


RepeatUntil(Posted 2008) [#65]
Yes, the additional 200K comes from v3.2 wrt v3.0 beta. I don't know what he added though...

OK, Kev, please let us know if you think you have found a fix...

An yes, RakNet is not free if you sell something with it...


t3K|Mac(Posted 2008) [#66]
100$ is nothing in Euros ;)

If you plan to sell something, i think you can afford the 100 bucks.

keep on developing this nice wrapper!


Retimer(Posted 2008) [#67]
I made a framework for this wrapper a while back, and from what I saw it looked like a heaploads of work to impliment other feature or fix current ones.

You would think "RN_GetSystemAddressFromIndex" would be a simple return value fix but it doesn't seem that easy.


Kev(Posted 2008) [#68]
ive emailed the fixed function call to RepeatUntil, for now the link above has been updated with the new working .dll. this has been tested in blitzmax and blitz3d both seem to work as expected.

kev


Stu_ovine(Posted 2008) [#69]
Still same problem here


The sticking point for me now is sending a packet back to a client thats just logging on (grabbing the systemaddress from the packet)

RN_PacketGetSystemAddress(Packet)



More investigation, im wrong. The client isnt connecting to the server. Its returning an error "ID_NO_FREE_INCOMING_CONNECTIONS".

Works in previous version not in this one.

	Local ret = RN_Startup(Server, 15, 0, Int(portnumber:String)) 
	RN_SetMaximumIncomingConnections(Server, 15) 



Kev(Posted 2008) [#70]
OvineByDesign, can you confirm that RN_GetSystemAddressFromIndex() is working for you and that theres also a problem with RN_PacketGetSystemAddress() or that BOTH are still broke.

kev


Stu_ovine(Posted 2008) [#71]
Right I got the client to connect (my bad)

All code is now working for me both RN_GetSystemAddressFromIndex() and RN_PacketGetSystemAddress().

Good fix. Ive not tested what RepeatUntil has reported tho. I'll fire up an example and see.


Stu_ovine(Posted 2008) [#72]
The RN_GetSystemAddressFromIndex(peer, 0) as repeatuntil is reporting is correct, its returning the same address no matter what player index you give it :S

Which is bizare as its working for me in game - just not with the "simpleExample.bmx"


Kev(Posted 2008) [#73]

The RN_GetSystemAddressFromIndex(peer, 0) as repeatuntil is reporting is correct, its returning the same address no matter what player index you give it :S



yes it will as its returning the same struct's address thats been populated using the SystemAddress obtained from the passed index. not great i know, im still unable to find a working fix for this.


Which is bizare as its working for me in game - just not with the "simpleExample.bmx"



in the example it broadcasts to all clients, to change this use the following

under 'Case ID_CHAT' change to!

If (isServer) Then
	RN_Send(peer,msg$,Len(msg)+1,HIGH_PRIORITY,RELIABLE_ORDERED,0,RN_GetSystemAddressFromIndex(peer, 1),True);
EndIf




Stu_ovine(Posted 2008) [#74]
Whilst your looking in the source Kev, can you look at converting the systemaddress into a readable IP addy ?

Reading the forums :-

"Use ToString() to output a statically allocated string for SystemAddress"


Stu_ovine(Posted 2008) [#75]
As I needed an immediate fix, Ive added GetIPAddressFromIndex(index) to the RakPeer source code.

Probably not the best way todo it (as its effecting the core product) but I couldnt get toString() to work in just RakNet.cpp :S

I now can grab the external IP addys of the clients connected.


RepeatUntil(Posted 2008) [#76]
Very good news for them who were expecting that: this RakNet wrapper is now available as a module for BlitzMax, which means that it is now cross-platform!!

This work was done by Jimon. I didn't test it, but Jimon told me that it was working perfectly on Windows and Linux. A big thanks to him!

You can download this new version from my sig (RakNet web page), or directly from this link.

It uses the latest version of the wrapper and of RakNet.

Please test it and report any problem...


Retimer(Posted 2008) [#77]
Holy crap. That's awsome news!


Amon(Posted 2008) [#78]
Great News on making it a module. :)


AlexO(Posted 2008) [#79]
sounds like an awesome library, wish I had this when I did my last multiplayer game. Great to see it available to Blitzmax.


Retimer(Posted 2008) [#80]
Out of curiosity what would it take to get the rakvoice api working in the module?


Stu_ovine(Posted 2008) [#81]
Excellent stuff ! - off to play with it now.

Out of interest, has anyone tried it out on a Mac yet ?


Stu_ovine(Posted 2008) [#82]
Seems that sending a Broadcast produces an error

RN_SendBitStream(peer, BitWriter, HIGH_PRIORITY, RELIABLE_ORDERED, 0, UNASSIGNED_SYSTEM_ADDRESS, True)



Seems to be "UNASSIGNED_SYSTEM_ADDRESS" related as the example app that was supplied test app sends without problem using "RN_PacketGetSystemAddress(Packet)
" as the address....

Just to clarify I'm trying to send a broadcast message to all clients.


Stu_ovine(Posted 2008) [#83]
Seems that UNASSIGNED_SYSTEM_ADDRESS is not returning a systemaddress.

A quick fix to send a broadcast message :-

add this to raknet.cpp
RN_API bool RN2_API RN_SendBitStreamBroadcast(RakPeerInterface *rakPeerInterface,RakNet::BitStream *bitStream,int priority,int reliability,int orderingChannel)
{
	return rakPeerInterface->Send(bitStream,PacketPriority(priority),PacketReliability(reliability),orderingChannel,UNASSIGNED_SYSTEM_ADDRESS,1);
}




and this to raknet.bmx - then recompile the mod

Function RN_SendBitStreamBroadcast%(rakPeerInterface%,bitStream%,priority%,reliability%,orderingChannel%) = "RN_SendBitStreamBroadcast"


Use RN_SendBitStreamBroadcast() instead of RN_SendBitStream()


RepeatUntil(Posted 2008) [#84]
Hello,

Unfortunately, the author of the module (jimon) has no access to this forum (don't ask me why). But he read this thread and send me an email which reads:

i don't know now why it d'ont work :(

this UNASSIGNED_* values are const in raknet library, but i dont know how to get it if library linked as static :(
damn, blitzmax can't send agruments to gcc compiler ...
i think, i should try to compile raknet to .a file, and make some voodoo :)



and


here we go - beta 2 :)
i tested this version with ExampleBitstreams.bmx and NetTest.bmx (with some changes in NetTest.bmx)
also this version use last raknet code - v3.24



You can find the updated file he gave me here for now:
http://repeatuntil.free.fr/raknet/beta2.rar
If you find it fixes the errors, then I will put it at the official place...


Stu_ovine(Posted 2008) [#85]
will test now.

BTW Could you ask him to look at returning the IPaddress

RN_API int RN2_API RN_SystemAddressGetBinaryAddress(SystemAddress *systemAddress)
{
	return systemAddress->binaryAddress;
}


as this is supposed to return the IP address of a systemaddress, as you can see it returns an INT, according to the docs it needs conveting using "toString()" in C++.

Ive hacked the wrapper for my own use but would be nice to get it in the wrapper....


Stu_ovine(Posted 2008) [#86]
With the new updated NetTest.bmx got a bug.

Although I think its a bug - its not the correct way todo things (as far as I know).

When the client sends to the server it should always use a broadcast as the client can only see the server in any case.

In the example, ServerSystemAdress = RN_PacketGetSystemAddress(Packet) upon the client connecting to the server. You would assume that this serveraddress will never change, but it seems it does. (see reference to this earlier in the discussion). In the example the client constantly times out as its not talking to the server.

Clients send to server
I would suggest that clients always broadcast to the server

In the example do this :-
SendTest(ClientPeer,UNASSIGNED_SYSTEM_ADDRESS,1)


Server talking directly to a client

A server talking directly to a client would use :-
SendTest(ServerPeer,RN_GetSystemAddressFromIndex(Serverpeer,<id>),0)

<ID> being the players ID to send to (ID being the index 0 - maxusers)

or

SendTest(ServerPeer,RN_PacketGetSystemAddress(Packet),0))

If replying to a packet that has just been received.

I have used it this way since the original wrapper...

Hope this helps.


Stu_ovine(Posted 2008) [#87]
I can now confirm that the wrapper compiles and works on MacOsX (leopard) on an IMac.

A few compiler errors (well more like warnings) about symbols not loaded but works a treat.

Pass on my regards to "jimon" (just get him to get RN_SystemAddressGetBinaryAddress to return a string and I'll be happy) - although my insertion of a new function is working Id still prefer it to be part of the wrapper instead of a fix I have to keep remembering to insert.


RepeatUntil(Posted 2008) [#88]
Jimon is watching this thread so I hope he will work on your request (I will notify you if he sends me an email)! Otherwise, if someone knows a bit of C++, he might be able to fix the wrapper.
I must shamely admit that my programming time is now stricly 0, and so can't help :-(


Stu_ovine(Posted 2008) [#89]
Another one for Jimon.

Im trying to catch the debug info, but the assert() from within the C++ code is not producing any output.

Ive put a #define _DEBUG in the reliablilityLayer.h thinking thats the place to put it ?

Im using printf() instead of the assert() but again its messing with the core code so not the best idea.....


Is there anything Im doing wrong or missing ?


Stu_ovine(Posted 2008) [#90]
Another wrapped function that is useful :-

In Raknet.cpp

RN_API const char * RN2_API RN_StatisticsToString(RakNetStatistics *stat, int verbosityLevel)
{
	char c[ 4096 ];
	StatisticsToString(stat, c, verbosityLevel);
	return c;
}



In Raknet.bmx
Function RN_StatisticsToString$z(stat%, Level%) =  "RN_StatisticsToString"



Returns a string containing a summary of the stats.

usage :-


local stat:int 
stat = RN_ServerGetStatistics(Server, RN_PacketGetSystemAddress(Packet))

'Stat now points to the players stats that were last received
DebugLog(RN_StatisticsToString(stat,  0))  ' print brief detail
DebugLog(RN_StatisticsToString(stat,  1))  ' med detail
DebugLog(RN_StatisticsToString(stat,  2))  ' full detail




Produces (full detial)

Messages in send buffer: SP:1 HP:0 MP:0 LP:0
Messages sent: SP:5 HP:1 MP:0 LP:0
Message data bytes sent: SP:43 HP:129 MP:0 LP:0
Message header bytes sent: SP:30 HP:12 MP:0 LP:0
Message total bytes sent: SP:73 HP:141 MP:0 LP:0
Bytes received: Ttl:225 Good:225 Bad:0
Packets received: Ttl:5 Good:5 Bad:0
Acks received: Ttl:0 Good:0 Dup:0
Messages received: Total:5 Valid:5 Invalid:0 Dup:0
Packetloss: 0.0%
Packets sent: 5
Acks sent: 5
Acks in send buffer: 0
Messages waiting for ack: 0
Ack bytes sent: 19
Sent packets containing only acks: 0
Sent packets w/only acks and resends: 0
Reliable messages resent: 0
Reliable message data bytes resent: 0
Reliable message header bytes resent: 0
Reliable message total bytes resent: 0
Number of messages split: 0
Number of messages unsplit: 6
Message splits performed: 0
Additional encryption bytes: 0
Sequenced messages out of order: 0
Sequenced messages in order: 0
Ordered messages out of order: 0
Ordered messages in of order: 1
Split messages waiting for reassembly: 0
Messages in internal output queue: 1
Inst KBits per second: 67.6
Elapsed time (sec): 0.0
KBits per second sent: 156.3
KBits per second received: 138.5
Bandwith exceeded: 1


Retimer(Posted 2008) [#91]
Since the wrapper seems more stable now i'll continue my EasyRak module and release it within the next week with some examples.

This wrapper is too great to go limp ;-)


Apollonius(Posted 2008) [#92]
Looking forward to anything RakNet related in BLITZ!!! Tutorials and documentation included ;D


Retimer(Posted 2008) [#93]
Ah nevermind =(

The exact same issues still seem to be there. It seems you can still only send to one client. The issue is still there with getting the incorrect SystemAddress. It continues to return the same system address no matter what index you are recieving data from.

The only difference I see is that the issues are now wrapped for cross-platform.

Has anyone been able to actually send data properly to multiple clients, and specific clients?


Stu_ovine(Posted 2008) [#94]
ReTimer .... dont store the systemaddress !!!!

if you store the players index instead and when you want to talk to them use :-

RN_GetSystemAddressFromIndex(Serverpeer,<id>)


to grab the correct systemaddress.

I tried to explain this a few posts back. It does work.


Retimer(Posted 2008) [#95]
That is actually what i'm doing, and it's still a no go. The server only seems to send to the user that last contacted it. Something is wrong =/

Have you actually been able to come up with a simple app to contact specific clients?


Part of my mod code below:
Method IsDataAvailable:Byte() 
			If Self.packet
				RN_DeallocatePacket(Interface, Self.packet)      'Must get rid of old packet. Otherwise it may be possible to cause memory leaks.
			End If
			Self.packet = RN_Receive(Interface) 
			If (Self.packet) Then
				Self.Create_BitStream_From_Packet(Self.packet) 
				Self.MsgType = RN_BitStreamReadUnsignedChar(Self.Reader) 
				Self.CurrentIndex = RN_PacketGetplayerIndex(Self.packet) 
				Self.CurrentAddress = RN_PacketGetSystemAddress(Self.Packet)     
				Print Self.currentaddress
				If Not IsServer
					ServerSystemAdress = Self.CurrentAddress
				Else
					RakPlayers[Self.CurrentIndex].Address = Self.CurrentAddress 
				End If
				If Self.MsgType < ID_USER_PACKET_ENUM 'Message was created by Raknet itself. 
					ProcessMsgID(Self.MsgType, Self.CurrentIndex, Self.CurrentAddress) 
					Return 0
				Else
					UseCompression = Self.ReadBool() 
					Return 1
				End If
				
			Else
				Return 0
			End If
	End Method


The adress prints out, on connection:


-A new client is connecting (0) - Address: 3352636
-A new client is connecting (1) - Address: 3352636



The same goes for when they send messages.....the address is the same. I have tried every method of getting the address (not just via packet) and it does the same thing.


Stu_ovine(Posted 2008) [#96]
I have it working no problems here .


Try grabbing from the index rather than the Packet

i.e. Replace

Self.CurrentAddress = RN_PacketGetSystemAddress(Self.Packet)


with

Self.CurrentAddress = RN_GetSystemAddressFromIndex(interface,Self.CurrentIndex)



Retimer(Posted 2008) [#97]
Same thing. Can you provide an example where it works? I have tried every angle I can think of and it is not working properly.

If you can provide an example where you can send to specific clients and/or multiple clients. If i'm wrong, it'll at least provide some insight for others having a hard time with the RN wrapper.

Or even an example showing that the addresses incoming are different with each client?

I have tried with every systemaddress command, in multiple examples, different servers, clients, etc and all the addresses of the clients return the same thing, and trying to send to that address only sends to the last client to send a packet to the server.


MrTAToad(Posted 2008) [#98]
Nice to see you've got a multi-OS version availiable - and it does seem (according to the included test program) to work on a Mac.

One thing - how would a client connect to a server that is effectively not known (ie it sends broadcast messages to all machines on a network, from which the client would respond).


Xaron(Posted 2008) [#99]
Thanks for this great stuff! But what kind of download "server" do you use? I've got about 800 byte(!) per second...

Have mirrored it to my server - at least the release version, the others are still pending. *gg*

http://www.xaron.net/dl/bb/RakNetWrapper_release.rar
http://www.xaron.net/dl/bb/RakNetWrapper_dev.rar
http://www.xaron.net/dl/bb/RakNetModule.rar

Regards - Xaron

edit: Added the other two archives...


Retimer(Posted 2008) [#100]
Alright I managed to figure out my issue, thanks Ovine.

I have an old wrapper of a wrapper here that I threw together back when the raknet wrapper was first setup, and I just managed to fix it up a little. The idea was to make it a lot less mind boggling to use the RakNet wrapper with bitstreams, and simplify it.


Here is the simplified Wrapper of jimon.raknet mod:

EasyRak:



Creating a Simple Server:
Global MyRak:TBitstream = New TBitstream

MyRak.CreateServer() 


While Not KeyHit(KEY_ESCAPE) 
	If MyRak.IsDataAvailable()  'This actually does all the processing, along with checking if data is available.
		Select MyRak.MsgType 'MsgType is the id of the bitstream packet.
		
		End Select
	End If
Wend

MyRak.Destroy


A client is done the exact same way, but instead of createserver(), you'll use MyRak.Connect_To_Server().

Sending/Recieving Data has been made quite a bit simpler..

Sending:
Const MsgID_CharacterInfo:Byte = 120

Function SendCharacterInfo()
	'Create bit stream, and create it with a packet id.
	MyRak.Create_BitStream(MsgID_CharacterInfo) 
	MyRak.WriteByte(4)   'Character ID?
	MyRak.WriteString("John Doe")  'Character Name?
	MyRak.WriteBool(1)   '1 = Male, 0 = Female. This is a bit.
	MyRak.SendDataTo(Index)    'Sending data...
End Function



Recieving that sent code:
If MyRak.IsDataAvailable() 
	Select MyRak.MsgType
		Case MsgID_CharacterInfo
			Local id:Byte
			id = MyRak.ReadByte() 
			Character(id).Name = MyRak.ReadString() 
			Character(id).Sex = MyRak.ReadBool() 
	End Select
End If



You can either use EasyRak as a mod (you'll have to set that up, easily), or just an include. I was going to fix it up more, and include some examples/docs but i'm falling so far behind on things lately.

The methods within it should at least give some assistance to how things work, or can work.

Time


RepeatUntil(Posted 2008) [#101]

Alright I managed to figure out my issue, thanks Ovine.


Retimer, could you tell us what you did to fix this issue??

And great job for the wrapper's wrapper!! As soon you think you are close to a final version (maybe now?), I will include it in the official release...


Stu_ovine(Posted 2008) [#102]
Glad its working for you.

>Retimer, could you tell us what you did to fix this issue??

Correct me if im wrong but if you look thru his code :-

RN_SendBitStream(Interface, Self.Reader, Priority, Reliability, 0, RN_GetSystemAddressFromIndex(Interface, Index), 0) 


He is now sending to the client by using "RN_GetSystemAddressFromIndex" rather than directly from a stored systemaddress. (as this does change per packet received)

i.e. just store the clients connected index rather than an address.


Retimer(Posted 2008) [#103]
Yes, I was just storing the systemaddress via packet everytime data was recieved before. Every time you send anything u must use

RN_GetSystemAddressFromIndex(Interface, Index)


for the address to deliver it correctly. Ovine was correct from the start, I just misunderstood him initially about addresses changing after packets are recieved; so I figured ide grab the address every time a packet was recieved for that index. It was an issue on my part. Sorry for that.

In the next couple weeks i'll try to find the time to setup some examples and throw together the updates i've made recently for it. The EasyRak now has an event handler, for dealing with events within RN, and a couple other fairly needed features.
This will make it so the EasyRak can be made into a module, to reduce compile time for projects that use it and so I can organize a system of examples/templates better.

I'm now using RN on my focused project, so like Ovine, I can vouch that it works, and extremely well. I previously wrote a simplified Enet wrapper and the comparisons in features and stability all head for raknet.

As for the stability...for anything less important, don't use HIGH_PRIORITY and RELIABLE_ORDERED. For unimportant packets, constant movement updates (in 3d, or non-tilebased 2d), medium/low priority and Unreliable settings should help improve network performance by a longshot.


Xaron(Posted 2010) [#104]
Hi all,

I've updated the Blitzmax raknet module from jimon/repeatuntil

The wrapper from the page above is still using version 3.2 of RakNet.

I've updated it to the latest version 3.8.2. You can download it here:

http://www.xaron.net/dl/bb/RakNetModule_382.zip

A small example is included. I've informed the author of that wrapper to put it on his page as well.

Please let me know when you find any bugs.

Thanks!


Naughty Alien(Posted 2010) [#105]
..very nice indeed..thanks..


RepeatUntil(Posted 2010) [#106]
Thanks Xaron, this is very nice to see the wrapper updated with one of the latest stable RakNet version!
The web page is up to date, I have linked your version!!
Cheers!

Last edited 2010


Tab(Posted 2010) [#107]
And here the version 3.82 for Blitz3D.

http://www.badmouse.cl/dev/RaknetWrapper_3.82_B3D.zip


RepeatUntil(Posted 2010) [#108]
Great! I have updated the "official" web page and put there your version!


Naughty Alien(Posted 2010) [#109]
..by the way, RakNet is not a free library, so I guess, for commercial use, it has to be purchased, regardless of use as a wrapper(module) , right ?

http://www.jenkinssoftware.com/


xlsior(Posted 2010) [#110]
..by the way, RakNet is not a free library, so I guess, for commercial use, it has to be purchased, regardless of use as a wrapper(module) , right ?


Correct.

Typically, the license info of the module should mention this, but even if they don't you are still bound by the raknet terms and conditions.


Blitzplotter(Posted 2010) [#111]
This looks a very capable polished looking networking app. Makes me feel like I've been attempting to network (with some success wirelessly over a bespoke ISP router) in Blitz3D using a fat crayon (;-).


Richard Betson(Posted 2012) [#112]
Hi,

Does anyone have an example or a method for using RakVoice?

Thanks,
- Rich -

Last edited 2012


Guy Fawkes(Posted 2012) [#113]
I'm with Richard. Does anyone have an example for using RakVoice in BlitzBasic?

Last edited 2012