I didn’t get as much work as I wanted since last update, but some work nonetheless.  As I mentioned last update I’m going to be working in NPC (or non-player entities) for a few updates.

  1. Monster skins
  2. Map entities
  3. AI waypoints

Monster Skins

Here I worked on setting up various JSON files where I can define a monster type’s constant properties, such as name, speed, skin, etcetera… This will be used by the server and client to load the necessary data of a monster without needing the server to send all of the data to the client. For example, things like name and skin will usually be the same for all pig type monsters. There’s still tons to do here. A client will only need to load monster skins for monsters that might exist in the instance.

Map Entities

With “map entities” I refer to the placement of an entity’s in the world. When I need an entity to always spawn in a map instance, I’ve set up Tiled to easily add an entity object which my server can read. I can define spawn specific information through this, such as respawn time, monster type and other properties that might be useful or we want to override from the constants. This will also be used when I add procedural generation. My current plan is to not have fully generated areas but more as in many area pieces that fit together in different ways. Some of this areas will have this entity objects which will end up being different type of monsters which the server will decide at runtime.

Pig entities in map editor

AI Waypoints

Admittedly, working with pathfinding and AI is not my forte. I’ve yet to do a full research on the best way to do this given the limitations of an online game, but I’ve gotten some work done in it already. At the moment the only thing I’m showing is the random movements NPC’s will do when not aggressive or idle, you can see this in the video above. There’s things to consider here that will apply to all movement types. One of those is the collision, you have to make sure the entity does not randomly decide to try to walk through a fence. Another thing would be a it’s spawn point. Entities should be tethered to their spawn point and not move more than a defined distance away from it. We don’t want pigs wandering into the Inn. These waypoints will likely be used more as I expand the movement system.

What’s next?

More about NPCs. I’m gonna start with actual monster pathfinding, having monsters chase entities and do so by maneuvering through obstacle/collision objects. I’ll have to do more research since this needs to work in the server and all the way to the clients. I’m hoping to finish with a flexible NPC movement system so I can have a more dynamic combat system. This could allow strong monsters to juke players with clever movements and such.