January 8, 2011

Battle System and Dev Update

Hi there,

Damn, it's 2011 already, it was a busy new year eve, and i'm still kinda sick. But hey that's part of the fun. Also (and completely unrelated) congratulations to Roguedjack! His Rogue Survivor has been recognized by IndieGames as the 4th best freeware RPG of this year. Good job. Back to business, this article will explain in details the combat system that will be used in GRA in addition to the usual weekly development update. Enjoy!

Note: From my stats, a hell lot of you come from the X-Universe community, which is good. I want to tell you something: What I'm doing now is basically building an engine. This GRA project is a first step. Other projects based on the same engine will follow depending on the success of this one. Yes, it means a X kind of game focusing on content instead of pretty 3D may follow, so i'd suggest you to put this in your RSS reader, just in case. Cheers, SK.

Development Update

I made a massive bug fixing and optimization pass on the code. It was needed. I squashed dozens of annoying issues that were unnoticed before i added the basic AI. The current build isn't totally bug free, but the base is solid enough for me to continue forward without too much second thought. And regarding the optimization, I think I did a good job, it seems that a city populated by 5.000 persistent NPC can run easily now on my outdated computer. The number will probably be reduced to 2/3 once all the features will be implemented, but that's more that enough. The main factor is the NPC in the same sector as the player, CPU cost for the others is negligible. 
I've not added much, though. NPC now have a very basic understanding of ownership that will need a large rewrite at a point or another. In the previous build, beds - for example - were free for all, meaning that 5 NPC could sleep in the same (no, gangbangs are not a feature). It's now fixed, they sleep in there own bed. But similar issues will arise when I start the implemention of item ownership and storage. The current workaround is, well insufficient to deal with that. Correcting this could take a long while giving the current code, so I'll have to delay any related feature until the first test build is released.

Combat System

Notice : This is a design document for the final version. The first test build will be hitpoint based only, you know the drill if you've read other articles in here, and if you haven't it's not the place to start with, seriously.

First of all, I'm an avid fan of Dwarf Fortress, it's technically the most detailed combat system ever. And I know that a lot of you are fan of this game, we are a rather small community after all. But it's also very random and sometimes doesn't make sense. I won't lie, i don't want to mimic its combat system or give the same amount of gory details. Aiming at the 2nd left finger of your target because you magically feel it's his weak point at this turn with your RPG launcher or your 50.cal machine gun doesn't make much sense anyway. But I want to achieve something that's roughly similar to tactical games like UFO, XCOM, Jagged Alliance and such.

For those familiar with such games, I hope the explanation will be pretty straightforward despite my basic english. For the others, go play with those damn games! Per turn, you'll have 2 action points (AP). Walking will cost 2 points to move one square, running will cost you only one but will also eat your stamina. A quick shot will cost you 1 point (meaning 2 shots per turn or 1 run + 1 shot). An aimed shot at a specified body part will cost 2 points, same for a burst shot.

Depending on your weapon you'll have the choice between:

- Single Shot : 1AP. Will hit a random part of the enemy with a higher % on the torso. If you choose this shot, you'll be able to run (if your stamina is high enough) to another square in the same turn. Doing so will reduce your chance of being hit by an enemy bullet.
- Aimed Shot : 2AP. You can choose where to shoot. % to hit may be reduced, critical hit % is increased. Depending on your weapon, stats, and luck you can hit the specific part of the body, miss completely or hit another part of the body.
- Burst Shot : 2AP. You'll fire 3 shots but the likelihood of hitting the target is somewhat reduced, same for critical hits. It's a good choice for short range encounters.

Now, body parts. You'll be able to aim at these body parts with the following result when injured enough:

- Legs : Slower movement, can't run. [hit prob: average]
- Arms : drop weapon. - up to 50% HtH damage. up to -50% accuracy. [hit prob: average]
- Torso : -1 to 3 on all stats. [hit prob: easy]
- Head : at least -50% accuracy. -2 Line of Sight. Death. [hit prob: hard]

That's the basics. On top of that there will be a cover system. Basically, any object between you and your target provides a given % of cover except the object you're next to. So if you are just behind a sofa giving you 30% cover and that's the only obstacle between you and him, you'll only receive 70% of his shots but he will still receive 100% of yours. Percentages are absolutes here, meaning that if you have 2 obstacles providing 50% cover each between you (and none of you are next to one of those) you'll never get a hit even if you can see your enemy in your field of vision. This said, objects should be destroyed by shootings (missed shots will be 'absorbed' by the objects) in the final version. However it will be implemented at the very last. So it's not really worth discussing yet.

Several variables will enter into account regarding your chance to hit. Your base perception, your weapon mastery skill, your fatigue, distance, and probably others. The exact formula will not be made public however. Regarding the output, to be honest I don't know yet. The issue is that as a programmer I hate when a game hides behind shady descriptions (I curse the day some guy invented the 'visual' damage system to replace the good old hit points), however i understand that giving too much info may kill the immersion factor. So, for now, I think that the wisest road is to give accurate descriptions (without numbers) of the enemy's health. Something like:

- You burst shot at SomeIdiot and hit with 2 bullets in the torso. He looks very pale.
- You shot quickly at RandomGuy with your gun and barely scratch his head. He looks fine.
- You shoot at Zark0si in the head, it was a critical hit. He is dead.

Sounds good ? Comments and ideas are more than welcome as usual :)

2 comments:

  1. I read your blog for some time now and it's all very interesting (the development process etc). I'm really looking forward to another post on AI and life simulation managment.
    Concerning combat, will there be grenade-like and melee weapons or just guns? The cover system looks promising, and explosion weapons may add some dynamism in fights (like make the enemies leave their cover to flee from one grenade and the like).

    BTW, I'm indeed from X where I played with your awesome PG/YA ALPlugins, and I loved DwarfFortress. A small world indeed.

    PS: En fait je suis français, mais bon, sur un blog anglais, on parle anglais! :p

    ReplyDelete
  2. Thanks for the comment about PG and YA :)
    Granted that 40% of my visitors come from the Anarkis Federation website and 60% from the roguelike community, it was kinda expected.

    Anyway, I'll go into more details about the AI and the simulation relatively soon. I 'just' need to type some related code first as I'd hate to talk about something that i can't put in-game.

    About the weaponry. Yes, melee weapons are already included. They'll basically follow the same rules as other ones, the only difference being that damages will be scaled according to the character's strength (instead of distance). Area of Effect weapons like grenades are planned, data files ready, but there's no code to handle those, yet.

    ReplyDelete