FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dchat program...

 
Post new topic   Reply to topic     Forum Index -> ArcLib
View previous topic :: View next topic  
Author Message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Wed Oct 19, 2005 5:58 pm    Post subject: dchat program... Reply with quote

I've been working on a simple D chat program to learn how to send data over the net using SDL_net. It can already send string data, I think I'm going to hook it up to heretic's serializer somehow and get it to send all the different data types over the net.

WarBot's dev will be 'stalled' until Dchat is done and the network serializer is completed, then I'll probably add a simple 'connect ip' 'disconnect' and 'chat' ability to warbots, followed up by some very basic multiplayer warbots.

Signing out...

~ Clay
Back to top
View user's profile Send private message AIM Address
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Thu Oct 20, 2005 11:52 am    Post subject: Reply with quote

Hehe, nice Smile That's more or less the way I wanted to do network communication. But then I realized that using a very simple protocol instead would also have its benefits. Like... I could write the bots in any programming language in which sockets are supported. Using serialization there would only add more work when creating libraries for different languages.
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Oct 24, 2005 12:11 pm    Post subject: Reply with quote

Networking is a bit more complicated than I imagined, and SDL_net is not really working for me. So, I think I'm going to attempt to port the excellent raknet to D (raknet is free using the GPL liscense). So far the c++ stuff is working for me, and it will give me a very solid xplatform foundation I can use to network with.

Since raknet is a C++ library I can't simply create a derelict package for it, it will have to be a full fledged port. If I ever get it done, I suppose I'll have it be its own project on dsource.

For those who don't know what I'm talking about, ... http://www.rakkarsoft.com/
Back to top
View user's profile Send private message AIM Address
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Tue Oct 25, 2005 3:32 am    Post subject: Reply with quote

Seems like everyone in the D gamedev community uses/wants to use RakNet Razz You might want to contact mike84 from these forums (the Damage project). He's got a working RakNet binding for D Smile
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Fri Oct 28, 2005 3:07 pm    Post subject: Reply with quote

Ok, I'll do that. I wonder if a full port would be worthwhile?

I get the feeling that binding a C++ library to D will leave something to be desired. Can you bind C++ classes to D? Or you just make a struct of C calls and use that as your class?

I understand how you can bind C libraries to D, but I don't quite understand how you can do so with C++.
Back to top
View user's profile Send private message AIM Address
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Sat Oct 29, 2005 1:17 pm    Post subject: Reply with quote

AFAIK, You might somehow compile the lib with the DMC++ compiler and use the C++ linkage... But the way around recompiling the lib is to make C wrappers around the C++ lib and then write D wrappers around these
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Sat Oct 29, 2005 3:10 pm    Post subject: Reply with quote

As far as I can tell DMC++ is only for Win32, Win16, DOS16 and DOS32.

I don't think I know the API well enough to make an effective C wrapper, plus not only will it add a strange sort of overhead, but you won't be able to use the Raknet docs (yes, I could write my own for the C wrapper, but I'd rather not).

Raknet API seems stable and the only problem would be patching to newer versions. The new versions will most likely just be bug fixes.

Plus Raknet code is incredibly clean and self sufficient. The author decided to rely on as little dependencies as possible (luckily decided against using STL), and uses x-platform C apps for dependencies (which are portaudio and speex). It also uses DDoc compatible comments ( http://svn.dsource.org/projects/warbots/web/bitstream.html ).

Anyway, I've already converted about ~3,000 lines of code alread by staying up all last night.

http://svn.dsource.org/projects/warbots/trunk/raknet/

It will probably take a month or two at this rate (~3,000 lines of code per week at best, because my time is extremely limited, but if i pull all nighters friday night i can get ~3,000 done in one sitting).
Back to top
View user's profile Send private message AIM Address
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Wed Nov 02, 2005 3:03 am    Post subject: Reply with quote

There's one huge difference between creating a simple wrapper for RakNet (or any other library) and creating a conversion. When you're only writing a wrapper, you just create it and use happily with any other future release of the lib. But if you want to have a conversion, its development doesn't end when you have the functionality you need. You will have to maintain the project, following its author... to apply his bugfixes and such.
Surely there is a performance penalty of having to 'call your way' through two layers of glue code, but remember that you only need to create a high-level wrapper, not a binding for all of the internal functions. How many times are you gonna invoke its functions a frame ? Having, say 20 network updates per frame, each of these might be just a few calls in the wrapper. The library (RakNet) may then internally call its specialized functions thousands of times per second, so the cost you're paying for a high-level wrapper is marginal.
You won't be able to use the documentation of the original library for the wrapper. But is there a need for it ? Even if you had RakNet natively in D, you'd probably create a layer over it, that suits your in-game/engine communications. And then you wouldn't be able to use RakNet's docs for it either. You'd have to create your own. But... much simpler ones. For the subset of the library's functionality that your project needs. Not much of a difference between creating a wrapper in C and binding that to D... You need a high-level interface anyway.
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Nov 03, 2005 12:36 am    Post subject: Reply with quote

True, I guess I should mess around with it (C wrapper to C++) and see what it is like before I start to do crazy things. Razz Thanks. *knocks head*
Back to top
View user's profile Send private message AIM Address
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Sat Nov 19, 2005 10:47 am    Post subject: Reply with quote

Wow. I actually attempted to convert the whole thing until I realized how futile that path is. So instead I made some 'cpp glue' and exposed D to it, and I am quite pleased with the results!

I not only got a chat program that uses remote procedure calls, I got a line drawing program that uses bitstreams (thanks to the irrlicht raknet guide).

http://svn.dsource.org/projects/warbots/trunk/cinterface/line.d
http://svn.dsource.org/projects/warbots/trunk/cinterface/lineserver.d
http://svn.dsource.org/projects/warbots/trunk/cinterface/chat.d

: ) Now I'll test to see if the code works on windows.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> ArcLib All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group