when the community-made multiplayer mod for original GTA 3 came out years ago, I checked it out and soon realized it wasn’t all that much fun. there was one made for the sequel vice city too, and it had alot more features, and was actually quite fun for a while, but in the end you’d get sick of all the client crashes and lag problems. then a few years passed and I kinda forgot about the whole thing. since then there has been yet another GTA release (for PC), san andreas. so now I checked out the multiplayer mod for that, and wow, I was really impressed. the stability is so much better, and if you avoid certain weapons you can actually have a pretty fair gunfight on the streets without feeling that you’ve unloaded 4 magazines of tec9 in someones head and nothing happened. remember, this is done by hacking the internals of a single-player only game… it’s pretty much not been done before on such a scale.
the most interesting feature with the “SA-MP” mod is that you can run scripts server side to make unique rules for your server. the server’s behavior will be completely different from server to server things like weapons allowed, spawn points, text/UI on your screen, classes, objectives and special scriptable functions like banks, shops, houses…. there’s a good amount of API functions to use. from some of these servers, whole communities take shape.
I played around on servers a bit (but only for like 4-5 hours total) and soon realized that I could be writing my very own gta-mini-mmorpg variant. so I wanted too take a look at how the scripting worked. It’s done in a language called Pawn (formerly SmallC), familiar from things like the amxmod in the half-life engine (specifically, counter-strike 1.6 and below) servers. the general syntax is familiar from C or Java and it’s pretty easy to get into. then I found the MySQL plugin for the script engine, and pretty much just started coding and coding….
I never really looked into the existing scripts that were available in the community. most of them were just variants of one original huge script some guy made anyway, and I thought it would be more interesting to make everything from scratch with my own ideas. as it turned out, there was alot of work involved with this, doing basic stuff like registering, loggin in, setting spawn points, making car spawn locations, etc, especially since I wanted everything to be dynamic and stored in the mysql database
after about two weekends of work, I have a pretty nice foundation (~4000 lines of code), including user account system, a persistent player housing system with a couple of interesting features, dynamic administration of the server with adding/removing cars, spawnpoints, houses, etc. I also made a inventory system and raw-material gathering from various places around the map, with things like harvesting on field with a combine harvester, fishing, and more. one of the goals is to avoid making this rich 3d environment into a zork-style text adventure seen on some servers, where you have to type commands in text every time you want to do something. Instead, the script provides for on-screen menus and visualization, and events triggered upon things you do in the game environment such as entering a certain type of car in a certain area. my friend is helping me with some content adding stuff like making player houses, placing cars and spawnpoints etc.
an interesting side-effect of the mysql architecture is that you can really easily dump information out into webpages, and even allow for some web-based playing if you don’t have access to the real server. more info on the project later