This page is best viewed with Mozilla Firefox

The new forum is located at: http://jayecifer.com/cyberpunk/




DEVELOPER BLOG of JOHN D. KARLGREN



What is this?
This is the developer blog of John D. Karlgren (well, me!), creator and programmer of a yet-to-be-named cyberpunk-themed online massive action/roleplaying game. In my team of renegade hackers are also Joel Segerbäck who is doing graphics and music for the game, and Michael Cline who is also doing graphics and lots of other important things, like hosting our discussion forum. The game is a futuristic hack'n'slash RPG which visually resembles a mix of GTA and Diablo 2, and plays like CircleMUD. As a matter of fact, CircleMUD has been the main inspiration for the server code, and players, mobs, objects and rooms in my game are handled in a very similar way. Some of the mood in a CircleMUD-based MUD is also present in the actual game. My very first idea was to make "a graphical MUD" which would be loosely based on the CircleMUD source code. I then found out about similar games like Daimonin, Tibia, Graal Online and Endless Online which further fueled my inspiration.

Who am I, by the way? Maybe I should introduce myself a little more. I'm 26 years old, and live in a semi-big city called Örebro in Sweden. I've been programming in C and SDL for about 3-4 years, and OpenGL for about 2 years. I got years of previous programming experience with AMOS on the old Amiga, QBasic in the DOS days, some Borland Pascal, mIRC script (I once wrote an entire MUD-server in it), and lots of PHP and MySQL programming. I don't really consider myself a "good" programmer though. I probably write a lot of sloppy unoptimized code for most of the time, and I'm completely retarded (I mean it!) when it comes to math and calculations. That's why I'm still doing 2D games while every other programmer and his mother are doing the next Quake.

But I've come to turn the 2D retro-style of my games into my own little trademark, and I'm very comfortable with it. Actually, I never intended for this game to have any kind of 3D-elements at all when I first planned it and started working on it. However, I eventually realized that I wasn't gonna be able to give the game the visual mood I had worked up in my head unless I did atleast some parts in 3D. For example, skyscrapers don't look like skyscrapers at all in top-down 2D. The client uses a very simple technique which I call "tile cubes" for drawing 3D environments from a 2D map. I admit I ripped the idea from the first two GTA-games, but it was just so clever and it was just what I needed. My engine is slightly more advanced than the GTA one though. For example, shadows are generated in real-time in mine, while shadows in GTA were edited in with the map editor. Also, my engine is no longer limited to just tile cubes of equal size.

I started this game project sometime in may 2007, and I think it's my third attempt at writing an MMORPG (if I may be so bold as to use such definitions). My previous attempts failed because I wasn't quite ready for the task, and I was still a beginning C-programmer. But after having finished a small game called Action Cyborg I decided to try again, and things have been progressing smoothly for 1 1/2 year now. I work on the game more or less everyday, doing everything from programming and scripting to graphics and playtesting.

The game is written in C using SDL for input/timers, OpenGL for graphics and FMOD for sound. The server also uses LUA for various scripts related to the game's content. The style of the game is 80's cyberpunk/dark future. This is because I'm very, very, VERY interested in those kind of themes. I've also felt for many years that there are no real "true" cyberpunk games out there. Yes, I enjoyed games like Circuit's Edge, Dreamweb, Beneath a Steel Sky and Blade Runner very much, but I've always felt that something is missing. I feel I've been searching for something which can't be found. That is also one of the main reasons why I decided to create my OWN cyberpunk game! With this project, I feel I can fully explore the theme in way that suits me, and at the same time be in control of every detail.

If you just got here, I suggest you scroll down to the bottom of this page and start reading upwards. Looking at the screenshots from 1 1/2 year ago today, I'm quite impressed myself by how the game has evolved since then. And it's constantly changing and getting even better, and hopefully it'll be ready for a first public release very soon (I hope in early 2009).

If you wanna get in touch with me, please e-mail me on: hq(at)terrorpunksyndicate(dot)org or leave a message on our forum at: http://jayecifer.com/cyberpunk/.

Thanks for stopping by!



19 June 2009 - yes, yes, I know...
...what you're thinking. But the project is NOT dead. It's just that sometimes I lose motivation (or inspiration), and I just don't feel like working on the game. This happens sometimes, because I'm mostly alone on this project. What most people don't know is that I've lived a pretty chaotic personal life, and still do sometimes, and that's when this game project suffers. But now I'm back on track again, and I'm fixing bugs, adding some new features, updating some previous ones, creating graphics, adding missions, items and characters and the whole thing is back at expanding again! I'll post a more detailed update soon.



8 February 2009 - don't you just love memory leaks?
Now, this is a pretty fun way to spend an entire wednesday night:

I accidently discovered that the server program was leaking memory, and quite a lot too after a while. I found that restarting the server with the in-game /restart command - which resets the game world without closing down the .exe - caused the memory usage to slightly increase. That's pretty funny, because restarting the server is supposed to FREE memory, not eat up even more! I had no idea what was wrong, so I had to do it the hard way. That means commenting out code until the problem goes away, and thus finding out where (but now necessarily how) it occurs. It took a while to find the leak, but when I did I was pretty surprised. I had ABSOLUTELY NO IDEA that strdup() didn't free memory at the end of a function call. In my code, I had several functions looking something like this:

char *return_something() {
   char str[BUFFER_SIZE];

   return (strlen(str) ? strdup(str) : NULL);
}

There's nothing wrong with that code though. But I had no idea whatsoever that memory wasn't freed after the function had been called. So I figured the client must be leaking memory as well, because I use similar functions in there as well. I launched the client, pressed CTRL+ALT+DELETE and observed the memory usage in Windows Task Manager. After 15-20 minutes or so, the client was using over 100(!) MB of memory! And this while just letting it sit at the TITLE SCREEN. Jesus Christ! But now that I knew what was wrong, I fixed it pretty quickly. The client now uses between 7-25 MB instead. That's a lot better, no? :-)

But the biggest new feature since last update is probably the automatic updater I've written, which took me the whole Saturday. And then I spent the entire night and Sunday morning to polish it. Because of the dynamic content of MMO-games, it is essential to be able to automatically update players with all the changes that are constantly made, and spare them from painstakingly having to manually download the latest patch, unpack it, apply it and THEN finally - if they did everything in the right order - be able to play. So I wrote this updater and added it to the game. It is still not entirely finished though, because it can't update the client .exe yet. Just the resources (graphics and sounds). Here's how it works, step by step:

1) All graphics and sounds are prepared using a small utility (which I've also written), which takes a .BMP or .WAV file, compresses it and stores the compressed data in a file along with a date stamp header.

2) The server and client then shares an index (= a list) of all the files required by the client.

3) Upon connecting to the server, the client searches through every file in this index, grabs the date stamp header on each file (which the CLIENT has) and sends it to the server.

4) The server then compares the date stamp on the file (which the SERVER has), to see if they match. If they don't, it means the client must update, so the server simply starts sending the newer file back to the client.

5) But if the date stamp did match, the server just responds "OK", which means the client can skip to the next file in the index.

6) And this is then repeated until the client has finished checking all files in the index. Piece of cake!

Checking the date stamps takes only a matter of a few seconds. I mention this because I noticed that there's now a slight delay for 2-3 seconds when logging in, because both the client and server has to loop through the index and check the date stamp header on each file. This is a bit slow, yes, and I guess I could optimize the server by pre-grabbing the date stamps ONCE when the server starts, and store them in memory instead of re-checking the files on each client request. Also, the client must be able to update the client .exe itself as well. This is really the ONLY thing that doesn't update itself right now. All graphics and sounds are distributed and updated automatically, and so are the mapfiles (rooms) and the world map. My friend Karl in England gave me an idea though, which I for some reason hadn't thought about earlier. I could just write a simple console application and name it patcher.exe and include it with the game client. By using another .exe, it would be possible to update the client .exe as well. The patcher would connect to a server and check all files using the same principle as now, but also grab the latest client .exe and overwrite the previous one! Yay!

Also, it would be a lot better to let the patcher download the files from an FTP or website instead, to prevent the game server from using up bandwidth. The date stamp checking could still be performed against the game server, because the sizes of those network packets are so small that they're not even worth mentioning. Each packet is only 15 bytes in size, so checking the 150 or so files used by the client takes up only (15 * 150) / 1024 = ~2.19 kilobytes. It's nothing.





Speaking of compression, there are two very useful libraries out there which I would like to recommend to my fellow game developers. The first one is Basic Compression Library (BCL for short), which I've been using for a couple of years now. I found out about it when I was looking for a free-to-use compressor/decompressor to include with my game. The second one is called miniLZO which I started using just a few days ago. Through experimenting, I've found out which library and what compression algorithms work best for different content. For mapfiles (rooms), I use the LZ-encoder from BCL. It's very slow when compressor, but the files end up EXTREMELY small in size and they decompress instantly. For the world map, I use the RLE-encoder from BCL. The file actually came out smaller in size when using RLE instead of LZ. It's usually the other way around. For the graphic files, I use the LZ-compressor from miniLZO. The biggest reason is because BCL is unusuable here. It takes FOREVER to compress the files, while miniLZO is almost instantaneous. And the result is amazing - 50 MB of graphics are compressed down to 7 MB in a matter of a few seconds! And finally, for the sound files, I use the Huffman-encoder from BCL. This is because - for some reason - both the LZ-compressors from BCL and miniLZO are unable to compress my .WAV files. The compressed files actually came out even larger. Looking at the miniLZO source code though, I read a comment about how sometimes files are uncompressible. I guess that must be the case for .WAV files. Don't ask me why, because neither ZIP or RAR has any problems with them. The Huffman-encoder was however able to compress them down to 75% the size or so, which is still too big in my opinion. But it'll have to do for now.


So what else is new?

  • Added melee skill Leg Trip which causes an opponent to fall down on the ground for 5 seconds. In the meanwhile, he/she is unable to move or fight.

  • If a player is attacked by an aggressive mobs while he has the K-9 guardian with him, the mob will randomly (50/50) select who it will attack - the player or the K-9.

  • I got rid of the annoying "seams" which were appearing between textures when linear texture filtering was enabled. I found out through some quick Google research that OpenGL occasionally chooses the pixel from the other side of a texture map to sample from, that sampling wraps around textures. In other words, the "seams" were actually the edges of the opposite sides of the texture. Now, wasn't that obvious! (irony). The solution was very simple though - when placing a texture on a polygon, I just had to start a TINY little bit INTO the texture, and also END the same tiny bit EARLIER. That prevented OpenGL from choosing the opposite sided pixels.

  • If a player is resting, a text saying <RESTING> is now displayed next to his name, making it easier for others to notice.

  • Items can now be set to have attribute-requirements. For example, a bullet proof vest may require a player to have a certain ammount of STRENGTH to be able to wear it.

  • Rewrote the command interpreter and made it able to fetch commands "MUD-style". In most MUDS, the player isn't required to spell an entire command to execute it. For example, typing just "t" would be short for "tell", or "rep" would be short for "reply". I added this to the interpreter so that lazy players are able to type faster :-)

  • Pressing TAB now cycles widgets in a GUI-window. For example, while filling in your name and password to logon the server you can press TAB to jump from "name" down to "password".

  • The client now also dynamically allocates and frees memory for sound effects, just like it's doing for textures. Because there are quite many sound effects in the game now, loading each and everyone at startup isn't very convenient in the long run. Instead, the program now only loads the sounds it currently needs, and removes them from memory again if they haven't been played in a while.

  • Mobs who yield no experience points now have the text (NO EXP) displayed next to their names.

  • Increased the range (in tiles) for firearms.

  • Added the possibility to "tilt" the camera during the game, changing the top-down view to an, ehrm..... I can't find the english word here. But if you ever played Warcraft III, you probably know what it looks like when you zoom in/out using the mouse scrool wheel. Well, that's how it looks when tilting the camera. :-) It's still highly experimental for now, because there are lots of artifacts introduced while tilting. But I've begun fleshing them out. Being able to tile the camera is gonna be a very nice feature and give even more depth to the game's "feel". And it actually looks allright, even with the 2D sprites.

  • And finally, I think I've been able to prevent both the client and server from crashing for a while now. I found that for some STUPID IDIOT REASON I've completely missed adding error-checking before attempting to send network packets. No wonder why the server was randomly crashing each time a player disconnected. DUH!


  • On Thursday night to Friday morning we did a little spontaneous test run of the server. We were at most four people playing on it simultaneously. There was me (Sweden), Karl (England), my girlfriend (Sweden) and cmk (USA), and it ran like a charm! I was so happy to see it finally running stable and people enjoying playing the game. Karl played it for over 6 hours(!) straight. And during this entire time, the server randomly crashed just ONCE. And I believe I've fixed that now, too. There were some other crashes too, ofcourse, but that was because of a typo in one of the LUA-scripts, so I don't count those. :-) By the way, I was very happy to talk to Karl again. Thanks for coming back, man (if you're reading this).

    Oh, and by the way... The game STILL needs a name! Aaah, the frustration! I rewrote the name generator and made it a little more effective. It now takes the list of words and places them two by two, listing all possible combinations. The results are saved to a suggestions.txt file instead of printing them, like the previous version did. Download it and give it a try! Maybe you'll be the one who comes up with a name for the game! That would mean A LOT to us all. I also included the source code this time, for you paranoid people out there. :-)





    3 February 2009
  • Rewrote active combat skills yet again (this is the final rewrite). Current skills are Kick which do instant damage to an opponent, and Adrenal Surge which doubles the attack speed for 5 seconds. Both skills have a cooldown time to prevent spamming.
  • Joel did a truely awesome sprite for dogs, which were added to the game as stray dog enemies!

  • Because of the dog sprite, I also added a K-9 Whistle item which can be bought and used to summon a level 15 K-9 guardian who will fight at your side. I just had to make some changes to the code for handling pets, so this was pretty easy to add. The dog helper is REALLY useful, especially on tougher enemies. If the dog should die, the player may revive it at the pet store in HyperMall for a small cost.
  • Pets now also teleport when a player teleports, instead of just being removed (like previously). This was pretty annoying, because a player then had to re-summon his pet after each teleport.

  • Finally added a world map after having received several requests regarding one. The previous minimap was removed and replaced with a GPS receiver (how futuristic!), which displays all outdoor areas. The world map is edited using the map editor, by simply placing rooms next to each other. An RLE-compressed version of the world map is then distributed to the clients as they logon to the server. Players may scroll the world map up/down/left/right in the GPS-window, and look up room names by holding the mouse pointer above a room. I must say that I'm pretty proud of this little feature. A couple of months ago I didn't even have the slightest idea of how I was gonna approach something like this, so I'm actually kinda amazed myself.
  • Because of the world map, I also added the possibility to add "special" widgets to GUI windows, which call an external function to draw the widget. By doing this, the "rules" and limitations of the GUI can be bypassed when needed.

  • Removed the PvP attack protection for players under level 10, and instead added a PvP-flag to rooms which can be set to allow PvP combat in that particular room. If PvP combat is possible, the text "FREE FIRE ZONE" will display under the room's name as a player enters it. Starting areas are ofcourse protected against PvP combat, so that newbies won't be scared off :).
  • Polished the shop window a little bit. Now, when browsing a shop's inventory, the player is informed of any discount (or added cost) on items sold by that shop. In the example to the right, you can see we're dealing with a pretty greedy bastard! He has added 25% to the cost and he only pays 12% of an item's original value!
  • Added the possibility to flag objects (items) as "unique", limiting the amount of items of a specific kind a player can hold in his inventory. This is, ofcourse, more or less stolen from World of Warcraft. The K-9 Whistle for example is Unique (1), meaning a player may only have ONE whistle in his inventory at a time. This is to prevent players from bringing an unlimited amount of "backup" dogs with them. In short words, a player may only have ONE dog.

  • AFFECT_BLEED (a character bleeding) which is triggered after landing a critical hit on an opponent now lasts for 10 seconds instead of 5. Previously, the opponent would receive 1 damage each tick (second) while affected. I rewrote this so that the damage received is now a random number between A and B, where A is 5% of the opponent's maximum health, and B is A * 2. This makes bleeding much more lethal, and should inspire players to place additional Character Points in Luck (which increases the critical strike chance).



  • 24 January 2009
    It's saturday night and it's update time! It's been a while - I'm sorry - but you may rest comfortably knowing that development is still going very smoothly. In four months, the game has been in development for 2 (TWO!) years. Most of the server and client code is more or less finished and relatively free of bugs, so nowadays I'm mostly working on content for the game. With content I mean things like locations, textures, various graphics, items, characters, missions and all those things. Because of how the server and client has been programmed to function, adding new content to the game world takes only a matter of minutes. Locations are added and edited by using a map editor (which I too have written), and placing characters and items in the world are done by simply adding them to various text files which are loaded by the server program. Missions are handled through LUA-scripts which can be added and modified in real-time, without even restarting the server. In short words, things are very SIMPLE.

    Let's start off with some recent screenshots...



    I shouldn't announce things just yet, but I really believe and feel that the game will see its first public release within just a few months from now. Yes, it is THAT playable. It will require some kind of 24/7 server to run the server application and handle connections, but this isn't really an issue. I can always hook up a dedicated server in my own closet and let people play on it. It's not like we sit on 56k modems these days, and this game doesn't even require any mentionable bandwidth.

    So why are things still taking so much time? Well, because I mostly work alone on this project. I don't know if it's my fault - maybe I'm a complicated person to talk to? - but it appears that people who were once so dedicated and attached to this project have vanished into thin air. I see their names on MSN, and once in a while I try to strike up a conversation, but nothing really happens. I miss your help guys. If you're reading this, and you still wanna help out, just e-mail me or page me on MSN anytime! Your help is really invaluable!

    Also, another thing that has been bothering me for quite some time is that there is STILL no NAME for the game! This is becoming a problem, because I'd really like to register a domain, set up an official website and announce the game to the public. But I can't do that before a NAME has been decided on. And Cyberpunk Online, being simple and all, just won't do. One strong reason why I vote against it is because of the Cyberpunk 2020 role-playing game from R. Talsorian Games. It is too similar. And I also feel that having "cyberpunk" in the title sounds pretty cheesy. So, because of my obviously poor imagination, I wrote a little utility for randomly generating game titles. You can download the program here (469 kb). Open a command prompt and run namegen.exe and it will generate a list of possible game titles. Words are looked for in names.txt which comes with the program. You may freely edit names.txt to add or replace words of your own choice. If you should find a name that sounds cool and fitting, DO NOT hesitate to let me know ASAP!

    Ok, time for the update list...

  • Glasses/shades worn by characters are now visible on the character sprite

  • Added ABSTINENCE to characters. Abstinence is gained by using drugs and medications, and range from 0% (clean) to 100% (fully addicted). Abstinence adds a penalty to ALL attributes (str, dex, int, etc...), up to 25% (at 100% abstinence). However, if the character continues to take drugs (and thus also increases the abstinence even more!) and stays intoxicated, the penalty is ignored. But as soon as the character sobers up, the penalty is introduced again. Abstinence decreases down to 0% by itself over time, just like FATIGUE.
  • Even more slope types for tilecubes.

  • Smoke coming up from grates on the ground. This is part of the particle system.

  • The four different light settings in a (game)day now fade into each other, like a cross-over effect. This makes night turning into day (and vice versa) look much better than just switching instantly.
  • Torches on walls. Also part of the particle system.

  • Characters may now dance (animation) at different speeds.

  • Added a flashlight. It lights up the scene around the character, but that's all it does for now. Later on, I plan to have pitch black locations which require a flashlight for the player to see anything at all!

  • I changed FATIGUE to function like abstinence. Instead of adding a penalty to damage given (like previously), fatigue now instead adds add a penalty to ALL attributes (str, dex, etc...). Like abstinence, 25% (at 100% fatigue) is max. This penalty stacks with the penalty from abstinence.

  • Joel (fisk0) created graphics for an ED209-inspired guard robot called F.R.O.G. (because it resembles a frog!). The sprites have been added to the game engine, but the robot hasn't been placed anywhere in the game yet.

  • In order for abstinence to function, items can now be of type OBJECT_MEDICINE and carry a value for how much abstinence (in %) the drug is supposed to give the consumer.

  • Added a profanity filter which is handled server-side. Words like "fuck", "cunt", etc are instead replaced by random letters, like this: !@#$%. The profanity filter can be toggled on and off by typing /profanity.

  • Added a zoom-out function to the client by pressing F9. Being able to zoom out can be pretty useful when scouting the player's current location.

  • Item graphics now scale to more realistic proportions when they're displayed as lying on the ground or floor. They are otherwise displayed as fixed size 32x32 pixels.

  • It is now also possible to TALK to shop keepers (characters with a CHARACTER_SHOP flag), and not just trade with them. While this sounds trivial, it required some code to be rewritten.

  • Added "delayed actions", which are actions that take some time to perform. An example is searching through dumpsters in the city. Previously, the player would just right-click a dumpster and immediatelly find out if he found anything in it. Now, a progress bar saying "Searching..." is instead displayed for a few seconds, before the player is presented the result. This can be used for a lot of different actions. Another example is the slot machines in the HyperMall arcade. Now, when clicking them a "Gambling..." progress bar is displayed for two seconds, before the slot machine presents a win or lose.

  • Items with 5% or less drop chance are considered RARE, and display in purple text colour instead of normal blue. I plan to add some hard-to-find items with much higher values than normal ones.

  • And last but not least - HACKING. Once a player is level 10 or higher, he may learn the Hacking skill from a skill trainer, purchase a Cyberdeck and start hacking terminals around the city. Hacking is handled automatically when right-clicking on a terminal. If the player succeeds in hacking, he receives a reward in the form of floppy disks and/or CD's containing information. These are just trash objects, but can be sold to shops and data dealers. Terminals also levels ranging from 25 to 100. If a terminal has a HIGHER level than the player's Hacking skill - say the terminal is level 85 and the player has a 50% Hacking skill - the player will have his brain fried by the terminal and DIE instantly!


  • And now for something fun to end this update...

    This is the F.R.O.G. robot guard walking animation. It looks a bit weird now that it's not actually moving, but it looks very cool in-game! It also has a light in front of it (the same lightmap used by motorcycles) during night time. If you step close to it, it'll say "STAND CLEAR, CITIZEN". And unless you have a death wish - don't attack it.


    2008 updates
    2007 updates


    (C)+(P) Studio Stök 2007-2009