Giter VIP home page Giter VIP logo

hkmp's Introduction

HKMP

What is Hollow Knight Multiplayer?

As the name might suggest, Hollow Knight Multiplayer (HKMP) is a multiplayer mod for the popular 2D action-adventure game Hollow Knight. The main purpose of this mod is to allow people to host games and let others join them in their adventures. There is a dedicated Discord server for the mod where you can ask questions or generally talk about the mod. Moreover, you can leave suggestions or bug reports. The latest announcements will be posted there.

Install

Quick start

A community-made guide exists to get started easily with the mod. If you are not experienced with Github and/or Hollow Knight modding, this is the recommended way to start using the mod. Alternatively, the sections below illustrate how to get the mod from the installer or install it manually.

Modding installer

The latest version of the mod can be found on Lumafly, a modding installer for Hollow Knight 1.5. Using this link will automatically download the correct version of the Lumafly installer for your OS. This installer will then automatically download the modding API and you can install the mod via an easy-to-use interface.

Manual install

The mod works through the Hollow Knight Modding API. After installing the API, this mod can be installed by dropping the compiled DLL into your mods folder, which can be found in your Steam installation: (Beware that these are the default locations. Your install may be on a different drive, in that case change your path accordingly.)

  • Windows: C:\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\
  • Mac: ~/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/, then click "open package contents" and content -> resources -> data -> managed -> mods
  • Linux: ~/.local/share/Steam/steamapps/common/Hollow Knight/hollow_knight_Data/Managed/Mods/

The latest version of the compiled DLL can be found on the releases page.

Usage

The main interface of the mod can be found in the pause menu in-game. There is an option to host a game on the entered port and an option to join a game at the entered address and entered port. Playing multiplayer with people on your LAN is straightforward, but playing over the internet requires some extra work. Namely, the port of the hosted game should be forwarded in your router to point to the device you are hosting on. Alternatively, you could use software to facilitate extending your LAN, such as Hamachi.

The interface can also be hidden by pressing a key-bind (right ALT by default). This key-bind can be changed in the config for the mod, which can be found at the following locations depending on OS:

  • Windows: %appdata%\..\LocalLow\Team Cherry\Hollow Knight\HKMP.GlobalSettings.json
  • Mac: ~/Library/Application Support/unity.Team Cherry.Hollow Knight/HKMP.GlobalSettings.json
  • Linux: ~/.config/unity3d/Team Cherry/Hollow Knight/HKMP.GlobalSettings.json

The key-binds are stored in keycode form, please consult this list for all possible keycode options.

In addition to the pause menu UI, there is a chat window that allows users to enter commands. The chat input can be opened with a key-bind (T by default), which feature the following commands:

  • connect <address> <port> <username>: Connect to a server at the given address and port with the given username.
  • host <start|stop> [port]: Start a server on the given port or stop an existing server.
  • list: List the names of the currently connected players.
  • set <setting name> [value]: Read or write a setting with the given name and given value. For a list of possible settings, see the section below.
  • announce <message>: Broadcast a chat message to all connected players.
  • kick <auth key|username|ip address>: Kick the player with the given authentication key, username or IP address.
  • ban <auth key|username>: Ban the player with the given authentication key or username. If given a username, will only issue the ban if a user with the given username is currently connected to the server.
  • unban <auth key>: Unban the player with the given authentication key.
  • banip <auth key|username|ip address>: Ban the IP of the player with the given authentication key, username or IP address. If given an auth key or a username, will only issue the ban if a user with the given auth key or username is currently connected to the server.
  • unbanip <ip address>: Unban the IP of the player with the given IP address.

Authentication/authorization

Each user will locally generate an auth key for authentication and authorization. This key can be used to whitelist and authorize specific users to allow them to join the server or execute commands that require higher permission.

  • whitelist [args]: Manage the whitelist with following options:
    • whitelist <on|off>: Enable/disable the whitelist.
    • whitelist <add|remove> [name|auth key]: Add/remove the given username or auth key to/from the whitelist. If given a username that does not correspond with an online player, the username will be added to the 'pre-list'. Then if a new player with a username on this list will login, they are automatically whitelisted.
    • whitelist <clear> [prelist]: Clear the whitelist (or the pre-list if prelist was given as argument).
  • auth [name|auth key]: Authorize the online player with the given username or auth key.
  • deauth [name|auth key]: De-authorize the online player with the given username or auth key.

Standalone server

It is possible to run a standalone server on Windows, Linux and Mac. The latest executable of the server can be found on the releases page. For Linux and Mac, the server can be run with Mono installed. After installing Mono, the same executable can be run using mono HKMPServer.exe <port>. Currently, the only command-line argument is the port that the server should be hosted on.

Alternatively, a Docker image is available on DockerHub (courtesy of maximalmax90).

The server will read/create a settings file called serversettings.json, which can be changed to alter the default startup settings of the server. Alternatively, settings can be changed by running the settings command on the command line. In addition to the commands described above, the standalone server also has the following commands:

  • exit: Will gracefully exit the server and disconnect its users.

Settings

There are a lot of configurable settings that can change how the mod functions. The client settings are available in the pause menu UI of the mod, while the sever settings can be changed with the settings command.

Client settings

The client settings contain the following entries:

  • Team Selection: Allows the player to change their current team. This setting can only be changed when it is enabled server-side.
  • Player skin ID: Allows the player to input the ID of the skin they would like to change into. After pressing the "Apply skin" button, this will locally change the skin and transmit it to the server. This only has effect if skins are enabled on the server.
  • Display ping: Whether a ping display is enabled in the top-left side of the in-game screen. This will display the current RTT (round trip time) of the client-server connection.

Server settings

This section contains the settings for the server. These values can be read and modified by the set command described above. All names for the settings are case insensitive, but are written in case for clarity.

  • IsPvpEnabled: whether player vs. player damage is enabled.
    • Aliases: pvp
  • IsBodyDamageEnabled: whether contact damage is enabled, namely when player models touch, both of them will be damaged. This only has effect if PvP is also enabled.
    • Aliases: bodydamage
  • AlwaysShowMapIcons: whether player's map locations are always shared on the in-game map.
    • Aliases: globalmapicons
  • OnlyBroadcastMapIconWithWaywardCompass: whether a player's map location is only shared when they have the Wayward Compass charm equipped. Note that if map locations are always shared, this setting has no effect.
    • Aliases: compassicon, compassicons, waywardicon, waywardicons
  • DisplayNames: Whether overhead names should be displayed.
    • Aliases: names
  • TeamsEnabled: Whether player teams are enabled. Players on the same team cannot damage each other. Teams can be selected from the client settings menu.
    • Aliases: teams
  • AllowSkins: Whether player skins are allowed. If disabled, players will not be able to use a skin locally, nor will it be transmitted to other players.
    • Aliases: skins
  • AllowParries: Whether Nail slashes and Nail Arts can be parried. Only applicable when IsPvpEnabled is true.
    • Aliases: parries

The rest of the settings contain entries for damage values of most PvP enabled spells and abilities. Setting them to a value of 0 will completely disable the damage. Following is a list of the setting names for these along with their aliases in the parentheses:

  • NailDamage (naildmg)
  • GrubberflyElegyDamage (elegydmg)
  • VengefulSpiritDamage (vsdmg, fireballdamage, fireballdmg)
  • ShadeSoulDamage (shadesouldmg)
  • DesolateDiveDamage (desolatedivedmg, ddivedmg)
  • DescendingDarkDamage (descendingdarkdmg, ddarkdmg)
  • HowlingWraithDamage (howlingwraithsdamage, howlingwraithsdmg, wraithsdmg)
  • AbyssShriekDamage (abyssshriekdmg, shriekdmg)
  • GreatSlashDamage (greatslashdmg)
  • DashSlashDamage (dashslashdmg)
  • CycloneSlashDamage (cycloneslashdmg, cyclonedmg)
  • SporeShroomDamage (sporeshroomdmg)
  • SporeDungShroomDamage (sporedungshroomdmg, dungshroomdmg)
  • ThornOfAgonyDamage (thornsofagonydamage, thornsofagonydmg, thornsdamage, thornsdmg)
  • SharpShadowDamage (sharpshadowdmg)

Skins

Skins can be installed by dropping a folder into the skins directory (<steam>/Hollow Knight/hollow_knight_Data/Managed/Mods/HKMP/Skins). If this directory structure is not present yet, it should be generated once you have launched the game at least once with HKMP installed. This folder can be named anything, but the files should be texture sheets that Hollow Knight also normally uses. After running the game with skins installed, each of these skin directories should have a corresponding id.txt file generated. This ID file contains a single integer representing the ID of that skin. This ID can then be used in-game to select the skin from the client settings menu. Normally, these IDs start at 1 and incrementally increase the more skins you use, but it is possible to manually edit the ID files to use other IDs.

Contributing

There are a few ways you can contribute to this project, which are all outlined below. Please also read and adhere to the contributing guide.

Github issues

If you have any suggestions or bug reports, please leave them at the issues page. Make sure to label the issues correctly and provide a proper explanation. Suggestions or feature requests can be labeled with "Enhancement", bug reports with "Bug", etc.

Build instructions

Client mod

The HKMP mod can also be built from scratch. This requires a few dependencies from the Hollow Knight game and the modding API. Namely, the following assemblies are needed from the modding API:

  • Assembly-CSharp.dll (modified by the modding API)
  • MMHOOK_Assembly-CSharp.dll
  • MMHOOK_PlayMaker.dll
  • MonoMod.Utils.dll

And the following assemblies are needed from the Hollow Knight game/Unity:

  • PlayMaker.dll
  • UnityEngine.AudioModule.dll
  • UnityEngine.CoreModule.dll
  • UnityEngine.dll
  • UnityEngine.ImageConversionModule.dll
  • UnityEngine.InputLegacyModule
  • UnityEngine.ParticleSystemModule.dll
  • UnityEngine.Physics2DModule.dll
  • UnityEngine.TextRenderingModule.dll
  • UnityEngine.UI.dll
  • UnityEngine.UIModule.dll

All the files above can be found in the following directory based on your operating system (and might vary depending on installation):

  • Windows: C:\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed.
  • Mac: ~/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/, then click "open package contents" and content -> resources -> data -> managed
  • Linux: ~/.local/share/Steam/steamapps/common/Hollow Knight/hollow_knight_Data/Managed

With these assemblies handy (either in their original Hollow Knight directory or moved somewhere else) you should copy and rename the HKMP/LocalBuildProperties_example.props file to HKMP/LocalBuildProperties.props and fill the paths in it to your locally used paths. After this the source code can be compiled into a DLL, and you should be good to go!

Standalone server

The standalone server can also be built from scratch. There are technically two dependencies for the server:

  • The built HKMP mod DLL (HKMP.dll)
  • The Newtonsoft JSON library DLL (Newtonsoft.Json.dll)

The HKMP mod DLL is linked from the Release directory of the mod project and does not have to be manually copied. The Newtonsoft JSON library, however, can be found in your modded Hollow Knight installation as denoted above. This DLL should be placed in the HKMPServer/Lib/ directory and will be embedded together with the HKMP DLL during the build process.

Make sure to first build the HKMP mod before building the server to ensure the latest version is embedded.

Patreon

If you like this project and are interested in its development, consider becoming a supporter on Patreon. You will get access to development posts, sneak peeks and early access to new features. Additionally, you'll receive a role in the Discord server with access to exclusive channels.

Copyright and license

HKMP is a game modification for Hollow Knight that adds multiplayer.
Copyright (C) 2023 Extremelyd1

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
USA

hkmp's People

Contributors

blindgarret avatar clazex avatar flibber-hk avatar im-apbecker avatar jngo102 avatar maximalmax90 avatar microsofteggshell avatar prashantmohta avatar ruttie2006 avatar themulhima avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hkmp's Issues

Update readme with latest information

The readme needs to be updated in a few regards:

  • Build instructions do not contain the correct dependencies for modding API 1.5
  • Skins no longer need certain files to load
  • Include section about contribution to entity system project
  • Standalone server has a list command
  • New artwork for banner

[Bug]: Server crash

The server sometimes crashes (currently unsure of the reason).
The error message sent by the server right before the crash can be found here:

image

My current suspicion is that the server dies because an empty chat message was sent, but this might be a symptom rather than a cause, and correlation does not neccesarily mean causation.

OS: Ubuntu 20.04.6 LTS
HKMP version: 2.4.1

Log standalone server output to rolling log files

Implement rolling log files for the standalone server, so that output can be viewed later.
Log files should have a maximum size after which the new logs are written to a new file.
Then after a maximum number of files is reached, the oldest should be deleted in favor of the newest.

Docker Version

Issued the Standalone version in the container for docker fans. Maybe someone will need it. Images are assembled and uploaded on DockerHub. Sources uploaded on GitHub.

Enhancement: delayed player map

I think an interesting feature for certain use cases would be a customizable delay on the positions of other players in the map. So, if the delay is set to 30 seconds, then when a player opens the map, they will see the positions that other players had 30 seconds ago.

This would be useful for many types of "hide-and-seek" type games (e.g. speedrunner vs hunters), forcing the hiding player has to remain on the move, with an easily adjustable difficulty setting.

It seems easy enough to implement using a deque as a buffer for each player, and I'd be happy to make a PR if you could point me towards where you think this could most cleanly be added.

HKMP doesn't support additional map areas

// Get the current map zone of the game manager and check whether we are in
// an area that doesn't shop up on the map
var currentMapZone = gameManager.GetCurrentMapZone();
if (currentMapZone.Equals("DREAM_WORLD")
|| currentMapZone.Equals("WHITE_PALACE")
|| currentMapZone.Equals("GODS_GLORY")) {
return Vector3.zero;
}

can be safely deleted, as
var areaObject = GetAreaObjectByName(gameMap, currentMapZone);
if (areaObject == null) {
return Vector3.zero;
}
for (var i = 0; i < areaObject.transform.childCount; i++) {
var childObject = areaObject.transform.GetChild(i).gameObject;
if (childObject.name.Equals(sceneName)) {
sceneObject = childObject;
break;
}
}
if (sceneObject == null) {
return Vector3.zero;
}

also cover the same cases, since the objects for the respective areas don't exist normally, but can be added with other mods.

Chat input field becomes unfocused with mouse moves

The input field for the chat loses focus when the user moves the mouse while it is open. Since there is no on-screen cursor in this case, it is difficult to re-focus the input field. Without focus on the input field, nothing can be input until it is refocused.

Unclear steps

Can you give me a clearer ways to use this mod? The UI is a bit confusing... How should I use it?
And can you tell me how to do port forwarding?

Extremely choppy position updates

Over internet - Others experience my movement as smooth I experience theirs as incredibly choppy.

On LAN - Unplayable choppy for both players.

Expose server settings to server API

Expose the server settings instance to the server API as an interface that allows addons to modify them. Both a method to update a single settings as well as a method to update a number of settings at once could be useful. Additionally, the interface could expose reading the current value of the settings.

Replace int fields with KeyCode in global settings

Also, add the [JsonConverter(typeof(StringEnumConverter))] attribute to the fields in the global settings. When reading old global settings files, NewtonSoft will read both ints and enum member names as KeyCodes correctly, but will write them as enum member names. This makes changing the global settings significantly easier, given that it cannot be done through the game.

Example

HKMP not registering skin spell effects.

This might be the lowest of your priorities, but it looks like it only reads the sprint and sprite sheets.
Any plans on having it read the other sheets included in skin files?

Npcs not working properly

both me and my friend have broken the fragile strength charm in our multiplayer world and have been unable to repair it. leg eater does not give the "repair charm" prompt and only responds saying he has nothing left to show(we bought all the fragile charms). similarly, iselda also does this despite us never having bought her map pins. is there anyway to fix this, or at least a command to restore the charm?

Timeout rejected connections of recent users

Implement a mechanism that will put users in a timeout that have recently connected and were rejected. Currently, the server still creates a server-side client for them and will respond with packets, which makes the client-side client think they are still trying to connect. Immediately rejecting the connection and not responding will give the client-side client better feedback.

Allow de-registering of addons

When players need to switch which addons they are using to allow connecting to a different server (that uses different server addons), they need to close down the game. This is a very tedious process and allowing addons to be de-registered while the game is running could prevent this.
Naturally, this requires some sort of interface to allow players to (de-)register addons on the fly. The modding API offers this in the mods menu if the mod implements a specific interface.

Support non-ASCII characters for usernames and chat

Requirement: Chinese cannot be entered in the chat box. Could you please add Chinese support? And although you can set Chinese nickname, but in the chat box to input something to send is, the name will show two question marks, hope you can fix it. I'm sorry if the translation I used was inaccurate.

Dropping duplicated resent data might prevent ACKs

Double check whether the dropping of resent data due to duplication does not prevent packets from including acknowledgements in new packets. A case of connection problems as indicated in the following pastebin links might suggest that this is the case.
Pastebin links: Host, Client

Improve exception logging

In a lot of exception handling cases throughout the code, the exception is logged manually by logging the type, message and stacktrace of the exception. Using .ToString() on the exception object will do the same, but it will be presented neater in the log file.

Moreover, the stacktrace for addon exception handling is sometimes not logged. Using .ToString() will resolve this and give more feedback to addon developers.

Some asks from lil' russian pupil

Nothing important I just want to say that is your mod is awesome and stable and ask. Is it possible to make skins effects like slash or fireball and HUD are dependent from chosen in hkmp skin? And I want to know how many problems bring enemy sync? How many time it will take if you start work without any rest like eat or sleep?

Enemy Sync when

I and my friend have been using this mod lately, and we noticed that enemies don't sync, thinking it was a bug i removed and reinstalled the mod, seeing it wouldn't fix i checked the wiki and saw there is none, so, is there going to be an enemy sync?

Give clients feedback when getting Invalid Addons server disconnect

When clients are getting disconnected from a server due to "Invalid Addons", the chat should show a message informing them of which addons are (in)correct and what they should instead connect with. This reduces the amount of confusion players have when trying to connect to a server.

Standalone server arguments?

It might be handy to list the available server arguments somewhere. Now there is only a reference that they exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.