Peer-To-Peer Serverless Multi-User Internet Chat Conferencer

User projects written in or related to FreeBASIC.
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Post by Ryan »

I think I need to understand what a zstring is more. I've seen it used in example code around here and tried finding info in it on the Wiki, but it's new to me. Can you post just a little blurb about it? Also, thanks for the info you've already given. I've been wondering how in the world to go about transferring files... like if I should just send all my data in a regular buffer string and have it construct the file on the receiving end or what. Thanks for the help!
cenozoite
Posts: 243
Joined: Aug 21, 2005 21:41

Post by cenozoite »

A zstring really isn't that different from a regular fixed-length string. The main difference is that it can be addressed/treated like an array of characters, with each index being the ascii value of the character in question. So that if you had:

Dim Message as zString * 10
Message="Hello"

Then you could access each letter of that word as an index, as follows:

Print Message[0] ' would print the ASCII value of "H", which is 72
Print Message[1] ' would print the ASCII value of "e", which is 101
Print Message[2] ' would print the ASCII value of "l", which is 108
Print Message[3] ' would print the ASCII value of "l", which is 108
Print Message[4] ' would print the ASCII value of "o", which is 111

It's really not that different from going:

Print ASC(Mid$(Message,1,1))

...etc etc... but note that a zstring is null-terminated, meaning there is always a chr$(0) tacked onto the end, so you must take that into account when trying to fll it with a value. If a zstring is dmensioned as being 10 characters long, you can really only use the first 9 for values, since the last one will have to hold the unprinted null character.

If you fill it with a shorter value, like the word "Hello", it will automatically add a null character right after the end of it, in this case at the sixth character, Message[5], to indicate the end of the string value. FB will consider the string value to end at the first occurance of a null character, even if there are further non-null characters after it.

However, all that being said, you can just as easily use a regular string for almost any purpose, including winsock file transfer. I just used a zstring because that's what the Send and Recv functions in the winsock header call for. But it will work even with a normal string.
Chronos
Posts: 40
Joined: May 31, 2005 15:21
Location: KY, USA
Contact:

Post by Chronos »

cenozoite wrote:Thanks for the suggestions, guys. Having the program be able to act as a psuedo-server in order to update IP Address and connection lists is an interesting idea, and would create sort of a persistent P2P chat network that was always up and running in one form or another.

With decentralizaion being one of the main appeals of P2P apps, I'd probably implement it as a local function that created and maintained a community chat ring based on previous connections, rather than a huge global one that publicly listed everyone using the program all over the world. That way only your friends could see when you're online, more like an instant messenger buddy list than an IRC global user list.

Chronos,
I'll look at your previous code and add the /roll and /ooc commands shortly.. but two questions:

Should OOC just bracket the text, like:
[Chronos] (I need to get a drink) ... or have the term "ooc" printed somewhere too?

And should roll involve only the rolling of the specified number of D6's, or would an option to roll other polyhedral dice be useful too?

VirusScanner,
FileAnchor has brief periodical downtimes, but was working for me just a second ago when I tested it. If it still doesn't work for you next time you try it, let me know and I'll set up an alternate download mirror.
You got the OOC bit correct. The latest "Over-IM" RPing I did used parentheses to indicate out of character. Since characters can't talk with parentheses (it looks funny) they work well for OOC.

And the roll command, as Xerol commented, should be something like "/roll 2d6", though it should be supported to roll more than 9 dice. Up to you to decide if it shows the result of each roll or not--I didn't do this for ease of code--blame laziness.
Ryan wrote:Looking for a MUD to pay, Chronos? ; ) I've been working on a server for a while that I hope to turn into one. I've just been trying to learn more about linked lists and client/server connections. I've played/coded in Rom MUDs for about 10 years now and figured I'd handle things in a similar fashion (except the skill system). Really, I'm not sure what it will become, but if you're interested at all, feel free to email me.
You *kinda* got it, though as a designer at heart I'd be looking for a few features. (At one time I tried to write a MUD using the BYOND [Build Your Own Net Dream] system, but areas were hard-coded, so I stopped work on it. The project got no interest and no help either...) If your plan is to implemt an OLC and modular skill/spell/race files, I'd definitely be interested in trying it out. Especially so if this will be done in FreeBASIC, since modding MUD software is the way most admins personalize their MUDs. But I'm cluttering up this topic with Off-topic chatter, so I'll stop now.

The reason I show so much interest in this is that I'm creating a paper and pencil RPG with a local friend of mine, and I wanted the added ability to play it online over chat. IRC is good, but getting things set up, and public IRCs ChanServ problems held me back from this goal. MSN is fantastic, but can only hold 5 members--1 GM and 4 players, no observers. Now that there's a multi-chat client out there that will support RP commands, I've taken a particular interest. I also like the thought of not having to worry about that 5-user limit to MSN for a change. :P
cenozoite
Posts: 243
Joined: Aug 21, 2005 21:41

Post by cenozoite »

Chronos,
As you can see, the /roll and /ooc commands have been implemented and function as requested and described. No limit on the number of dice or the number of sides per die. Any numbers will work.

Does MSN Messenger really limit the number of users in a chat conference to five? I had no idea, and had always assumed it was unlimited too. What about Yahoo messenger?
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Post by Ryan »

Thanks for the great help, cenozite.

And Chronos: yeah, I plan on a more dynamic world such as OLC is w/ Rom. I'd love to go even more dynamic than stock Rom to the on-line race/class settings, maybe even game appearance and more, though skills will still need to be hardcoded. I'm still learning to be able to do all this. I wish Rom wasn't so huge... I'd just port it. = P
Chronos
Posts: 40
Joined: May 31, 2005 15:21
Location: KY, USA
Contact:

Post by Chronos »

Yahoo Messenger supports "Conference Chat", but I don't know its user limit. I do know it is possible for a seemingly unlimited number of users by making a Chat Room.

OOC and Roll work wonderfully--thanks! This is shaping up to be the chat client of choice when and if the RPG I'm working on ever is completed. :P

Thanks again, and keep up the excellent work!
Torahteen
Posts: 91
Joined: Jul 15, 2005 15:58
Contact:

Post by Torahteen »

Hey ceno. I think that a server mode would be great too. If one could choose to run a server that some can just /join then that would be perfect for RPGs. You've made me want to post-pone (sp?) Raptor for a bit and make a full RP client. Say...

Chronos and Ceno, you two wanna join together to make the ultimate FB RP client? I think it would be good experience for me, and it would be a useful tool also.
KiZ
Posts: 48
Joined: Aug 25, 2005 7:38
Location: UK
Contact:

Post by KiZ »

looks cool, crashed my computer though :( (win98)
cenozoite
Posts: 243
Joined: Aug 21, 2005 21:41

Post by cenozoite »

Torahteen,
I am currently in production of version 2, and am incorporating as many desirable features as I can think of or have been mentioned, including investigating viable methods for persistent connection updating. Simply allowing the user to run a server is tricky though, because the vast majority of internet users, broadband and dialup, have dynamic IP addresses that change every time their computer crashes or reboots, which is frequent for Windows users. So as soon as the server goes down, its previous IP address is no longer valid and it can't be reached upon re-running. So it would have to be something like discussed earlier, where a small persistent community of machines constantly checked and updated each other, in the hopes that at least one of them has remained up during the downtime and has an up-to-date IP list for all the others.

Once I have completed and released version 2 to satisfaction, I'll be happy to add any requested RPG-oriented features and commands, in order to make an ultimate RPG client. Or even better, release the source code and let everyone collaborate simultaneously. That just takes a bit longer, because cleaning up my code for public legibility is a colossal endeavor. I code quickly for speed and convenience, and unless I'm writing a tutorial I don't worry about making it readable to anyone else. As a result it's not just spaghetti code, it's friggin' fettuccini code, and I wouldn't feel right turning it loose upon this world.

Kiz,
Can you be more specific about the sequence and nature of the crash? I have run the program successfully on Windows 98 systems with no problems at all, so I don't think it's a general OS incompatibility. How far did you get into it? At what point did it crash? What did you do just before that to cause it? Any information you can provide will help me look into it.
Thanks!
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Dynamic IP Solution

Post by Ryan »

For running my web server and testing my MUD code and other internet code, I use no-ip.com. You choose your own domain name (midvale.no-ip.org) and download their IP updater program. Any time your IP changes, just run that program and it updates their server. As long as your chat program can resolve host names and not just IPs, this would be a great recommended (free) solution to your users.
Chronos
Posts: 40
Joined: May 31, 2005 15:21
Location: KY, USA
Contact:

Post by Chronos »

You beat me to the punch. I was about to suggest anyone wanting to server use no-ip.com's service. That way you can reach the server computer no matter its IP, for instance..well, Ryan's example covers it. Even if your IP changes from 12.34.56.78 to 12.34.67.89, No-IP will catch it and send all users who go to youraddress.no-ip.com to your server.
KiZ
Posts: 48
Joined: Aug 25, 2005 7:38
Location: UK
Contact:

Post by KiZ »

cenozoite wrote:Kiz,
Can you be more specific about the sequence and nature of the crash? I have run the program successfully on Windows 98 systems with no problems at all, so I don't think it's a general OS incompatibility. How far did you get into it? At what point did it crash? What did you do just before that to cause it? Any information you can provide will help me look into it.
Thanks!
Sorry for not being more specific. I just tried it again, and it crashed in the same way. I just start it, press "6" for help from there forwards, everything is completely frozen. Even ctrl alt del doesnt work. Have press the reset button.
cenozoite
Posts: 243
Joined: Aug 21, 2005 21:41

Post by cenozoite »

Ahhh..... 6 (Help) is the only menu option in the program that invokes Graphics Mode, which almost always causes any Windows 98 system to crash. The devs will probably want to look into that at some point, as it seems to be universal. Windows 98 cannot run FB programs that use GFX mode.
KiZ
Posts: 48
Joined: Aug 25, 2005 7:38
Location: UK
Contact:

Post by KiZ »

What exactly do you mean by "gfx mode"?

All SCREEN invoked gfx windows work fine for me
thesanman112
Posts: 538
Joined: Jul 15, 2005 4:13

source....

Post by thesanman112 »

Hello, im wondering if i can have a peak at the source code..you seem to have set out to do what alot of us have been thinking or attemping of doing. Myself i did it in qb with winsock, (wsloader.exe was the actual shell of winsock to qb) I would be interested in helping to beta test, and possibly using the guts of your proggy to make a file shareing program similar to kazaa, or limewire, although if you think about it, the potential would be great for gameing, no more servers to fill up!
Post Reply