TF and ATCP

by Tiran

Back to Mechanic's Corner.

Tiran2006-09-08 15:33:34
So, after the discussion in one of these other threads for people who wanted ATCP support in zMUD, I went home and figured out how to add it to TinyFugue. Since all the telenet negotiation stuff was there already, and I wanted to off-load the actual work to the user's macros, it was actually pretty easy to put in. The result is a new hook, ATCP, that hooks all ATCP subnegotiations from the server, and a function, atcp(), that works like send() (i.e. same syntax, without the flags) to wrap up ATCP subnegotiations from the client to send to the server.

So far I've managed to use it to pull the vitals line from the server, but it should work for anything, like the room name, exit list, character name, etc... The authorization routine is apparently going to be a bit tricy, due to the lack of bitwise operators in tf scripts, but it should be possible to code around that limitation, it's just not as pretty.

If there's people interested in using this, post here or send a PM and I can send you the patch files for the source. I can attatch them here if there's enough interest too.
Unknown2006-09-08 18:52:11
I'm curious as to what special negotiations ATCP does - I tried running a client on ATCP once and got a bunch of crap on my screen. When I took a look at the characters I saw strange things like IAC WILL <4-digit number> and other characters that don't make sense. From the tone of your post, it seems that everything works out right for you - please do post the code. (I'm not familiar with tinyfugue, but I can probably work out whatever problems I'm having by taking a look at your code.)

Edit: Actually, using ATCP will probably just cause problems for me. But I still want to see what the protocol is, from sheer curiosity.
Tiran2006-09-08 19:08:56
Here's the webpage that Zarquan pointed out that talks about it.
ATCP
ATCP is a special telnet option that games made with the Rapture engine can use to transmit out-of-band information to a client. The Nexus client for example uses these for the bars and exit compass. There's two parts needed, you have to have something to deal with the telnet side of things, and then be able to parse and respond to the messages. These changes handle the telnet side of the protocol. The actual interpreting and responding to messages side of the protocol, which is what you're probably more interested in, hasn't been done yet, beyond showing that I can send and receive messages, since each person may want to use different things the server may send.

When I get home tonight, I'll post the code patches and some examples of tf scripts to handle ATCP messages inside the client.
Tiran2006-09-09 02:50:40
Alright, here are the two patch files needed for ATCP support. Place rootpatch.txt in the root of your unpacked tf code directory, and srcpatch.txt in the src directory. Then run 'patch < rootpatch.txt' and 'patch < srcpatch.txt' in each of the directories respectively. (This is of course assuming you have some *nix variant)

You then need to run ./configure with the --enable-atcp option, followed by the usual make, make install.


Usage is like other hooks and functions. To display all ATCP messages received:
/def -hATCP recv_atcp=/echo %*
To send an ATCP message, in this case register to get your character's vital stats:
/test atcp("hello tf50b7^Jchar_vitals 1")

Note that ^J is generated by pressing ctrl-Q ctrl-J to instert a literal ctrl-J character into the stream.

To get other things you can register for, you'll probably have to connect through Nexus while running tcpdump or something. Or you can look through Whyte's Imperian MudBot code, there's a few in there. That's where I got most of this stuff from.

roopatch.txt:
srcpatch.txt:
Tiran2006-09-20 02:23:25
Alright, I finally figured out the problems that I was having with this. Apparently, the Rapture servers don't mix ATCP and MCCP very well. MCCP buffers the information on the server side until something condition is met, resulting in multiple ATCP messages for character vitals (for example) all being sent at once. My recommendation for using this patch is to make sure to /set atcp=on and /set mccp=off in your world configuration if you're going to use it.

I've got the authentication function coded with a pair of macros, and just need to finish up the triggers and hooks that take care of the login and authentication. I don't know if IRE wants those posted publicly, but it's a part of the MUDbot system already, so they're not exactly secret. Still, I'll just ask people to PM me if they're interested in those macros.