Friday, January 26, 2018

RPG: Tile Edges & Mouse

A lot has been improved since the last post on the RPG!


For one, I was introduced to the program Aseprite which has helped immensely with the art. My terrain tiles still aren't good, but at least they're not embarrassing!

And I've made four big code changes:

1. Tiles (such as ocean or grass) will now draw edge overlays onto neighboring tiles to smooth out the transitions. The overlays are also animated so the waves of water coming on and off the beach have movement.


2. You can perform basic melee attacks.


Here I've chopped down a tree and killed the guy on the beach.

3. Finished all movement via the mouse. Movement now mimics Diablo - click somewhere to go there, click on a guy to walk to him and attack, or click on an item to walk over and pick it up. If you're holding an item and you click on the map, drop the item in that direction. Keyboard movement is still supported and I still plan on adding joystick support, but the mouse movement is very nice.


No that isn't a giant sword on the ground, it's what I'm currently holding in my hand (tracks with the mouse cursor). If I click on the ground I'll place it down (and the sword sprite will scale down in size) or I can click it into my inventory window to wield it or put it in my backpack.

4. Some internal code changes with how I'm handling user inputs and executing those actions. Those changes enabled a single click to perform compound actions such as walk up to item/character and pick up/kill it.

Goals for next major update:


1. The memory management is currently not thread safe, so trying to scale up the number of items by making it multi-threaded is not feasible. I'm reworking my memory management now to support that.

2. A character's head, body, arms, legs, and feet are all in one sprite, but I really want the player's image to reflect the loaded equipment. If a sword is in the player's left hand, it should show in the left hand of the player. If the player is wearing red boots, then it should show red boots. If the player is holding 2 shields, then it should show holding 2 shields. Trying to use one sprite for all the possible equipment combinations is not feasible, so I'm going to experiment with drawing legs/feet separate from body separate from arms/hands separate from the head.

3. Implement a simple AI so characters will attack back.