The TCP/IP plugin... or TCP/IP in general.

Started by Akatosh, Thu 08/03/2007 17:29:46

Previous topic - Next topic

Akatosh

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?

monkey0506

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.").

Akatosh

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.

Da_Elf

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

Akatosh

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.

strazer

Please keep this thread about the technical implementation only.

There's already an extensive thread about multiplayer gameplay in the Popular Threads forum.

Akatosh

*sigh* Okay. So, anybody willing to do this? Or give me a few pointers?

scotch

#7
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...

SMF spam blocked by CleanTalk