Jibble

Author Topic: A TCP/IP pluggin compatible with AGS 3.x.x  (Read 12370 times)

A TCP/IP pluggin compatible with AGS 3.x.x
« on: 04 Jul 2008, 16:28 »
Yes, i readed a lot of different topics about the only pluggin created to give AGS network capabilities, but for what i understood it is unssupported from a long time ago, and the pluggin was simple and even buggy from the beginning. The Pluggin creator probably feels discouraged since nobody uses it (i believe there are no releases in the GB with multiplayer capabilities)  ::) Of course, if nobody uses it, why you will improve the work?

I donwloaded it and give it a LONG try, but looks like is absolutely impossible to make it compatible with AGS 2.72 (previous step before upgrade to 3.x.x).  For practice purpouses, AGS actually do not have any kind of support for Network games.  :-[ (If someone can update the existing pluggin to work with AGS 3.x you will be my hero  ;D)

I believe, for what i read in the AGS changes log, that AGS become from a Aplication to create AdvGames into a Medium-level progaming language oriented to AdvGames, but not limited to it. The supression of the interaction editor in versions 3.X and highers makes that now create a game is 98 percent time writing code. Since amlost all features can now be declared in run-time (and more to come, hopefully) makes AGS a really powerfull tool which can be used for more things that just create the simple AGs created with the first versions.

But the Network capabilities are highly demanded today for languages and game-makers creators, and probably a lot of people choose diferent options just for this reason. I personally give a try to different options in the last months (wintermute, gamemaker, sci studio, 3D studio and many others) and for sure AGS is FAIRLY the most complete with the 3.0.0 version. But it have a litlle hole there, and everyone knows that the new era games works around interactivty with other humans

My knoweledgments in C++ are limited, but i believe enough to create a new pluggin with someothers colaboration (could be a very interesting way to improve my skill with this language). Since this is not really a MONSTER job (many games here requires 100x more work than this) i hope many programmers and scripters join the proyect. I just want let you all know that im the first to offer my services.

Any one else? You can reply here or PM to start the work. Updates can be posted in this topic.

JpSoft

scotch

  • Mittens Viscount
    • scotch worked on one or more games that won an AGS Award!
    •  
    • scotch worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #1 on: 04 Jul 2008, 16:52 »
AGS's focus has changed very little since the interaction editor was lost. It's true that you are required to write script commands instead of filling out interaction editor dialogs that do the exact same script command tasks, but the logic is the same. You do not need to spend much time thinking about script in the new AGS if all you use are the options that were in the interaction editor.

Additionally, the script language hasn't changed, nor the focus on adventure games. The engine is near identical to before and no more or less suited to non adventure games. Only the editor has changed. A form of interaction editor may reappear some day, and if it does it will be much more user friendly than the old one.

Nobody should think of AGS as another tool for general game development. All the engine features are highly geared towards point and click adventure games, that is why it works so well for that task, and relatively poorly for platformers/rpgs/etc.

Now about TCP/IP... I don't mind volunteering a bit of effort to make a working plugin, I am skeptical about if it would get used or not, but multiplayer experiments would be fun... I'll post back later if I get round to it.

bicilotti

  • Guest
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #2 on: 04 Jul 2008, 18:06 »
I believe, for what i read in the AGS changes log, that AGS become from a Aplication to create AdvGames into a Medium-level progaming language oriented to AdvGames, but not limited to it.

Probably not the right place to express an opinion, but seconded.

I have also dreamed to have a working tcp/ip for 3.x.x.x, to experiment a bit with "human interactions".

scotch

  • Mittens Viscount
    • scotch worked on one or more games that won an AGS Award!
    •  
    • scotch worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #3 on: 04 Jul 2008, 18:21 »
"I believe, for what i read in the AGS changes log, that AGS become from a Aplication to create AdvGames into a Medium-level progaming language oriented to AdvGames, but not limited to it.
...
Probably not the right place to express an opinion, but seconded.
"

I don't see how you could get this impression from the recent changelogs, unless you hadn't realised there was a script language before, because it's virtually the same now as it has been for years. All recent changes are based around AGS's main purpose, of being a focussed traditional adventure game creator. If it was about being a general purpose game development tool you would see the script language being beefed up with general programming features, and movements away from character system, built in pathfinding, walkable areas, hotspots, etc.

AGS is not, and hopefully never will be like Game Maker, pygame etc. It would be pointless. That's not to say I wouldn't value improvements that make AGS more versatile, that benefits everyone, but not if it means forgetting why AGS exists.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #4 on: 04 Jul 2008, 18:26 »
Bloody hell it would be fun for someone to support a RON server.. and many things.. you know.
No more military army stuff. I'm alive and back.

bicilotti

  • Guest
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #5 on: 04 Jul 2008, 18:46 »
"I believe, for what i read in the AGS changes log, that AGS become from a Aplication to create AdvGames into a Medium-level progaming language oriented to AdvGames, but not limited to it.
...
Probably not the right place to express an opinion, but seconded.
"

I don't see how you could get this impression from the recent changelogs,

Gahhh stupd me I picked the wrong section. I meant to quote the part where he was stating AGS can be used for far more wider projects than "standard" AGs.

scotch

  • Mittens Viscount
    • scotch worked on one or more games that won an AGS Award!
    •  
    • scotch worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #6 on: 04 Jul 2008, 22:36 »
Well ok, here's a start. Not tested or for release or anything. But whoever wants TCP/IP can play with it and suggest interface improvements.

The interface doesn't echo real tcp/ip sockets exactly, it's simplified for AGS use.
struct Socket {
    bool Open(const string url, int port); // returns true on success
    void Close();
    bool Connected();

    void Write(const string data); // write data into the socket
    void WriteInt(int value);
    void WriteByte(int c); // write a single byte value between 0 and 255
    void WriteFloat(float f);
    int ToWrite(); // amount in write buffer
    int Flush(); // sends buffered write data and returns how much was written

    int ToRead(); // amount in read buffer
    String Read(int limit = -1); // read a string out of the buffer
    int ReadInt(); // read an int, will return 0 if there's not enough data so remember to check ToRead
    float ReadFloat();
    int ReadByte(); // read a single byte value between 0 and 255
    int Poll(); // read incoming data into the read buffer

    static Socket* Create();
};

struct SocketServer {
    SocketServer* Create();
    bool Listen(int port); // begin listening for connections on a port
    void Close(); // disconnects all clients and stops listening
    void Update(); // queues new connections and polls/flushes all clients
    Socket* GetNewSocket(); // returns an incoming connection or NULL if none pending
    int GetNumSockets();
    Socket* GetSocket(int id); // access to the client sockets so you can interate over them
};


I think this set up should be fine for most purposes but do suggest improvements. One issue with String reading is that you can't recieve NULL bytes, AGS won't allow them to be put in the string. This is fine for some protocols but not others. You would have to use ReadInt/Byte to get 0 characters properly. I would leave it to module authors to write robust HTTP libraries or easy game value synchronisation etc.

Some of the functions should become variables, like .connected or .toRead, but that's just tidying up. Poll and Flush are automatically called once per frame, but they are provided so that people can block on reads if they want, or reduce lag.

Here's an example of Roger querying google (put it in a default game)

Code: [Select]
function room_AfterFadeIn() {
    Socket* cs = Socket.Create();
    if(cs.Open("www.google.co.uk", 80)) {
        cEgo.Say("Opened a socket, sending request.");
        cs.Write("GET / HTTP/1.1\r\n");
        cs.Write("Host: www.google.co.uk\r\n");
        cs.Write("Connection: close\r\n");
        cs.Write("Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n");
        cs.Write("Accept-Language: en-GB,en;q=0.9\r\n");
        cs.Write("Accept-Charset: iso-8859-1, utf-8, *;q=0.1\r\n");
        cs.Write("User-Agent: AGS (Windows NT 5.1; U; en)\r\n\r\n");

        cs.Flush();
    } else {
        cEgo.Say("Failed to connect");
        return;
    }

    while(!cs.Poll()) {
        cEgo.Say("Waiting for a response...");
    }
    cEgo.Say("Recieved %i bytes.", cs.ToRead());
    String response = cs.Read();
    int bodyStart = response.Contains("\r\n\r\n") + 4;
    cEgo.Say(response.Substring(bodyStart, 255));
}
« Last Edit: 04 Jul 2008, 22:45 by scotch »

Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #7 on: 04 Jul 2008, 23:01 »
I don't see how you could get this impression from the recent changelogs, unless you hadn't realised there was a script language before, because it's virtually the same now as it has been for years. All recent changes are based around AGS's main purpose, of being a focussed traditional adventure game creator. If it was about being a general purpose game development tool you would see the script language being beefed up with general programming features, and movements away from character system, built in pathfinding, walkable areas, hotspots, etc.

Well, without any doubt AGS now contains features that were uninimaginable when the project starts, and there are few some that i cant imagine how could be used in any AG. Also, do not forget that now the script is object-oriented (is really necessary to create AGs?) and the BIG limits the engine currently have (absolutely unnecessary for any AG-creator in the next 100 years ;D) But this is not a discussion about if AGS must remain ONLY to create AGs or must be more versatile, its just about create a team-work to develop a new pluggin to offer AGS-users an extra capability, whatever if they will need it or not. (exactly the same as other pluggins: you use it only if you need it)

As for sure a lot of people will finally select AGS to create their games if they know that it have the capability to work via TCP/IP, EVEN IF THEY NEVER USE THIS FEATURE (very probably, since creating any program with multi-users is a real hell):) And for the ones who will use the pluggin, they will offer a new angle of game design yet undiscovered here. Im not talking about a pluggin to allow AGS print sellings reports (and saving tonner at the same time  ;)) is to allow net-work games creation via the engine.

Jp

EDIT I were writing while you post. Nice apportation!!. I will work on it as a start point.
« Last Edit: 04 Jul 2008, 23:07 by JpSoft »

bicilotti

  • Guest
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #8 on: 04 Jul 2008, 23:38 »
Well ok,

Neato! Downloading it now!

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #9 on: 05 Jul 2008, 09:45 »
Scotch, you rock!

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #10 on: 05 Jul 2008, 16:25 »
I think, i'll mast.. eh, to the toilet. Scotch lately you've managed pluging in every sort of wish an agser could do.
No more military army stuff. I'm alive and back.

scotch

  • Mittens Viscount
    • scotch worked on one or more games that won an AGS Award!
    •  
    • scotch worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #11 on: 05 Jul 2008, 18:33 »
Just pointing out that even though this was moved to the module/plugin archive, it's not ready for use, but I will sort out the missing features as and release it as it is if nobody complains.

One thing I'd like to sort out is the String reading/writing NULLs problem. I could add an option to escape/unescape null characters I suppose.

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #12 on: 05 Jul 2008, 19:29 »
Now, to make an AGS-based IRC client...  :=

Then a stickam client...  ;D ;D ;D

scotch

  • Mittens Viscount
    • scotch worked on one or more games that won an AGS Award!
    •  
    • scotch worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #13 on: 05 Jul 2008, 20:32 »
Bit late, that was the first thing I tested it with.
People look even stupider coming out of Roger.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #14 on: 05 Jul 2008, 22:09 »
Once I get a hang of this I'll make a Hitchhiker's Guide to AGS. Supporting all types of characters and stuff. So wait for it...
No more military army stuff. I'm alive and back.

AGA

  • Adventure Game Aficionado
  • Administrator
  • Mittens Deity
  • ¡Qué alí­vio!
    • Lifetime Achievement Award Winner
    • AGA worked on one or more games that won an AGS Award!
    •  
    • AGA worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #15 on: 06 Jul 2008, 03:05 »
Just pointing out that even though this was moved to the module/plugin archive, it's not ready for use, but I will sort out the missing features as and release it as it is if nobody complains.

Er that was me. Didn't realise this forum was an archive only. It's not like I actually use AGS.

Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #16 on: 07 Jul 2008, 10:59 »
Null strings could be fixed with a key-simbol,(¬¬) for example.

I will work on a well documented example which will include an optional module to optimize the pluggin use.

Jp

Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #17 on: 08 Jul 2008, 21:23 »
Im unable to use the pluggin. I get the error "There was an error loading plugin 'ags_sock.dll'. Unable to load plugin 'ags_sock.dll'. It may depend on another DLL that is missing"

Im using Win XP SP2 with .NET 2.0. AGS works correctly and the PC is connected to internet via LAN. I tryed in many PCs (even one without LAN connection) and i always get the same error.

Im not sure the reason of this error, but i guess probably is a Win library i dont have (which one?)

Please, let me know if someone else have this same trouble.

Jp

EDIT I forgot mention: using AGS 3.0.0 , 3.0.2 and 3.0.2 SP1 i got the error. I dont have 3.0.1 to test with it
« Last Edit: 08 Jul 2008, 22:33 by JpSoft »

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #18 on: 08 Jul 2008, 21:49 »
I have the same thing, and i actually id copy a number of dlls to make the plugin possible for importation the first plae..
No more military army stuff. I'm alive and back.

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on one or more games that won an AGS Award!
    •  
    • DoorKnobHandle worked on one or more games that was nominated for an AGS Award!
Re: A TCP/IP pluggin compatible with AGS 3.x.x
« Reply #19 on: 08 Jul 2008, 22:04 »
Works fine here. Using WinXP and AGS 3.01, no problems at all.