No, not the source of the plague, but the source of the game. That’s right my friends, after a long and frankly embarrassing hiatus, I’ve decided to release the full source code for Zombie Wasteland Goners. The code is being released under the GPLv3 license. The goal of releasing the source code is two-fold: first, to allow other individuals to setup their own servers and second, to just put the damn code out there in case anyone wants to edit, tweak, or improve it, because unfortunately, I just don’t have the time and resources to carry this project forward any more. First thing’s first though, how do you setup your own server?!
OK, as I write this I have fixed my server and it is back online. Unfortunately the reason my server went offline for a few months there was that it completely crashed! This means all the user info was lost (sorry guys).
The newest version of ZWG is v0.20, and available from the downloads page. This version includes server selection. When the game starts it now asks if you want to connect to the default server (mine) or a custom server (yours). For the time being, you may continue to use my server, but should it ever go down again, here is how to setup your very own zombie server on any internet connected PC (huzzah!!!)
The very first thing you need to do is setup your server computer with Apache2, MySQL, and PHP. Often times when people setup servers they use Linux as the OS so if you want to take that approach, you can find a LOT of easy tutorials out there by googling “LAMP setup” (LAMP = Linux, Apache2, MySQL, PHP). Here’s one I recommend. In case you are using Windows though, don’t despair, because there are a lot of tutorials on how to set these basic services up on Windows too (here’s one I just found). If you encounter any troubles at this step, find a geeky cousin or friend and see if they can help you out. Honestly if you just poke around on google you should be able to find enough tutorials and help to get these basic services running.
Once you have your LAMP (or AMP) server running the rest is quite easy. Login to your MySQL database (any easy way to get clean access to your database is to install phpMyAdmin and then go to “localhost/phpmyadmin” in a web browser on your server computer). You’re going to create a database called “goners”. Next you’re going to create a table called “users”. When making this table, go ahead and create a column called “idx” which is an INTEGER that AUTO-INCREMENTS and its INDEX is UNIQUE. Now you’re going to make a few more columns, all of which should be TEXT types. The columns you want are “name”, “pass”, “hint”, “secret”, and “email”. You need to make 1 last column called “opt” but this column should be type BOOLEAN.
Phew! Still with me? To actually run the server you need the ZWG socket server script. This is a PHP script is self-contained, and runs the ZWG “socket server” (you don’t need to know what a socket server is but just know that that’s the name of our game server). To get the socket server running you need to make minimal changes to it. It just needs to know the login info for your MySQL database and your local and public IP address. You can open up the server script (zsockShell20.php) with any text editor you want. You should have a MySQL user name and password (often it’s “root” and “root” or “root” and nothing), edit the mysql_user and mysql_pass variables to be equal to your username and password. The script is going to access the “goners” database, so if you followed the steps above you don’t need to change that. The only other values you need to change are the ip_address and port. Please note that this is your LOCAL ip address. If you try to use a website or google to find our your ip address it will return your public ip address which is not necessarily the same as your local address, so please follow these next steps.
To find the local ip_address on your computer, if you’re using Linux type “ifconfig” from the terminal window. In Windows typing “ipconfig” from the command line should work. In either case, after typing those commands you’ll get a list of the network connections on your computer. Look for your ethernet or wireless adapter and then look for the ip address listed (“inet address” in Linux and “IPv4 Address” in Windows). In my case the address was 192.168.1.111. Whatever your address is, put that in the php file for ip_address.
Holy jeez you’re almost there! The last step really, is to decide what port to use. If you don’t know anything about ports, leave it as 2081. If you do know about ports, change it to whatever you want/need it to be. And… now you’re done fella. Open up a new terminal window (Linux) or command prompt (Windows) and navigate to the folder that contains the socket server file (zsockShell20.php). Then type “php zsockShell20.php”. Voila… the server should initalize (in the newest version of php I get some warnings when I initialize the server… sorry about that. The php file may need some updating, but they’re just warnings, it should still run fine). Assuming the server is working you can go to google and type in “what is my ip address”. It will tell you your public ip address. This is the address you will give to your friends for connecting to your server. Make sure to give them the port number too if you changed it from 2081. When they start goners they just need to enter your public ip address and port and hit connect and they should be able to play through your server! If you watch your terminal windows/command prompt where you’re running the socket server, you should be able to see every time that your friends do something or speak to your server! (NOTE, that when you reboot your computer or anything like that you will need to restart the php script. Open a new terminal window/command prompt, navigate to where your php script is and type “php zsockShell20.php”. You need to do this every time you want to turn your server on and if you close the window you’ll stop the server).
The only possible hitch you guys might encounter is if you use a router at home. You’ll have to turn on something called port forwarding on your router. Each router is different so you’ll have to take it upon yourself to figure this part out, but the basic idea is simple. When someone connects to your public ip address on a certain port (e.g., 2081), they’re trying to send your server data. The router is getting these messages but doesn’t know which computer should be getting these messages. Port forwarding tells your router that any communication on port 2081 (or whatever port you ended up using) should be sent to your server’s local ip address. So you need to go into your router’s settings and forward all 2081 (or whatever port you used) communication to the local ip address of your server. (It sounds hard to do but believe me it is easy once you look up how to do it).
Anywho, voila! Enjoy! I hope it all works. I’d like to say let me know if you encounter problems and I will try to help but I’m going to be dead honest with you guys, you’re better off turning to google or posting on message boards asking for help. The whole reason I’m putting all this code online finally is that I just don’t have time to maintain the game any more. You can try messaging me if you need help, but just a heads up, I can’t guarantee a quick response.
THE REST OF THE DAMN CODE
All right, so you downloaded the server code, put up your own server blah blah blah. We both know that you want more. You want to edit my game, change stuff in it, maybe improve the damn thing or fix something that’s been bugging you a long, long time. Well you know what? Go ahead. I’m making the source code for the actual game is available under the GPLv3 license. What this license means is that the game has to remain open-source, and that you can’t close it up and try to sell it or anything like that. The good news is that means anyone can now tinker with the game, the bad news is that you’re going to be subject to my messy, messy code. You can get the full source code for ZWG here.
I should say that I fully intended to clean up the game’s inner workings, but largely by not having enough time to finish a game comes not having enough time to clean up a game. So the code is provided here as is. I can’t make any guarantees about its readability or promises to help people decipher it. That said, I do try to comment my work as much as I can and use sensible names/structures for things. But you’ll have to be your own judge for how good a job I did. I know that means it might be hard to wade through, but hey, better than nothing, right?
To edit the code you’re going to need a Flash AS2 editor and compiler. I was compiling the game into Flash 9. If there’s any other essential info that people need about the code I can provide it if you contact me, but there shouldn’t be much else you need to know. If you do want to tinker, the network code exists entirely in one action script and the game’s logic code exists on another (frames 2 and 10 I believe). So now you know where to find everything.
Lastly, I’ve packaged up all the art and resources you’ll need to compile the game. Enjoy. There are some incomplete tilesets that were never implemented like stores and supermarkets and such. Originally I envisioned the city being much more diverse with different types of buildings and different types of objects being found in buildings. I never got around to implementing a lot of those ideas, but you’ll see in the art that I was working on it.
Guys, it has truly been a blast. When I first had the idea for ZWG so long ago, I never really thought it would see the light of day. I remember scribbling down some notes about, what I thought would be, a fun and interesting zombie game, but I never thought I’d have the time to really try to put it together. Not to mention I didn’t think I knew enough to program an online game (this is my first attempt). Little did I know that one day ZWG would be implemented. Yes, there were more ideas I had that never did see the light of day, but in all honesty 90% of what I scribbled down that first day ended up in the game.
Thanks for playing. Thanks for reading this. And don’t let the game die. Zombies, after all, are supposed to live forever. Maybe one day I’ll be able to come back and finally finish goners the way I had originally envisioned. But as I said, the game right now isn’t that far off. Either way, until then, it’s up to you to feed it with your decaying corpses, or maybe even take up the challenge of building on the game that I started. Ciao folks! Happy hunting! And have fun with all this!!!