Monday, November 21, 2016

I want to make a quick post about the tools I use to develop. I write code for both the client and server, and use similar tools for both.

On the server, I use CentOS Linux. I like Red Hat, and CentOS is the open source distro of their enterprise version. The server runs on an old quad core pentium that I used to use as a Windows machine. This is usually my pattern, when I replace a desktop box, (Assuming it survived...) it becomes the next server. I use SSH and Samba to access the server from my Windows desktop machine. I only use the text interface on Linux, no graphical display, nothing. In fact, I usually have the monitor turned off.

The Windows machine is where I do all the work. I save all files on the Windows machine, do all code editing on the windows machine, and administer the server through SSH terminals on that machine. Having all my source files in one spot makes backups easier (I just dump the entire directory as a .zip archive to an encrypted flash drive on a daily basis.) I keep the flash drive with me on my key chain (hence why it's encrypted.) so as to provide off site protection in case my house burns down or something.

When I compile the server, I run a batch file that copies the server source to the server via Samba and run a BASH script on the server that compiles everything in sequence. There are 4 of these scripts, "cleanall"and  "buildall", which clean the .o files and rebuild the server processes respectively, then "start" and "stop" which start and stop the server. The game server is a group of processes, each specialized to do a certain task and connected together through sockets and a messaging protocol. I monitor the processes as they run by tailing the log file they generate as they go along.

As a source file editor, I use PSPad. I really like it. It's fast, has a nice project manager, and it's fast. Did I mention that it's fast? I have all the client and server files in one project.

Given that, as you can imagine... my server code is really low level. Although I use the C++ compiler, I use little C++ itself, favoring straight up C. File and socket access are strictly through the low level C routines like fwrite() and send().

I take the same kind of low level approach in the Windows side as well. I use the base C windows libraries, no "Frameworks" or "Object shells." As a compiler, I use MinGW running in a shell window, very much like the server side. Sure, the makefile is more complicated, but the interface is essentially the same.

So when I turn the computers on in the morning, I first connect Samba by clicking on the share and entering my password, then I start an SSH terminal for administering the server, and an SSH terminal for each log tail I want to run (How many depends on what I plan to do.) I then start up a cmd window for MinGW to run from and start PSPad. By now, my trusty coffee maker has done it's part and I can get a cup of coffee and get to work.

The work flow is straight forward, I edit code... then run the batch file to copy it to the server, stop the server, makeclean, buildall, then start the server. If I'm working on the client, I make it on the WinGW cmd shell and double click the executable in the Windows Explorer window to run it.

Heh. When people come to my house and see me work, they probably think I'm hacking the Pentagon or something. Nope! Just a totally old school guy working on some game code!

No comments:

Post a Comment