Saturday, December 26, 2020

RPG: Networked Events and Time of Day

The character states and magical effects were being shared between the server and clients, but interactions were not. The client players couldn't go up to a NPC and talk, heal, buy/sell, or enable tactics. It was a substantial amount of work, but client players can now do all interactions with a NPC that the server itself could do. Even the inventory of a client character is shared to the server so server events that check if a player was carrying an item works.

As the engine improves, I need more content to test its capabilities and have something to "play". I added the concept of time of day and events that can be triggered off that time. As well as actions that can create or remove characters. Now I can have pirates that show up on the coast when it gets late, raid the village, then leave. The time of day also influences how much the player can see. During the night the vision radius reduces substantially.


There is an indication of the current time of day at the top right of the game screen. (In the above screenshot, it's close to midnight with very limited visibility.)

NPCs can now also be scripted to go to specific lat/lon locations on the map. There is no pathfinding yet though so they can get hung up on the corners of buildings pretty easily. That will have to be improved upon.

Another content item is if you chop down larger trees they'll leave behind logs of wood which you can sell at the lumbermill.

On the game play side,  I've added a delay between when a character begins an attack animation and when the weapon does damage. Damage now coincides with the instant the weapon's animation touches the target as opposed to the start of the animation. In addition to just looking better, this adds more options to tactical combat (adds the ability to dodge).

No comments:

Post a Comment