Jump to page: 1 2 3
Thread overview
basic raknet bindings for D
Nov 24, 2005
clayasaurus
Nov 24, 2005
Walter Bright
Nov 24, 2005
John Reimer
Nov 24, 2005
clayasaurus
Nov 24, 2005
John Reimer
Nov 25, 2005
Walter Bright
Nov 25, 2005
John Reimer
Nov 25, 2005
Charles
Nov 25, 2005
Walter Bright
Nov 25, 2005
John Reimer
Nov 25, 2005
Walter Bright
Nov 24, 2005
clayasaurus
Nov 25, 2005
John Reimer
Nov 25, 2005
John Reimer
Nov 25, 2005
clayasaurus
Nov 25, 2005
John Reimer
Nov 25, 2005
Walter Bright
Nov 25, 2005
clayasaurus
Nov 25, 2005
clayasaurus
Nov 25, 2005
Walter Bright
Nov 25, 2005
clayasaurus
Nov 25, 2005
John Reimer
Nov 25, 2005
Walter Bright
November 24, 2005
Bindings here --> http://svn.dsource.org/projects/bindings/trunk/raknet/

http://www.rakkarsoft.com/
"A free networking API that provides reliable UDP and high level networking constructs on Windows, Linux, and Unix"

What I did was create a C wrapper for the C++ code, and then created a D wrapper for the C wrapper.

Unfortunetly, due to linker issues, I have not been able to get it to work under windows. More information here ( http://svn.dsource.org/projects/bindings/trunk/raknet/README.txt )

I'm hoping some windows programmer comes along, finds this, and manages to get it to work for windows. If somebody does, please email me. I think your best bet would be to avoid the linker and try loading the DLL at runtime.

I should also mention this is not a full fledged binding, not all features of raknet are exposed. It is enough for simple multiplayer games however, and it would be very easy to extend this binding. I think it is a good starting point, coming with two quality samples (basic chat client/serv, intermediate opengl line drawing client/serv).

Goodluck. *x-fingers someone manages a windows port*

~ Clay
November 24, 2005
Did you email raknet and ask them to support DMC? Such things usually can help a lot.


November 24, 2005
Walter Bright wrote:
> Did you email raknet and ask them to support DMC? Such things usually can
> help a lot.
> 
> 

It seems that the RakNet developers know about DMC.  When you try to compile using DMC, they've included an #error message that pops up with "Digital Mars C++ : I don't know your compiler"

They support very few other compilers beyond gcc and Visual C++.  In fact, I think those are the only ones.

I've tried compiling it with DMC also.  Of course doing this led me into the wild goose chase of modifying the RakNet code to work with DMC. It's an absolutely horrible process.  I'm not sure if it's DMC's fault or the developer's fault, but there are tons of strange/foreign code techniques that DMC rejects.  Now I know why I've stuck with D so long.  C++ compilers just don't get along with each other!  It's like C++ itself is full of incompatible dialects.

Here's one error, among many, that I'm having trouble with (perhaps I should have stuck this in the C++ forum):

typename BinarySearchTree<BinarySearchTreeType>::node*& BinarySearchTree<BinarySearchTreeType>::find( const BinarySearchTreeType& element, typename BinarySearchTree<BinarySearchTreeType>::node** parent )
	{
		static typename BinarySearchTree::node * current;

		current = this->root;
		*parent = 0;
		this->direction = this->ROOT;

		if ( BinarySearchTree_size == 0L )
		{
			this->direction = this->NOT_FOUND;
			return current = 0; 	 // <--- ERROR!!
		}
 // ..... and so one
}

Error: C:\Projects\c++\RakNet\Include\BinarySearchTree.h(598): reference must refer to same type or be const

What do I do here?  I must not know enough C++ to fix this error.  I can't seem to cast the 0 to the BinarySearchTre::node* (at least that didn't work).  And the return type is a reference to a pointer... ewwww!!!  What a hodgepodge of ickiness! Is the above supposed to be software development at its finest?  Is that supposed to beautiful template code? :( (sorry, just ranting).

Is it really worth trying to get the C++ projects out there to work on so many compilers that can't agree with each other on what's legal C++?  It's high time for D to take over the world, Walter! Please!

Oh... DMC version 8.45 here.

-JJR
November 24, 2005
Walter Bright wrote:
> Did you email raknet and ask them to support DMC? Such things usually can
> help a lot.
> 
> 

I sent a feature request in their forum to support DMC.
November 24, 2005
John Reimer wrote:
> Walter Bright wrote:
> 
>> Did you email raknet and ask them to support DMC? Such things usually can
>> help a lot.
>>
>>
> 
> It seems that the RakNet developers know about DMC.  When you try to compile using DMC, they've included an #error message that pops up with "Digital Mars C++ : I don't know your compiler"
> 
> They support very few other compilers beyond gcc and Visual C++.  In fact, I think those are the only ones.
> 
> I've tried compiling it with DMC also.  Of course doing this led me into the wild goose chase of modifying the RakNet code to work with DMC. It's an absolutely horrible process.  I'm not sure if it's DMC's fault or the developer's fault, but there are tons of strange/foreign code techniques that DMC rejects.  Now I know why I've stuck with D so long.  C++ compilers just don't get along with each other!  It's like C++ itself is full of incompatible dialects.
> 
> Here's one error, among many, that I'm having trouble with (perhaps I should have stuck this in the C++ forum):
> 
> typename BinarySearchTree<BinarySearchTreeType>::node*& BinarySearchTree<BinarySearchTreeType>::find( const BinarySearchTreeType& element, typename BinarySearchTree<BinarySearchTreeType>::node** parent )
>     {
>         static typename BinarySearchTree::node * current;
> 
>         current = this->root;
>         *parent = 0;
>         this->direction = this->ROOT;
> 
>         if ( BinarySearchTree_size == 0L )
>         {
>             this->direction = this->NOT_FOUND;
>             return current = 0;      // <--- ERROR!!
>         }
>  // ..... and so one
> }
> 
> Error: C:\Projects\c++\RakNet\Include\BinarySearchTree.h(598): reference must refer to same type or be const
> 
> What do I do here?  I must not know enough C++ to fix this error.  I can't seem to cast the 0 to the BinarySearchTre::node* (at least that didn't work).  And the return type is a reference to a pointer... ewwww!!!  What a hodgepodge of ickiness! Is the above supposed to be software development at its finest?  Is that supposed to beautiful template code? :( (sorry, just ranting).
> 
> Is it really worth trying to get the C++ projects out there to work on so many compilers that can't agree with each other on what's legal C++?  It's high time for D to take over the world, Walter! Please!
> 
> Oh... DMC version 8.45 here.
> 
> -JJR


I actually got a little bit farther than that compiling Raknet myself. For this error, you just have to do

current = 0;
return current; // or return 0; or return NULL;

However, I came up against an even worse error saying it can't find the definition of one of the template members (find_node() or something) even though the function was defined in the right template. *sigh*

I've also tried just converting the whole thing to D, got fairly far, but in the end decided it probably wasn't worth it as I was coming up with more code I didn't know how to convert properly. You can see how far I got here ( http://svn.dsource.org/projects/warbots/trunk/RaknetPort/ ).

Maybe I'll try again in the future, but I've wasted countless hours trying to get it to work on windows already.

~ Clay





November 24, 2005
clayasaurus wrote:
> John Reimer wrote:
> 
>> Walter Bright wrote:
>>
>>> Did you email raknet and ask them to support DMC? Such things usually can
>>> help a lot.
>>>
>>>
>>
>> It seems that the RakNet developers know about DMC.  When you try to compile using DMC, they've included an #error message that pops up with "Digital Mars C++ : I don't know your compiler"
>>
>> They support very few other compilers beyond gcc and Visual C++.  In fact, I think those are the only ones.
>>
>> I've tried compiling it with DMC also.  Of course doing this led me into the wild goose chase of modifying the RakNet code to work with DMC. It's an absolutely horrible process.  I'm not sure if it's DMC's fault or the developer's fault, but there are tons of strange/foreign code techniques that DMC rejects.  Now I know why I've stuck with D so long.  C++ compilers just don't get along with each other!  It's like C++ itself is full of incompatible dialects.
>>
>> Here's one error, among many, that I'm having trouble with (perhaps I should have stuck this in the C++ forum):
>>
>> typename BinarySearchTree<BinarySearchTreeType>::node*& BinarySearchTree<BinarySearchTreeType>::find( const BinarySearchTreeType& element, typename BinarySearchTree<BinarySearchTreeType>::node** parent )
>>     {
>>         static typename BinarySearchTree::node * current;
>>
>>         current = this->root;
>>         *parent = 0;
>>         this->direction = this->ROOT;
>>
>>         if ( BinarySearchTree_size == 0L )
>>         {
>>             this->direction = this->NOT_FOUND;
>>             return current = 0;      // <--- ERROR!!
>>         }
>>  // ..... and so one
>> }
>>
>> Error: C:\Projects\c++\RakNet\Include\BinarySearchTree.h(598): reference must refer to same type or be const
>>
>> What do I do here?  I must not know enough C++ to fix this error.  I can't seem to cast the 0 to the BinarySearchTre::node* (at least that didn't work).  And the return type is a reference to a pointer... ewwww!!!  What a hodgepodge of ickiness! Is the above supposed to be software development at its finest?  Is that supposed to beautiful template code? :( (sorry, just ranting).
>>
>> Is it really worth trying to get the C++ projects out there to work on so many compilers that can't agree with each other on what's legal C++?  It's high time for D to take over the world, Walter! Please!
>>
>> Oh... DMC version 8.45 here.
>>
>> -JJR
> 
> 
> 
> I actually got a little bit farther than that compiling Raknet myself. For this error, you just have to do
> 
> current = 0;
> return current; // or return 0; or return NULL;

Pffff. How stupid of me. I should have thought of trying that.  Thanks.  I did try using NULL, but it wouldn't recognize it.


> However, I came up against an even worse error saying it can't find the definition of one of the template members (find_node() or something) even though the function was defined in the right template. *sigh*

Really?  I came across several similar problems that I was able to fix earlier.  I'll see if I come across that one, too.  There was quite a few things that needed to be changed, that's for sure.

> I've also tried just converting the whole thing to D, got fairly far, but in the end decided it probably wasn't worth it as I was coming up with more code I didn't know how to convert properly. You can see how far I got here ( http://svn.dsource.org/projects/warbots/trunk/RaknetPort/ ).

To tell you the truth, Raknet is one library that would look VERY good in D.  I can't stand seeing all that ugly C++ code.  I know others have told you it's not worth it to port it to D, but I'm thinking that it's one library that would suite D very well natively.

> Maybe I'll try again in the future, but I've wasted countless hours trying to get it to work on windows already.
> 
> ~ Clay
> 

I know the feeling.  Just curious... You did know you got a response at the dsource.org forums, right?  Mike84 had already succeeded in getting his version of RakNet interfaced with D on windows.  He must have done it a couple months ago.

-JJR
November 25, 2005
>  It's like C++
> itself is full of incompatible dialects.

Lol , so true.


> Error: C:\Projects\c++\RakNet\Include\BinarySearchTree.h(598): reference must refer to same type or be const

Good lord thats complicated looking code :S.

>   It's high time for D to take over the world, Walter! Please!

Here here!



"John Reimer" <terminal.node@gmail.com> wrote in message news:dm59ii$1739$1@digitaldaemon.com...
> Walter Bright wrote:
> > Did you email raknet and ask them to support DMC? Such things usually
can
> > help a lot.
> >
> >
>
> It seems that the RakNet developers know about DMC.  When you try to compile using DMC, they've included an #error message that pops up with "Digital Mars C++ : I don't know your compiler"
>
> They support very few other compilers beyond gcc and Visual C++.  In fact, I think those are the only ones.
>
> I've tried compiling it with DMC also.  Of course doing this led me into
> the wild goose chase of modifying the RakNet code to work with DMC.
> It's an absolutely horrible process.  I'm not sure if it's DMC's fault
> or the developer's fault, but there are tons of strange/foreign code
> techniques that DMC rejects.  Now I know why I've stuck with D so long.
>   C++ compilers just don't get along with each other!  It's like C++
> itself is full of incompatible dialects.
>
> Here's one error, among many, that I'm having trouble with (perhaps I should have stuck this in the C++ forum):
>
> typename BinarySearchTree<BinarySearchTreeType>::node*&
> BinarySearchTree<BinarySearchTreeType>::find( const
> BinarySearchTreeType& element, typename
> BinarySearchTree<BinarySearchTreeType>::node** parent )
> {
> static typename BinarySearchTree::node * current;
>
> current = this->root;
> *parent = 0;
> this->direction = this->ROOT;
>
> if ( BinarySearchTree_size == 0L )
> {
> this->direction = this->NOT_FOUND;
> return current = 0; // <--- ERROR!!
> }
>   // ..... and so one
> }
>
> Error: C:\Projects\c++\RakNet\Include\BinarySearchTree.h(598): reference must refer to same type or be const
>
> What do I do here?  I must not know enough C++ to fix this error.  I can't seem to cast the 0 to the BinarySearchTre::node* (at least that didn't work).  And the return type is a reference to a pointer... ewwww!!!  What a hodgepodge of ickiness! Is the above supposed to be software development at its finest?  Is that supposed to beautiful template code? :( (sorry, just ranting).
>
> Is it really worth trying to get the C++ projects out there to work on
> so many compilers that can't agree with each other on what's legal C++?
>   It's high time for D to take over the world, Walter! Please!
>
> Oh... DMC version 8.45 here.
>
> -JJR


November 25, 2005
"John Reimer" <terminal.node@gmail.com> wrote in message news:dm59ii$1739$1@digitaldaemon.com...
> Walter Bright wrote:
> > Did you email raknet and ask them to support DMC? Such things usually
can
> > help a lot.
> It seems that the RakNet developers know about DMC.  When you try to compile using DMC, they've included an #error message that pops up with "Digital Mars C++ : I don't know your compiler"

Them knowing DMC++ exists isn't enough. They need to know that there are users who want raknet to support DMC++. The way to do that is to tell them - the more emails they get from different people, the more convincing it is. Telling me doesn't help at all <g>.


November 25, 2005
"John Reimer" <terminal.node@gmail.com> wrote in message news:dm5j5j$1mba$1@digitaldaemon.com...
> To tell you the truth, Raknet is one library that would look VERY good in D.  I can't stand seeing all that ugly C++ code.  I know others have told you it's not worth it to port it to D, but I'm thinking that it's one library that would suite D very well natively.

I wouldn't be surprised if it turned out to be easier to recode in D than to try to produce a C interface for it. One of the problems with hooking up D to a C++ library is it still tends to drag along C++ problems - things like memory management, bloat, not handling UTF code, etc.


November 25, 2005
Walter Bright wrote:
> "John Reimer" <terminal.node@gmail.com> wrote in message
> news:dm59ii$1739$1@digitaldaemon.com...
> 
>>Walter Bright wrote:
>>
>>>Did you email raknet and ask them to support DMC? Such things usually
> 
> can
> 
>>>help a lot.
>>
>>It seems that the RakNet developers know about DMC.  When you try to
>>compile using DMC, they've included an #error message that pops up with
>>"Digital Mars C++ : I don't know your compiler"
> 
> 
> Them knowing DMC++ exists isn't enough. They need to know that there are
> users who want raknet to support DMC++. The way to do that is to tell them -
> the more emails they get from different people, the more convincing it is.
> Telling me doesn't help at all <g>.
> 
> 

Well we're in trouble then.  I bet the RakNet developer got a grand total of 2 emails.  One from Clay, one from me.  Quite frankly, it appears the raknet code is so compiler specific as to make the port to a new compiler a major headache, even for the RakNet developer himself. Since he provides his library free, his response is more likely to be "do it yourself."  That won't do, of course, for the moment.

After seeing all the subtle C++ conflicts amongst the compilers, I have one rueful comment:  C++, as we know it, is a farce, a fake, a false hope; it's a language full of ambiguities, one only a lawyer could love.  C++ is only useful if you stick to one compiler vender's dialect, and learn it well. What a joke! (forgive me... obviously I'm still in the blowing-off-steam mode; I just can't believe C++ has captured the hearts and minds of so many: it's very much like the emperor's new clothes).

As it turns out, the DLL version of RakNet, with a C wrapping, is the best option for interfacing with D, at the moment (dsource.org apparently already had such a wrapping).  Recoding in D would be a clean solution, though a hefty one and bug prone for the first long while. We'll see what comes of this.

-JJR
« First   ‹ Prev
1 2 3