GithubHelp home page GithubHelp logo

longship's People

Contributors

alexmog avatar kohanis 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

Watchers

 avatar  avatar  avatar  avatar

longship's Issues

[Optimization] Optimize GetAllPiecesInRadius

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);
			}
		}
	}

[Optimization] Optimize FindClosestBeaconInRange

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;
	}

[Bug] Commands only listen to messages if it's been shouted

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.

In-Game:
image

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.

Feature request: ward stone improvement.

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.

Wiki is missing

You refer plugin authors to the Wiki page, but the page does not exist.

[Feature] RPC Listener

Provide a way to listen to RPC messages as Events and controll if they execute normally or not.

  • Listen to RoutedRpcs and create related events
  • Listen to other Rpcs

[Optimization] Optimize GetCharactersInRange

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);
			}
		}
	}

TLS Failure on launch

image

New server, new installation, using ValheimPlus and Longship gets the error above on launch

Update 0.147.3 won't let me connect

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.

Useful discoveries

Networking

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 Queries

Most 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

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

Building items

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

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, weight: 1
  • Item2, weight: 2
  • Item3, weight: 7

Item1 will have 1/10 chance of being selected, item2 2/10 chance and item3 7/10.

Game class

The Game class seems to represent the global state of the game. Managing game difficulty etc.

AI

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 !

[Feature] Complete event dispatcher system

Provide a complete Event-dispatching system and mechanism, some events must be able to be canceled.

Events to do:

Player events

  • Player connect event
  • Player disconnect event
  • Place piece
  • Respawn
  • Repair item
  • Use stamina
  • Add new known biome
  • Add new known recipe
  • Add new known piece
  • Add new known station
  • Add new known text
  • Add new known item
  • ADd new trophie
  • Show tutorial
  • Inventory updated
  • Doge
  • Teleport
  • Consume item
  • PvP Status changed
  • Emote started
  • Start ship controll
  • Stop ship controll
  • Targeted
  • Player sends a chat message (using /s)
  • Player sends a chat message (without /s)

Humanoid events

  • Pickup item
  • Drop item
  • Equip item
  • Unequip item
  • Use item
  • Block attack

Character events

  • Character move event
  • Character spawn
  • Character death
  • Character damaged
  • Character heals

World events

  • Weather change

Specific events

  • Fireplace refuel
  • Craftstation interaction
  • Trader interaction

If you find more events to register, do not hesitate to comment this issue

Linux server running problems

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?

[Feature] Commands system

Provide a way for plugins to register and execute chat commands easily.

  • Commands registery system
  • Commands execution mechanism (using /s for now, other methods are more complicated)
  • Simple commands listener

[Bug] Pickup and DropItem events didn't work

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.

[Optimization] Optimise GetClosestPlayer

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;
}

[Question] Why stay on .NET 4?

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.

[Feature Request] Auto delete spawned in items/objects if not in adminlist

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

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.