Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUDs
➜ General
➜ Is GMCP still a thing?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
3
4
5
6
7
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Tue 28 Apr 2020 02:26 PM (UTC) |
Message
| Ref: a. https://www.gammon.com.au/gmcp
b. http://www.aardwolf.com/wiki/index.php/Clients/MushclientGMCP
Good day everyone,
I'm getting very involved in some interesting things with respect to my most recent MUD adventures. Latest thing is I have found out that GCMP (and others) exists. How exactly does one implement this into their SMAUG?
If I'm the coder, what exactly would I be doing to get data flowing within these little GCMP 'tunnels/channels' and then what would I need to do on the client side (MUSH) to get it to be used?
I've looked at the Aardwolf client stuff a bit, and is there a way for me to implement this on a mud if it currently doesn't have GCMP on it.
I believe this is a huge endeavour, but hey there are times to sit back, and there are times to start digging in code, right? (I'm also just sitting at home lately and have some time to burn...).
Thank you again for your support! | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #1 on Tue 28 Apr 2020 03:26 PM (UTC) Amended on Tue 28 Apr 2020 03:37 PM (UTC) by Fiendish
|
Message
|
Quote: I believe this is a huge endeavour
Honestly, it shouldn't be.
Quote: If I'm the coder, what exactly would I be doing to get data flowing within these little GCMP 'tunnels/channels'
Very little. Negotiation of capability at connection startup aside, the basic nutshell is that instead of just sending text to the player, you name the kind of data that you're sending, then assemble a json object (see https://json.org), and then put the bytes 0xFF 0xFA 0xC9 at the front and the bytes 0xFF 0xF0 at the end before sending it.
Like if you want to send the character name and level, you could send
"\xFF\xFA\xC9Char.SomeStuff {\"name\": \"Albus\", \"level\": 20}\xFF\xF0"
Aside from the "Core" messages, I don't think there was ever agreement on what the standard names or json collections should be, so you can kinda do whatever you want with those.
Beyond that, the IAC WILL/WONT/DO/DONT/Supports negotiation stuff is just so that you can decide whether it's worth your bandwidth to bother sending certain details if the player's client doesn't indicate support for them. Honestly with bandwidth and stream compression being what they are these days, I don't think that part is very important and you can just send everything to everyone. The first and last bytes already protect non-GMCP clients from doing anything with those messages anyway. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #2 on Tue 28 Apr 2020 04:15 PM (UTC) |
Message
| Thanks Fiendish! You are being optimistic and I like that.
This 'project' is a bit outside of my comfort zone as I don't quite understand all the coding aspects of it.
If we were to start really small: I want to implement just hp/sp. Can you walk me through how this would be implemented server-side?
I just need a start, and then I will hopefully be able to extrapolate for other mudstats.
Room info, object info.. stuff like that...
I know you said it shouldn't be a big problem, it's just a bit outside what I know! | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #3 on Tue 28 Apr 2020 05:14 PM (UTC) Amended on Tue 28 Apr 2020 05:21 PM (UTC) by Fiendish
|
Message
|
Quote: Thanks Fiendish! You are being optimistic and I like that.
Honestly, for most programming, knowing what to do at a logical level based on practice thinking like a computer is much more difficult than knowing how to write the instruction syntax. The latter is just translation. So you don't need to understand all the coding aspects as long as we can get you to understand the philosophy.
For your benefit I'd like to approach this conversationally. It will take slightly longer but I think it will be worthwhile.
Let's start by asking how you would send a message to the player. Any message at all. Like "hello <playername>" for instance. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #4 on Tue 28 Apr 2020 05:20 PM (UTC) Amended on Tue 28 Apr 2020 05:23 PM (UTC) by Xinefus
|
Message
| Alright,
so in game, if the person is in the same room as me, I would send a say command.
So I would input:
say hello!
In the output I would see:
You say 'Hello!'
<prompt>
Prompt being whatever it is that I make it. hp/sp, or a few other limited tokens.
Is that what you were looking for?
I've been reading this: http://www.gammon.com.au/forum/?id=10043
But I just need to understand it a bit more.. Maybe I just need to read the whole thread from start to finish! | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #5 on Tue 28 Apr 2020 05:22 PM (UTC) Amended on Tue 28 Apr 2020 05:25 PM (UTC) by Fiendish
|
Message
| That's definitely one perspective of how to send a message. But how does the server do it if the server wants to send you a message? Say for instance that the server wants to send you your prompt. At the very last step, after it has assembled the content of your prompt together from your stats, how does it finally transmit that information to you? Is there a function in the SMAUG code that does "send this message to player"? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #6 on Tue 28 Apr 2020 05:30 PM (UTC) |
Message
| Sorry, you can tell I'm a bit on the flustered side of things.
I need to examine more of the mud files to actually get you that information, I don't have full access to everything with respect to the mud at this moment. I'm trying to get a testport created so that I don't break anything in the meantime.
Give me some time to collect an answer for you. Then I will come back and hopefully have more to give. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #7 on Tue 28 Apr 2020 07:05 PM (UTC) |
Message
| Yup, no worries. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #8 on Tue 28 Apr 2020 08:04 PM (UTC) |
Message
| Ok, so I'm going to get the trusty homelab running..
Let's do this from scratch and then I can understand it.
Similar to the codebase I want to use is LOP 1.46.
In the act_comm.c there is this:
act( AT_SAY, "$n says ' $t &D'", ch, sbuf, vch, TO_VICT );
if( !is_npc( vch ) )
{
snprintf( buf, sizeof( buf ), "&[say]%s said ' %s &D&[say]'", capitalize( is_npc( ch ) ? ch->short_descr : ch->name ), sbuf );
add_phistory( 1, vch, buf );
Is this what you are looking for? | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #9 on Tue 28 Apr 2020 09:26 PM (UTC) |
Message
| Is LOP the codebase you want to use or is it one more familiar to you? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #10 on Tue 28 Apr 2020 09:28 PM (UTC) |
Message
| This is the one that is most similar to the one I am helping out with this.
I am familiar with it the most, yes. If familiar is a good way to put it. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #11 on Tue 28 Apr 2020 09:45 PM (UTC) Amended on Tue 28 Apr 2020 09:58 PM (UTC) by Fiendish
|
Message
| Ok great. So you're close but not quite right, but we can get to the right place from there. In LOP in the file you mentioned, you pointed to the line that says
That use of "act" with the parentheses and stuff is a call to a function defined in comm.c. It's the line that starts "void act". Looks like line 3378 in that file. In _that_ function is some more stuff, most of which you don't care about, but peppered throughout that function are some more function calls to things like "ch_printf" and "send_to_char". "send_to_char" definitely sounds promising and ch_printf probably stands for something like "print out this message to the character". Now those functions are defined in color.c. Do you see those functions in color.c? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #12 on Tue 28 Apr 2020 09:56 PM (UTC) Amended on Tue 28 Apr 2020 09:57 PM (UTC) by Fiendish
|
Message
| Now from there you should see that ch_printf itself calls send_to_char, so maybe we can ignore it. And from there you should see that send_to_char in turn calls send_to_desc, and that send_to_desc calls write_to_buffer with some colorization (which we don't care about). Now write_to_buffer is defined back in comm.c. Do you see write_to_buffer? At this point nothing else is being called, so that makes it our stopping point. I believe that write_to_buffer with the appropriate inputs will send a message to a client. Does your inspection of the code agree with that? Does it make sense based on how it's used elsewhere? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,068 posts) Bio
Forum Administrator |
Date
| Reply #13 on Tue 28 Apr 2020 10:18 PM (UTC) |
Message
| I would look for an existing message, for example, from comm.c:
if( sysdata.wizlock && !IS_IMMORTAL( ch ) )
{
write_to_buffer( d, "The game is wizlocked. Only immortals can connect now.\r\n", 0 );
write_to_buffer( d, "Please try back later.\r\n", 0 );
close_socket( d, FALSE );
return;
}
Basically the argument "d" there is the socket descriptor (the thing you write to). The descriptor is stored in the character data (ch->desc). So send_to_char extracts that for you:
void send_to_char( const char *txt, CHAR_DATA * ch )
{
if( !ch )
{
bug( "%s: NULL ch!", __FUNCTION__ );
return;
}
if( txt && ch->desc )
send_to_desc_color( txt, ch->desc );
}
Usually in the code you know the character because that is what you are processing when a particular character is being processed.
ch_printf basically does a "printf" with the output sent to the descriptor.
Here are some examples:
skills.c: ch_printf( ch, "Hitchar : %s\r\n", skill->hit_char );
skills.c: ch_printf( ch, "Hitvict : %s\r\n", skill->hit_vict );
skills.c: ch_printf( ch, "Hitroom : %s\r\n", skill->hit_room );
skills.c: ch_printf( ch, "Hitdest : %s\r\n", skill->hit_dest );
So if you can show hit points like the above, then you can do what Fiendish suggested earlier and wrap the GMCP stuff around it.
I suggest reading up a bit on how to use "printf" to understand what you are looking at.
For example printf reference. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #14 on Tue 28 Apr 2020 10:25 PM (UTC) |
Message
| I think I saw Alice on my way to write_to_buffer!
What is that stuff doing in color.c?? I suppose it wouldn't hurt to move it eventually... Another day another issue.
I was able to find the path you were tracking me down. Line 1236 of Comm.c
As my kids would say, are we there yet?
What I am able to get from that is write_to_buffer sets the string length and buffer size? defines copy..
but that certainly is the end of that chain.
Now we are at the very beginning? | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
195,626 views.
This is page 1, subject is 7 pages long: 1 2
3
4
5
6
7
It is now over 60 days since the last post. This thread is closed.
Refresh page
top