I have one month to make an MMO: Day 19
The refactoring paid off, as now handling items has become very easy, and I’ve added in some UI to allow players to easily pick up and drop items.
The player has a few different actions available.
- Inspect: inspect will give player some information about an object on the map or in their inventory. This is not currently implemented, but will be necessary for some features later on.
- Interact: interact will activate some object on the map that the player is in front of, or targets with the mouse. This was implemented previously, and currently triggers dialogue with an NPC or signpost, and picks up loose items on the floor
- Use: use will use the selected item in the player’s inventory, either on the player, or on the area targeted by the player, depending on what kind of item it is. This is not currently implemented.
- Drop: drop will remove the item from the player’s inventory, and drop them in the world as a loose item. This was added today.
The inventory now has an active item selection, bound to the number keys. This controls which item is used when the player hits the “use item” or “throw item” keys. This is simply a variable that changes based on number inputs, and the inventory drawing screen highlights the relevant slot when selected.
However, this variable is pretty important, because it’s what’ll be sent to the server when the player uses an item.
I’ve added a little reticle on the ground to indicate where a player is pointing. The reticle snaps to tiles, which is useful as most things on the map are tile-based. Things that aren’t tile-based include entities and NPCS, for these, the reticle will activate whatever is under it.
When the mouse is close to the player, the reticle will follow the mouse, out to a maximum radius of about 3 tiles. When the mouse is far away from the player, the reticle will automatically revert to directly in front of the player character. This allows for both mouse-aim, and keyboard-only, or control-pad control.
The reticle determines what is activated when the player uses the “activate” key. the NPC under the reticle will trigger their dialogue; or an item under the reticle will be picked up by the player.
I outlined the long sequence of events needed for the player to pick up items. The sequence for dropping items is similar, though most of the framework is now in place.
Both picking up and dropping an item have about the same amount of delay, but the delay in dropping an item is much more noticeable if the player is moving while they drop the item, as the item will only appear a fraction of a second later when the player’s character has already moved on.
Some of this delay is unavoidable due to natural network latency, so I intend to hide this delay by adding in a client-side cosmetic effect.
Day 19 Task summary
With item picking up and dropping completed, the only thing left is for NPCs to actually give and take items.
That may be a good enough place to close my 1 month MMO experiment, since it leaves the game in a place where relatively simple narrative-based gameplay with item fetch/trade puzzles could be added via the map and dialogue editors without needing any server or client code updates.