Monday, April 30, 2018

RPG: Tactics

I now have a solid foundation for the tactics code and many tactics/spells already implemented.

The latest user interface...

One key aspect I want in my game is to have no set "good" or "evil". You have alignments with certain groups of people, but those are dynamic based on your actions. In Diablo / similar games, you left click on an orc for your basic attack, but you can also safely left click on a blacksmith to sell your equipment. I want you to be able to talk to an orc or attack a blacksmith.

To accomplish this, I've dedicated the left mouse button to "Interact" and the right mouse button to your selected "Tactic".

Left clicking on the ground, an item, or a character is your basic "Interact". If you click on the ground, you'll walk there. If you click on a bag of coins, you'll pick them up. If you click on a chest, you'll attempt to open it. If you click on a door, you'll enter it. And eventually if you click on a person, you'll attempt to communicate.

Right clicking on the ground, an item, or a character does your selected "Tactic". At the lower right of the screen, you can select your active tactic (highlighted in red). If you right click on that blacksmith when the weapon tactic is selected, you'll attack him. You could even click to heal someone that would normally be a foe. (There are keyboard shortcuts for the tactics.)

The tactics are grouped by row...

Row #1: General

Attack - Use your wielded weapon - sword or ranged weapon.

Lock Pick - Pick the lock of a chest. (Chests can be unlocked - single left click opens them. Or locked - require hitting many times with a weapon or use of the lock pick skill.)

Row #2: Arcane Spells (Wizard)

Teleport - Instantly jump to somewhere else that you have vision on.

Flame Wall - Create a ring of fire that lasts several seconds somewhere on the map. Characters within the fire take continuous damage.

Row #3: Divine Spells (Cleric)

Heal - Heal yourself or a target character.

Protection - Create a protective ring around yourself or a target character.

Presence - Show the relative alignment of nearby characters.

Holy Bolt - Request a bolt of lightning to come down on a target character.

Resurrect - Bring a target character back to life.

Row #4: Nature Spells (Druid)

Entangle - Vines come up out of the ground slowing down the movement of those nearby.

You can see the game engine now supports effects that not only draw on the screen but also can affect characters (slow them down, deal damage, etc.).

My preferred role has always been Cleric (and hence why I've already filled out all the cleric types skills), but I've never been a fan of having to choose a specific path and being prevented from stepping outside it. Anyone is able to learn & become skillful at all the tactics. I'll go into stats later; but I'll use those to help balance between someone primarily a magic user vs someone primarily a fighter vs someone that is a jack of all trades / master of none.

Also, I hate warm up times / other preventative measures to keep you form taking advantage of all the skills you know. If you have the Energy, then you can use a tactic/spell. (Doubtful I mentioned this before, but my Mana is now considered Energy - doing a tactic will decrease your Energy. And the cost of tactics varies - Heal costs less Energy than Resurrect for example.)

I've jotted down many other ideas for tactics, and I am fully expecting to have all 20 slots filled for the game. Halfway there already!

Sunday, April 1, 2018

RPG: Terrain & Canopies

Lots of work has been completed on the RPG recently, so I'm trying to catch up on development posts now.

The game had all the terrain types hard coded. To get any kind of new terrain to show required creating the textures, adding new variables, calling functions to load those variables, and adding in switch cases to know where to load those textures. Took way too long.

The new method has a single text file that points to all the terrain types available.

The game loading function goes through each line of that file to parse the corresponding dat file for a specific terrain type.

Oceans happen to have 4 animated frames to give the illusion of waves. There are additional sprites for the ocean depending on how it borders neighboring textures (corners and sides). Those additional sprites are drawn when necessary to avoid hard edges for terrain such as water or grass.

The second line of the Ocean.dat has "o" - which is the code for this terrain type. The game's TerrainMap file is a 360x180 matrix of code letters that determine how the world looks.

There are so many unique variables a single block of terrain needs, I will inevitable go to a binary format. But for now just a large ASCII map is convenient.

In addition to the externalized terrain types, I've added a new concept called "canopies". Canopies are overlaid above the terrain to mimic things such as building roofs, but they don't block character movement.

Loading of canopies is handled very similar to terrain. There is a list of the canopy types.

And folders of each canopy type that contain a dat file and texture.

And finally the canopy map.

So although not much to look at now, these major changes allow me to greatly accelerate development.

The next post will be a significant one though! I've got a control scheme pretty well worked out and am in the process of implementing skills / spells.