Pages

Tuesday, August 31, 2010

new health system details

Today, instead of doing homework/reading, I had a long talk with Whales at #rgrd who is working an awesome zombie roguelike, Cataclysm. That got me thinking about my own game, and we threw around ideas until I came up with one that I'm pretty satisfied with. I decided that not only am I sticking with the body part based system, but I am expanding it further. Previously, it consisted of a list of 6 body parts, and a lot of stuff was basically hardcoded in to work with those 6 parts. The new system instead uses a tree system. Each bodypart has the capacity to contain children bodyparts, and each bodypart has a weight for random selection. What this means is I can group together the bodyparts like this:
One of the awesome things about this system is it's a lot more flexible than the old one. I can easily add other parts, such as internal organs. It will also bring about some major gameplay changes. Armor and augmentations will now be assigned on an individual basis to each body part, meaning you can mix and match armor parts (shoulder pads, leg armor, boots, etc).  I'm also going to make left and right play a prominent role for arms. Your right arm will be your primary arm (right handedness is assumed for simplicity's sake). Your left arm will be your gear or blocking arm. This means you will be able to equip each hand separately (dual pistols, pistol/motion scanner, riot shield?). Two handed weapons will receive a big penalty if your left hand is not empty or if the weapon is held in the left hand because of a wounded right hand/arm. The left arm will also automatically attempt to block some melee attacks (either by a skill check or by an increased random weight; I haven't decided yet). This, combined with the customizable armor, should make for some interesting situations. I can see a heavily armored left arm and an unarmored right arm being a viable option for characters who plan on getting in close during combat.

Because of its tree structure, I can easily pick a random hit location given a part using recursion. Non-aimed attacks will simply go on the Body and it will choose one of its children, who will in turn choose from their children, and so on. I'll also be able to easily add targeted attacks which will give the option to aim for either the head, torso, or legs.

Each of the parts still has an individual health level and they'll still behave a lot like the parts in the old version. There are a couple key changes, however. There will now be an additional total health, which will reflect the sum of damage to all body parts. For instance, if your total health is 80 and your limbs are each 20, then having all 4 limbs severed would kill you. The trade-off, is that I'm ditching the bleeding out. It will be replaced with Pain, which will be increased when damage is taken and decrease over time or by using drugs. Pain will have a few negative effects, such as a negative modifier to speed.

Sorry for the long post!

Saturday, August 21, 2010

improved projectile system

Today I worked on rewriting targeting and shooting. It's not completely done, but I ended up with what I feel is a greatly improved system.
This is a picture of the new target selection. It looks the same as the old one, except with a line of asterisks. Why the asterisks? In the new system, bullets don't magically teleport exactly where you're aiming. The follow a trajectory. This trajectory isn't realistically modeled or anything, but it does mean that bullets have a path that they follow to a target and beyond if they miss. Anything along that path has a chance of being hit, although the targeted tile gets a bonus. This opens the door to new combat possibilities. You'll be able to take cover behind furniture or in a group of people. You'll also need to watch your shots more carefully and firing into a group of enemies will increase your chances of hitting one. The final addition is that I've added a primitive animation when you shoot that shows the bullet traveling and then its impact location.
As you can see the NPCs still stand there in the same exact place. I really need to start fleshing out my Actor classes, but I'm having a little trouble deciding what I want to do about certain gameplay elements. The most important one that I'm not sure about is the health system. I really liked the locational damage from the old version, but I feel like it had a tendency to be a little too random, resulting in too many random unlucky deaths. I'm stuck trying to figure out a good system to use that still allows me to have lots of gore and injuries requiring bionics to fix while not being frustrating. If you've got any ideas, please feel free to post them!

Monday, August 16, 2010

deja vu

It feels like I've done this all before...

Oh wait, I have! Work continues on reimplementing all the basic features. Today I added field of view, map items, music, lighting, and key configurations. The music is new; I'm using FMOD. There is a noticeable load time and the game for some reason uses 90mb more memory now, but I'll look into that at a later date.

NPCs still sit around doing nothing.
CyberpunkRL: Now with mohawks!

Sunday, August 15, 2010

productive day

Today I did a lot of work on the Map class. I also laid down the foundations for my Actor classes and map entities. In addition, I played around with some graphics, and I think I'm going to keep them. Most of the graphics can be remapped in the configuration files, so it will still be possible to play a text-only version of the game with a little work.

obviously a work in progress

gzip!

I spent a couple of hours today implementing the basics of map saving/loading. It was clear from the beginning that I would have to come up with a better system for saving map data. Even though each tile in the map array just needed a byte, in order to save them I needed to use 2-4 bytes. Simply saving each byte as the corresponding character in the text file was out of the question, because a lot of those characters were special ones that screwed up the file, so I had to save them as 1-3 digit numbers separated by semicolons. (e.g. 128:24:1:35) As you can see, that takes up a lot of extra space, and resulted in 63x38 maps taking up over 9 kb for their arrays alone.

After several frustrating hours today, I managed to implement a system that compresses the raw map arrays using gzip. Then it takes that data and applies 64 bit encoding so that it won't mess up the save file or require a lot of extra space. As a result, the compressed map data will still fit nicely in the text-based save files, but editing actual map layout data will be near impossible (not that it was very easy to do in the old version anyway).

Was this extra work worth it? Well, I'm able to store the arrays for a 120x80 sized map in around 2 kb now as opposed to the 9 kb it took before (for smaller maps too)! When you have thousands of potential map files, that really makes a difference.

Let me know if I'm posting too much boring stuff...

Saturday, August 14, 2010

New item system

Still apprehensive about jumping straight into all the complicated stuff of writing a new engine, I decided to start off with the item system. Basically, the item system now consists of two classes so far. There's the Item class which will be used to point to specific instances of an item (such as in a player's inventory) and will be able to contain instance specific data, such as quality, quantity, etc. The item class contains a pointer to a unique instance of ItemTemplate, which defines the actual item information of a given item type. So while there may be multiple instances of a PX45 Pistol, they'll all still get their base stats from the same ItemTemplate. This new system is different from the old one in that I'll now be able to add in various modifiers to specific items, which was impossible before.

In addition, I've made the ItemTemplates get all their data from a text file, which means anyone will be able to modify the game's items. The data file currently looks like this:

//TEMPLATES
//defines base characteristics for all items
item:base_template
{
    char:249
    cost:10
    description:"No description"
}
//defines gun characteristics
item:gun_template
{
    use:base_template
    char:191
    gun
    fireRate:1
}

//GUNS
item:light_pistol
{
    use:gun_template
    name:"PX45 Pistol"
    ammo:".45 ACP"
    damage:5
    magazine:10
}

It's pretty readable and offers a fair bit of flexibility. I think I like it.

-_-

Well I took a bit of a break from CyberpunkRL. Sorry for disappearing for so long. I do have some news.

I've decided to rewrite the game from the ground up. What this means is that the game will be changing quite a bit. The basic premise will remain the same, but I've decided to go with larger, more enclosed map areas. NPCs will still be confined to maps, but each map will contain more buildings and should feel much more interesting.

I've also been throwing around the idea of adding some graphical characters to the font, and I'll post some screenshots once I've tried that out.

Other changes will come as well, so we'll just have to wait and see what happens! Thanks for your interest and patience.