Chat it up!

Well, my server that I wrote at 3am today became a chat server. And that is only the beginning.

When I woke up this morning I got right back on it. First had to figure out how to get multiple connections to the server. So I had to rewrite it with threads. So now a new thread is created to handle every new connection from a client (which I also had to write. More on that later).

Once I go that working it took quite a bit of trial and error to get the message relaying between clients to work. I had to mess around with variable permissions but it all works now.

The client was interesting as well. It was difficult to get it to receive new messages from the server WHILE you are tryping a new message. I fixed that with two threads as well. Only problem is, if you are in the middle of typing a message and you receive a message it gets put in the middle of your text. That is probably why nobody has ever bothered to make a commandline chat program. But, this is only temporary for me.

Now, onto the point of all this. The way it is written, I can easily scale this up to work for an online game. Sending a message to the server is the equivalent of telling it that you have moved, and where you are moving to. Receiving a message from the server is the equivalent of the server telling you where everyone else is.

So, all I have to do is create a simple graphics engine to draw block people (just for now) and I can create a little virtual room for people to walk around in and interact. Which then can be scaled up into a full fledged MMO (massively multiplayer online game)!

I’d continue working on it now, but I’ve got a research assignment due tuesday, but I think it has to be submitted tomorrow. Plus I’ve got a birthday party to go to tonight.

I can’t believe how much fun the past 24 hours have been. It started with me writing a crappy little server out of boredom, and it is going to become something INCREDIBLE, as long as I keep at it. Looking back, WAY back, I try to figure out where this started. Why am I even doing this? And, the name Dransik keeps popping into my mind… how strange.

Leave a Reply

%d