alexmog / longship Goto Github PK
View Code? Open in Web Editor NEWValheim Dedicated server Fixes, Optimizations and High-Level API
License: MIT License
Valheim Dedicated server Fixes, Optimizations and High-Level API
License: MIT License
Class: Piece
public static void GetAllPiecesInRadius(Vector3 p, float radius, List<Piece> pieces)
{
foreach (Piece allPiece in m_allPieces)
{
if (Vector3.Distance(p, allPiece.transform.position) < radius)
{
pieces.Add(allPiece);
}
}
}
Provide a simple to use permissions system for commands usage.
Same as #6 but with Beacons.
I'm not sure that code is used frequently, need more investigation.
Class: Beacon
public static Beacon FindClosestBeaconInRange(Vector3 point)
{
Beacon beacon = null;
float num = 999999f;
foreach (Beacon instance in m_instances)
{
float num2 = Vector3.Distance(point, instance.transform.position);
if (num2 < instance.m_range && (beacon == null || num2 < num))
{
beacon = instance;
num = num2;
}
}
return beacon;
}
The title explains the majority. Whether this is just a byproduct of my BepInEx port or just down to the wrong chat method being hooked. I'll only know if I ask, though I'd prefer discussions being enabled on this repo so I don't clog the Issues with issues that aren't issues.
Server Console:
[Info : Longship] [Chat] Kyle: I have arrived!
[Info : Longship] [Chat] Kyle: /server
[Info : Longship] Player Kyle, executed command: /server
Notice that there is no "test" chat message just before the "/server" one.
I did try and chat the chat patch to use Talker.RPC_Say()
but to no avail, that seems to get nothing at all.
Hi,
if and when you have time, would you consider looking into the ward stone mechanics and make it something like "players other than authorized cannot dismantle at a distance" and "when authorized players are not online everything is indestructible, for 3 days then decay kicks in"?
Make sense? to make the ward stone a land claim block and a offline griefing protection.
You refer plugin authors to the Wiki page, but the page does not exist.
Add the possibility to make some events cancellable.
Provide a way to listen to RPC messages as Events and controll if they execute normally or not.
Why not use discussions instead? Thank you for this lovely mod btw <3
Another instance of #6 but with characters.
Again, Bruteforce usage, should use a geohash instead.
Class: Character
public static void GetCharactersInRange(Vector3 point, float radius, List<Character> characters)
{
foreach (Character character in m_characters)
{
if (Vector3.Distance(character.transform.position, point) < radius)
{
characters.Add(character);
}
}
}
Hi,
After the latest update I can't connect to a server that has longship installed. I just get a message saying disconnected after a while.
I tried it with an unmodded server and it works without problems.
Valheim uses Zone routing (messages are routed to a specific group of people in the same zone) or global routing (targets can be set to ensure messages are routed to the targeted client).
It's important to note that this routing is demanded on message sending process; For example, when you are talking in the game by not using /s command, it's the client itself that will define who can listen to his message. Of course, the routing part is still done by the server, but, it's the client who will define the target.
That makes it tricky to handle some RPCs that are not targeted directly to the server, that's why commands only work using the /s command right now, it's because /s targets also the server when the message is routed.
I will add hooks to the routing mechanism to be able to still listen to RPCs that are not directly targeted to the server, but it seems to mostly affect Chat messages because they didn't engage any alterations to the character or the environment (which should be validated by the server, event if this is still grey for now, it seems that most of the player's data is only handled by the client itself, which can complicate some event listening on the server part, the server is NOT fully authorative).
All the classes related to networking starts with a Z.
Network grouping of players (probably geographically) seems to be done through the classes ZDO*
and the routing part is done mainly by the ZRoutedRpc
class.
Network zones seems to be managed by ZDOMan
.
The default zone ZOID.None
represents the complete server.
NearBy
QueriesMost calculations that are done to define which entities are nearby are mostly executed by bruteforcing all entities distances calculations. It is clearly not a good way to deal with it and explains why the game developers decided to limit the game to 10 players (event 5 players can be very complicated to compute...), that's why it's important to rework most of these methods by using GeoHash and GeoTrees instead of bruteforcing.
Character
class is the main class for all living
creatures, this includes animals, monsters and players.
Humanoid
inherits from Character
and provide more methods to interact with humanoids
Player
inherits from Humanoid
and provide more methods to interact with players, they represents the player character
Most building items that have their own behaviors have their own class.
The Piece
class represents a Piece of building the player can construct, like a wall.
Drop tables seems to use a classic approach of Weight system (each item has a weight
associated with it, and by making some simple maths, its possible to define which ones have to be selected) for example, imagine the following drop table:
Item1 will have 1/10 chance of being selected, item2 2/10 chance and item3 7/10.
The Game
class seems to represent the global state of the game. Managing game difficulty etc.
MonsterAI
is the class that manages monsters behavior
I am still investigating and retro-engineering the code, it can take me some time to complete this issue, so please be patient !
Provide a complete Event-dispatching system and mechanism, some events must be able to be canceled.
If you find more events to register, do not hesitate to comment this issue
Hi, I am trying to use this on a linux hosted dedicated server, but when running run_longship.sh I get errors:
undefined symbol dlopen inlibdoorstepx_x64.so
Any idea?
Provide a way for plugins to register and execute chat commands easily.
Currently, Longship uses UnityDoorstop as an injection mechanism, which seems not to be used by many mods in the community.
BepInEx (https://github.com/BepInEx/BepInEx) is used by most of the community (at least on this website: https://valheim.thunderstore.io/) which pushes me to provide Longship on BepInEx instead of UnityDoorstop to provide a simpler way for users to have multiple mods using BepInEx including Longship.
0.1 allowed me to disable password, after upgrading to 0.1.5 server throws a "password is too short" error during startup and shuts down.
As I was fearing, the inventory is managed on the client-side, I will see if I can manage a way to force inventories update and listen on these events.
If you have any ideas, do not hesitate !
More info:
Pickup an item process (as I have understood by retro-engineering the code):
When a player pickup an item:
-> Humanoid.Pickup is called on client side
-> Humanoid.Pickup calls ItemDrop.Pickup
-> If ItemDrop.CanPickup() returns true (that means that the client is the owner of this object (Client is the owner = the server leaves the responsibility of the status of that item to the client, it's not the server who controls it anymore))
-> The local inventory is updated with the item, the client destroys the item
-> Else
-> The client sends a "RequestOwn" packet (to ask the server for the ownership of this item) and waits that the ownership of the item switch to the client
-> When the ownership switched to the client, the item is added to the client's inventory
That's exactly why it is very tricky to handle. The server is not authorative, and we will need tricks to handle it.
The method GetClosestPlayer
seems to be used on Update behaviours, and is a bruteforce way to check which player is the closest.
Better ways should be used to avoid checking all players.
Decompiled code (Class: Player):
public static Player GetClosestPlayer(Vector3 point, float maxRange)
{
Player result = null;
float num = 999999f;
foreach (Player player in m_players)
{
float num2 = Vector3.Distance(player.transform.position, point);
if (num2 < num && num2 < maxRange)
{
num = num2;
result = player;
}
}
return result;
}
Make a Discord to the project
Title, you can and probably should update to either 4.7.2 or 4.8. BepInEx will load it either way? If it stays on 4.0 then that's fine, just removes my idea for creating a pull request for something.
Just looking for a little Anti-Cheat, right now as it stands anyone can spawn in any item/object into any server. The fix? well it's just an idea really, basically the server knows when a user spawns in an item/object, solution? check to see if that user is in the adminlist, and if not immediately delete said item/object.
I had someone look into this but they were unable to remove an object after spawning it into the world.. they said if the server could remove it then it would probably work.
Things they tried as a player:
call .DEtostry() on said object.
ZNetScene.instance.Destroy(base.gameObject);
Again they were unsuccessful but maybe the server doing it would work?
Kind Regards,
-b3ck
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.