Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Akatosh on Thu 08/03/2007 17:29:46

Title: The TCP/IP plugin... or TCP/IP in general.
Post by: Akatosh on Thu 08/03/2007 17:29:46
Yes, I know, there is a thread about it and it has an author. But the thread was inactive since nearly a year now and the author didn't log in for about that period of time. So I think starting a new thread is justified. Please correct me if I'm wrong.

So, yeah. The TCP/IP plugin is kind of, well, broken and incompatible with the current AGS version. I did a (brief) research, but I was completly unable of finding a version except the broken one... but I'd really like to try my coding skills on a simple and fun Multiplayer game for which the idea has been brewing in my mind for AGES. So, any idea how to solve my problem? Is there a running version for that plugin available? Or any idea how to work around it?
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: monkey0506 on Sat 24/03/2007 04:38:42
Just to put this out there, I don't really understand advanced C++ scripting that well (everything I know I've taught myself from "beginning C++" books), but I've looked at some C++ TCP/IP libraries that could probably be used to create a new plugin. If anyone with more advanced knowledge than my own was willing to take the time to write it.

A lot of the issue with that though is probably the fact that no one ever used the plugin in the first place, so most people probably wouldn't see the point in writing a new one.

Just my two cents though. And we all know how far $0.02USD will get you these days ("Please take one step back sir. That far.").
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: Akatosh on Sat 24/03/2007 14:16:36
Hm... well, if I really spent some time on this, I think I could make a plugin like that... but I'd rather prefer something which isn't that much work. Hm. Still, I'd like a plugin like that. Another two cents from me, makes $0.04.
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: Da_Elf on Sat 24/03/2007 17:37:20
with a plugin like that would AGS be good enough to have a multiplayer game where one person walking into a room as one player would show up in the other persons screen in realtime? that would be really cool where it could either be a race against eachother to finish the game or somehow using teamwork to finish the game
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: Akatosh on Sat 24/03/2007 17:41:57
Or multiplayer for the RPG I'm coding right now. Y'know, the one featuring a strange fruit in combat suit with the text "U.N.T.O." next to it  :=
(or, in other words, my avatar)

/EDIT: Or, to answer your question: That would be quite difficult to implent, but possible, I think.
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: strazer on Sat 24/03/2007 20:54:09
Please keep this thread about the technical implementation only.

There's already an extensive thread about multiplayer gameplay (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=12421) in the Popular Threads forum.
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: Akatosh on Sun 25/03/2007 10:13:01
*sigh* Okay. So, anybody willing to do this? Or give me a few pointers?
Title: Re: The TCP/IP plugin... or TCP/IP in general.
Post by: scotch on Sun 25/03/2007 17:23:13
Just read up on winsock, and design a simple API that AGS scripters could handle, maybe something along the lines of

struct Socket {
    // General Stuff
    String read(int numBytes, int timeoutMilliseconds=0); // returns a null string if it times out or if the socket isn't connected
    String write(String bytes);
    bool isServer();
    String getRemoteURL();
    int getRemotePort();   
    String getLocalURL();
    int getLocalPort();
    bool isLocal();

    // Client stuff
    bool connect(String url, int port);
    void disconnect();
    bool isConnected();
   
    // Server stuff
    bool listen(int port);
    Socket* getNextIncomingConnection(); // returns a socket that's newly connected, if there is one in the queue
};


The main potential problem I can see with this kind of system is that AGS Strings probably don't like having NULL bytes int them (the plugin API takes NULL terminated strings, anyway), and many protocols contain them. I don't think it's a problem for AGS to AGS communication, but if you wanted to do some http binary downloading or whatever, then a workaround would be necessary.

Edit: Some helper functions would be nice for sending AGS values, also. Stuff like int readInt(), void writeInt(int) and so on...