The first part of this blog appeared on November 19, 2010. I think I spent a couple of weeks digging through my old code in order to build the first demo. So the one year anniversary of the project is more or less now. According to my little time tracking program, I've spend 191 hours writing the blog, and 955 hours coding, for a total of 1146 hours on the project.
191 hours to write 39 blog entries seems like a lot, but I do fuss over the text quite a bit before I'm satisfied. Also, I include packaging and testing the demos in my "Writing" category. That probably takes an hour or so for each demo, to recompile the code on each platform, test it, zip it up and upload it to the site. Before I make a part public, I check all the links, download the demo on all three platforms and test it again.
In Part 5, I listed the directions I could take, after doing a very basic block world with movement, create and delete of blocks. I ended up picking "Direction 3: A More Interesting World", and dived into OpenGL, shader language programming, and portability. There was also a brief side trip into ray tracing.
Due to all the learning and tuning of graphics, I still don't have any kind of server. Despite introducing this as "Let's Code ... An MMO!", there's nothing like an MMO yet.
So this week, I wrote one.
On the client side, I started with the Landscape demo from Part 28. I ripped some pieces out of my old GUI project to give it an input field and text pane -- just enough UI to log into a server and chat.
On the server side, I took parts out of an old Java HTTP server I had, recoded them in C++ and turned that into a chat server. This sounds kind of odd, but I wanted the server to act as a web server as well. That allows me to add HTML-based admin pages and status pages, without writing some weird bridge from Apache to my server.
The client actually sends an HTTP request to the server with a special URL that routes the connection into the chat code. The client sends messages in my own format, and the connection is held open until the client disconnects, so it's not HTTP except for that first request. The clients are connecting on port 80 though, which will hopefully not trigger any firewall complaints.
In the longer term, I want to support wide characters. I just need to find out how they are handled on all three platforms, both for input and for fonts. Sigh.
It's been awhile since I did any network programming, and this is very lightly tested. We'll see how many people try it, and how many connections it can handle before falling over. That's what I'm really interested in with this demo, not the world itself.
I expect it will crash and I'll have to restart it periodically. Check back here for updates on availability.
Hosting the Server
I could run this out of my home and use my cable connection. There are "Dynamic DNS" services that will track your IP address changes as you reboot your machine. With nothing but text chat and position messages, my cable connection could probably handle this, but it's not a solution that will work for long. Soon I'll want to be sending buildings and so on to clients, and the bandwidth required will go way up.
I could rent a dedicated machine somewhere. Hosting Matters is the service I use for the blog, and their dedicated servers start at $139/mo. That's a bit steep, especially since I expect traffic to die down pretty quickly after each new demo. I don't want to sign a long-term contract and have it just go to waste.
After looking around, I decided to try Amazon Web Services (AWS). They have a "Micro Linux" virtual machine that is free for 12 months. That includes 600 MB of RAM, 5 GB of storage and 15 GB of bandwidth per month. For comparison, Hosting Matters reports that the blog has been using 6 GB of bandwidth per month.
I signed up for an AWS account, gave them my credit card and verified my identity with a phone call. Then you get pages and pages of very technical service setup instructions. Google found me this writeup, which was very helpful. I was able to log into my virtual machine, transfer files to it, install Apache and see it serve web pages.
I had assumed that you referred to the virtual machine with this long DNS name that appears on the AWS dashboard. That worked when connecting with it. To my surprise, when I shutdown and restarted the VM, it got assigned a new DNS name. It looks like you also need an "Elastic IP" which identifies your service, and then points to your virtual machines. I'm amazed they hand out static IP addresses for free, but that seems to be the case.
If I need more bandwidth and disk, the rates are pretty reasonable. It looks like for $70/mo or so, I could support a decent site, with bandwidth going for $0.12 per gigabyte per month. What I still don't know is how to limit the site to a certain cost per month. I don't want to have some DDOS attack (or bug in my code!) drive my bill through the roof.
My only previous experience with a hosted virtual machine was when I started this blog. I tried to run Apache on a server hosted by HazeNet. That immediately fell over under the traffic Shamus Young sent me, and I switched to Hosting Matters. So hopefully Amazon will do better.
Now back to putting together my solar system.
Still To Do
The tentative plan is this:
Obviously I have a long way to go yet before you can even build in the shared world. In terms of development order, I really should do #8, #9 and #10 before I let people start to build. As I've mentioned before, I don't want a lot of structures in there when I change the landscape. But I also want people to have something to do on the server, so I'm not sure what the right order is. When the time comes, I'll run another poll and see whether people want something temporary but usable, or want to wait for "final" landscape.
I hope I can get this all running by the end of the year. We'll see.
Here's the help text:
ESC to release mouse. F1 for help. W and S move forward and back. So do cursor up and down. A and D move left and right. Turn with cursor left and right, or with the mouse. Page Up and Page Down change your height. So do blank and 'X'. + and - change your speed. Hit Enter or '/' to open command line. Send command with Enter. /login name /logout /say message /yell message /w name message for private message /ignore name to ignore pests
For Windows, download LetsCode_part39_demo_win.zip
Since I still haven't felt like digging into the XLib and Quartz documentation, there is no text overlay support in the Linux and Mac framework, meaning this demo will not work on those platforms. That piece of work is getting more urgent. If a lot of you download this demo, perhaps I'll move that to the head of the todo list.
As mentioned above, I'm mostly interested in the AWS hosting. Go ahead and pound on the server. Let me know if it stops responding or is unreachable for you. I'll try to keep an eye on it and restart it when it crashes.
The goods news is the server has been up for a day and not crashed. On the other hand, the clients are sending position updates far too often and using up a lot of bandwidth. I've fixed that and incremented the version number on the server.
I had also forgotten to test this for OpenGL 2.1. I had based it on the Landscape demo, which worked under 2.1, but forgotten that I added the fog. I've now added fog shaders for the 2.1 version as well.
The download link above has been updated, so if you are downloading it now, you'll have the most recent version.
The other bad news is that there aren't enough people logging into the server to get more than one person at a time. To have anyone to chat with, we'll have to schedule usage times. I've created a status page on the site so you can check for other users. Go to http://188.8.131.52
That page also recommends some usage times:
Hopefully, these times will work for enough people. According to Google Analytics, my readers are coming from these locations:
I don't expect to do much more with the server until the Sea Of Memes solar system is complete.
blog comments powered by Disqus